POV-Ray : Newsgroups : povray.general : Problem with normals and stretched uv maps Server Time
5 Nov 2024 07:19:39 EST (-0500)
  Problem with normals and stretched uv maps (Message 1 to 2 of 2)  
From: Rune
Subject: Problem with normals and stretched uv maps
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

From: Rune
Subject: Re: Problem with normals and stretched uv maps
Date: 28 Jul 2007 07:45:14
Message: <46ab2c4a@news.povray.org>
Some additional notes:

The counter-stretching is not the source of the problem. While it is used 
here to make the problem more obvious, the normals will be evaluated 
incorrectly when a UV map is stretched, no matter how the normal is scaled.

I would say that the problem manifests itself in almost all uses of UV maps 
with normals. At least on curved surfaces, mapping a planar texture onto it 
will *always* result in some amount of stretching.

I don't know if the behavior is a bug or a limitation. In any case, as long 
as it is there, artists should be very cautious about using normals in 
combination with UV mapping.

Rune
-- 
http://runevision.com


Post a reply to this message

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