POV-Ray : Newsgroups : povray.unofficial.patches : Why the scaling of normals in megapov is wrong : Re: Why the scaling of normals in megapov is wrong Server Time
2 Sep 2024 14:17:33 EDT (-0400)
  Re: Why the scaling of normals in megapov is wrong  
From: Fabian Brau
Date: 15 Dec 1999 05:26:46
Message: <38576D7D.879A8E35@umh.ac.be>
Again I didn't know which of megapov of povray is right
because I haven't check. But All that it is said here is right. So 
if megapov don't do this, megapov is wrong.
This is espacially explicit :

>   If you scale uniformly a heighfield, everything gets bigger or smaller,
> but the normals (ie. the slopes of the heightfield) don't. They stay
> unmodified. If the slope at a certain point was 1 (ie. 45 degrees), after
> scaling the heightfield by 5 the slope at that point will still be 1.
> The heightfield gets 5 times deeper, but note that it also gets 5 times
> wider, so the slope stays the same.
>   You can think it this way: If you scale a triangle uniformly, the angles
> of the sides do not change.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
I just add. The length of its side change but not the angle between
them.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
>   This means that (supposing that we have a light source very far away) the
> shading of the heightfield does not change if you scale it by 5 (or by 10 or
> by anything).
>   Thus, the slopes of a surface do not depend on its scale (if we are scaling
> uniformly).

Suppose you look the surface of a heightfield not from above but from
the side 
(I hope you understand). Suppose that the surface is like a triangle
(this 
could be anithing else it is just a pedagogic example :)), like in the
following 
image (sorry for this tiny binary but I think it is important). Aplha is
the 
slope (or tan(alpha) is you prefer). If I scale my triangle, alpha don't
change.
The length of the side change, so my heightfield will be bigger, but the
slope of 
any point of the surface doesn't change!
This behavior must be the same for normal in texture block.

Now if Megapov already do this like this, so I am sorry for this spam!

Fabian.

Nieminen Juha wrote:
> 
>   The behaviour of normals when applying scaling to them has been changed
> in megapov. Nathan says that it fixes a bug in the official povray. Indeed,
> there is a bug in povray about scaling normals, but the "fix" in megapov
> is just in the wrong way. Instead of fixing the part that is wrong in
> the official povray to work as the parts that are right, now everything
> works in the wrong way.
>   Let me explain:
> 
>   A normal pattern actually simulates a heightfield. A heightfield would
> have differences in height and differences in the orientation of the normal
> vector (with respect to the average normal vector of the whole surface).
> A normal modifier modifies just the normals (this is often enough when
> the differences in height are insignificant).
>   Thus, a normal modifier should work as a heighfield works.
>   If you scale uniformly a heighfield, everything gets bigger or smaller,
> but the normals (ie. the slopes of the heightfield) don't. They stay
> unmodified. If the slope at a certain point was 1 (ie. 45 degrees), after
> scaling the heightfield by 5 the slope at that point will still be 1.
> The heightfield gets 5 times deeper, but note that it also gets 5 times
> wider, so the slope stays the same.
>   You can think it this way: If you scale a triangle uniformly, the angles
> of the sides do not change.
>   This means that (supposing that we have a light source very far away) the
> shading of the heightfield does not change if you scale it by 5 (or by 10 or
> by anything).
>   Thus, the slopes of a surface do not depend on its scale (if we are scaling
> uniformly).
> 
>   Now, the normals in (the official) povray usually work this way, ie. they
> work as the heightfield: If you scale the object (uniformly), the slopes do
> not change. This is the right way.
>   However, there is a bug in povray. If you put the normal modifier inside
> a normal_map block and then scale, the slopes will be scaled too (for some
> reason). For example, if you scale the object by 5, the slopes of the
> normal modifier will be scaled be 5.
>   To get the same behaviour with a heightfield you would have to
> scale it by <5,25,5>. This way the slopes will be scaled by 5, but as we
> can see, it's not an uniform scale anymore. The heightfield gets 25 times
> deeper while only 5 times wider. The same thing happens with the normals:
> The apparent depth gets 25 times larger instead of just 5.
>   This, of course, is a bug. I, among anothers, have noticed and discussed
> this bug. It has some serious implications, as you can imagine. It's like
> having tiny holes in your objects and when you scale the object by 5 the
> holes get 25 times deeper. It's just plain wrong.
> 
>   Now, the megapov "fixes" this bug, but it fixes it in the wrong way!
> Instead of making the normals inside a normal_map block not to change their
> slope when scaling, it scales all the slopes everywhere. So instead of
> eliminating a bug that affects a special case, the bug has been widespread
> to affect everything.
>   Nathan says that this is the behaviour he expects. Sorry Nathan, but you
> are wrong. I hope you understand it.
>   If you scale the slopes by 5 when scaling the object by 5, the apparent
> depth of the surface gets scaled by 25. This is just wrong.
>   I truely hope that you fix this wrong behaviour.
> 
> --
> main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
> ):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message


Attachments:
Download 'graphique1.jpg' (9 KB)

Preview of image 'graphique1.jpg'
graphique1.jpg


 

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