Parallax mapping bux (w/ fix)

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
Post Reply
jox
Bug Slayer
Posts: 726
Joined: Thu Apr 22, 2004 6:55 pm
Location: Germany

Parallax mapping bux (w/ fix)

Post by jox »

The parallax mapping is really really great! One thing I noticed though, is that the lighting behaves wrong. In one direction (horizontally or vertically) the normal directions are swapped. The following image demonstrates that:

Image

(There is only one light source, I removed the other one from the demo)

I could fix it by replacing the following two lines in CNullDriver.cpp:

Code: Select all

core::vector3df v1(x*hh, nml32(x, y-1, pitch, dim.Height, in)*amplitude, (y-1)*vh);
core::vector3df v2(x*hh, nml32(x, y+1, pitch, dim.Height, in)*amplitude, (y+1)*vh);
with

Code: Select all

core::vector3df v1(x*hh, nml32(x, y+1, pitch, dim.Height, in)*amplitude, (y-1)*vh);
core::vector3df v2(x*hh, nml32(x, y-1, pitch, dim.Height, in)*amplitude, (y+1)*vh);
(the 16 bit version should be similar)

After the change the reflections are correct.
It is like it is. And because it is like it is, things are like they are.
AlexL
Posts: 184
Joined: Tue Mar 02, 2004 6:06 pm
Location: Washington State

Post by AlexL »

Thanks for the fix Jox, I was wondering about this and now I don't have to worry about it anymore :) Thanks again.
afecelis
Admin
Posts: 3075
Joined: Sun Feb 22, 2004 10:44 pm
Location: Colombia
Contact:

Post by afecelis »

as usual, great work Jox! and thanks for your your sharp eye to catch'em! :wink:
niko
Site Admin
Posts: 1759
Joined: Fri Aug 22, 2003 4:44 am
Location: Vienna, Austria
Contact:

Post by niko »

afecelis wrote:as usual, great work Jox! and thanks for your your sharp eye to catch'em! :wink:
Nothing to add :D
Post Reply