|
|
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
|
|