POV-Ray : Newsgroups : povray.general : Problem with normals and stretched uv maps : Problem with normals and stretched uv maps Server Time
31 Jul 2024 08:29:15 EDT (-0400)
  Problem with normals and stretched uv maps  
From: Rune
Date: 28 Jul 2007 07:26:06
Message: <46ab27ce@news.povray.org>
I have discovered a problem that occurs when using normals in combination 
with UV maps.

The problem arises when a UV map covering the area of <0,0> to <1,1> must 
cover a surface which is longer in one direction than in the other. To 
counter the stretched UV map, the texture can be scaled to stretch inversely 
with this. However, this counter-scaling is all that POV-Ray sees. It 
doesn't see that the UV map was stretched in the first place. As a result, 
the normals are calculated in a way that doesn't make sense - they have far 
more depth in one direction than in the other, because POV-Ray *thinks* that 
the normal has been squished together in one direction, which isn't however 
the case on the actual surface.

The minimal scene below clearly demonstrates the problem. (See image in 
povray.binaries.images) Any ideas for workarounds? I need it for a scene I'm 
working on...

camera {location -3*z}
light_source {<-1,2,-2>*100 color 1}
#default {pigment {rgb 1}}
background {rgb 0.3}

#declare Normal = normal {
   leopard 4 scale 0.05
}

mesh {
   triangle {0,   x, y uv_vectors 0,   u, v}
   triangle {x+y, x, y uv_vectors u+v, u, v}
   uv_mapping normal {Normal}
}

mesh {
   triangle {0,     5*x, y uv_vectors 0,   u, v}
   triangle {5*x+y, 5*x, y uv_vectors u+v, u, v}
   uv_mapping normal {Normal scale <1/5,1,1>}
   translate -1.1*y
}

mesh {
   triangle {0,     x, 5*y uv_vectors 0,   u, v}
   triangle {x+5*y, x, 5*y uv_vectors u+v, u, v}
   uv_mapping normal {Normal scale <1,1/5,1>}
   translate -1.1*x
}

Rune
-- 
http://runevision.com


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.