Hi... dynamic lighting

Started by
7 comments, last by fries 21 years, 1 month ago
I was playing around with the register combiners on my GF2MX and i can get some pretty nice effects... including specular anbd diffuse bump mapping, distance attenutation, and projective textures using cube maps... the only problem is how i combine all these effects into a multi pass system? Im not sure what blend modes to use and what order the effects should be in. I also want an ambiant pass to lighten up the darker areas of the ''world'' and i implemented a cute little effect to do ''ambiant'' bump mapping. Another thing i would like in my effects is gloss mapping for the specular pass, and also the decal texture''s alpha channel should act as a ''glow channel'' ie. where the alpha is 1, the texture is fully illuminated no matter what light is or isnt effecting it. can someone please help? Maby Yann L... youre presst smart?
Advertisement
http://www.ronfrazier.net/apparition/index.asp?appmain=research/advanced_per_pixel_lighting.html

"take a look around" - limp bizkit
www.google.com
If that's not the help you're after then you're going to have to explain the problem better than what you have. - joanusdmentia

My Page davepermen.net | My Music on Bandcamp and on Soundcloud

Yeah... ive looked at that quite a bit, but its crap... it takes 3 passes to do its specular lighting alone! and another 3 for the diffuse bump... what a waste... and i dont see how they managet to eat up so many passes... i do it in 1 pass each, i just need to know how to blend them and in what order...
I did some thingling, and i came up with his equation

([diffuse * Cube Projection * Distance Attenuation + ] Ambiant) * Decal Texture [ + specular]

The parts in [] are calculated per light, and each clause is 1 pass and the + and * repesent a blendmode.
The only problem is calculating this:

[diffuse * Cube Projection * Distance Attenuation + ]

because i can do this: x1*y1*z1*x1*y2*z2*etc... on my card really easyly, and i can also do this x1+y1+z1+x2+y2+z2+etc. But then i combine multiplications and additions its ends up looking somthing like this: ((x1*y1*z2+x2)*y2*z2+x3)*y2*z3)) Which is not at all good... Someone please help me with this... If carmack can do it, i can too...
quote:Original post by fries
Yeah... ive looked at that quite a bit, but its crap... it takes 3 passes to do its specular lighting alone! and another 3 for the diffuse bump... what a waste... and i dont see how they managet to eat up so many passes... i do it in 1 pass each, i just need to know how to blend them and in what order...


its not crap, its very good. sure, it uses tons of passes, but its the way to go. if you would understand how he does it, you would not have any problems to set up your passes..

if you don''t understand why he does what in what way, you definitely need to learn how he does it. at least he got working what you don''t get currently:D

don''t take this as harsh, i know its a bad implementation, but i''ve learned most from his page, including how to set up the blending unit to do math with help of multipass. its definitely worth understanding..

"take a look around" - limp bizkit
www.google.com
If that's not the help you're after then you're going to have to explain the problem better than what you have. - joanusdmentia

My Page davepermen.net | My Music on Bandcamp and on Soundcloud

how many passes dows it take you to do your lighting?

Another thing about his code is that he draws the decal texture again for every light!!! this is a huge waste of rendering passes since the decal texture only needs to be drawn once!

[edited by - fries on March 8, 2003 10:58:49 AM]
My lighting takes different numbers of passes depending on the hardware its run on.

1 pass if 5 (or more) texture units are available
2 passes if 4 texture units are available
3 passes if 2 texture units are available

I could reduce that a bit if I used register combiners on nVidia hardware, or ARB_fragment_program where available.

-----------------------
"When I have a problem on an Nvidia, I assume that it is my fault. With anyone else''s drivers, I assume it is their fault" - John Carmack
-----------------------"When I have a problem on an Nvidia, I assume that it is my fault. With anyone else's drivers, I assume it is their fault" - John Carmack
Maximus, would you mind explaining how your 3 pass/2 texture unit lighting works? And does it also do specular highlights? Id really appriciate the information
On the first pass, I render (Attenuation*Attenuation) into the alpha buffer.

On the second pass, I render (NormalMap.NormalizationCubemap) into the alpha buffer, blending it against the current alpha values that are in there.

On the third pass, I render (PrimaryColour*Diffuse) into colour, blended with the current alpha buffers value.

Taking the attenuation to a high power (Attenuation*Attenuation) takes care of a small specular effect, though specular isnt something Im terribly worried about, TBH.

-----------------------
"When I have a problem on an Nvidia, I assume that it is my fault. With anyone else''s drivers, I assume it is their fault" - John Carmack
-----------------------"When I have a problem on an Nvidia, I assume that it is my fault. With anyone else's drivers, I assume it is their fault" - John Carmack

This topic is closed to new replies.

Advertisement