PDA

View Full Version : Deluxemap readjustment for dot3 bumpmapping


fo0z
22nd October 2005, 18:56
Hello everybody,

I discovered recently the deluxemap, and I want to use it.
However, my video card does not support glsl or arb shaders, then I tried the dot3 method to make bumpmapping in quake3 ( qfusion exactly ).

Actually, deluxemap light vector colors are not calculed from the surface ( the bumpmapped one ) space, but from the world space.
I made some test on a simple cube room map :
I have this :
http://fo0z.whiteplasma.com/public/medias/images/qfusion/q3map2/badDeluxeMap.png

Whereas I want that :
http://fo0z.whiteplasma.com/public/medias/images/qfusion/q3map2/idealDeluxeMap.png

My modifications in q3map2 does not work totaly correctly, and make me this :
http://fo0z.whiteplasma.com/public/medias/images/qfusion/q3map2/notbadDeluxeMap.png

The code :
in light_ydnar.c@IlluminateRawLightmap:1666
[...]
/* add to light direction map (fixme: use luxel normal as starting point for deluxel?) */
if( deluxemap )
{
/* color to grayscale (photoshop rgb weighting) */
brightness = trace.color[ 0 ] * 0.3f + trace.color[ 1 ] * 0.59f + trace.color[ 2 ] * 0.11f;
brightness *= (1.0 / 255.0);
trace.direction[0] -= trace.normal[0] - 0; // add
trace.direction[1] -= trace.normal[1] - 0; // add
trace.direction[2] -= trace.normal[2] - 1; // add
VectorNormalize( trace.direction, trace.direction ); // add
VectorScale( trace.direction, brightness, trace.direction );
VectorAdd( deluxel, trace.direction, deluxel );
}
[...]

The -0 -0 -1 thing is the default normal of the world, ie Vector( 0,0,1 ).
Thus I would like success to make correct deluxemap calculated from surface space.

I hope all that can help you to help me ;).
Thanks !

Twisted0n3
22nd October 2005, 22:47
You will deactivate your shields and escort us to Vector( 0,0,1 ) where you will be assimilated -- resistance is futile!

fo0z
22nd October 2005, 23:36
Erm ... oh yeah sure :suspicious: ..... someone else :lookaround: ?

ydnar
23rd December 2005, 09:18
Deluxemaps have to be in worldspace and not tangent (surface) space because lightmaps are projected onto nonplanar surfaces. Given that the tangent space under a lightmap pixel, which is relatively large, can change so dramatically, I chose specifically to put the deluxe vector into world space.

To put it a different way, if it was in tangent space, it would be an approximation at best and the error would be rather noticable.

y

Loffy
23rd December 2005, 09:35
Hi ydnar!

C
16th February 2007, 22:25
nice colors..



2005