RE: [Algorithms] per-pixel lighting (was: Dynamic lights with sta tic shadows)
Brought to you by:
vexxed72
From: Tom F. <to...@mu...> - 2000-11-10 12:19:56
|
You could do the two passes of each lightsource to the destination alpha channel, then add it to the colour channel with a render using a DESTALPHA:ONE blend, with your source being the colour of the lightsource. In this case, you can bin the extra pass and do: -Clear screen for ( each light ) { -Render attenuation stuff to dest alpha channel. -Render dot3 bumpmap, use DESTALPHA:ONE. } -Steps 2+ as below. Looks like dest alpha is toast in DX8 though. Why???? Tom Forsyth - purely hypothetical Muckyfoot bloke. This email is the product of your deranged imagination, and does not in any way imply existence of the author. > -----Original Message----- > From: Charles Bloom [mailto:cb...@cb...] > Sent: 09 November 2000 22:33 > To: gda...@li... > Subject: RE: [Algorithms] per-pixel lighting (was: Dynamic lights with > static shadows) > > > > Hmmm... I can't see how I could do multiple lights with dot3 mapping > and per-pixel attenuation. To summarize, the basic way to do all > this fancy per-pixel lighting stuff is : > > 1. for each light affecting the model : > 1a. set up multi-texturer to compute the lighting per pixel > add it into the frame buffer > (just set it in the first time) > 2. render the model with color = ambient lighting, > add it into the frame buffer > 3. render the model with texturing, do a multiply (or multiply 2x) > 4. render specular and/or environment map pass with additive rop > > This is all very good, the problem is if in pass 1a you want to > do both per-pixel attenuation and per-pixel dot products. The > problem is you need to multiply those together, and then add them > to the frame buffer. You can't do this though, because you'd need > a temp work space to do the multiply (except perhaps with the > 3 texture > combiners in Radeon, you might be able to get it all in one pass). > > Am I right about this? It seems there's no hope for GF2, except > with just one light (with one light, you can stuff the attenuation in > first, then multiply by the dot product, then add on the ambient), > or if you are willing to use a temp storage space. If you're just > doing gray-scale lighting you could store the lighting > computation into > the frame buffer alpha channel. > > > At 11:33 AM 11/9/2000 -0800, you wrote: > >There is a demo on Nvidia's site by Cass Everitt showing two > ways to do > >point light attenuation. > >One calculates a per pixel ( 1 - d^2 ), the other calculates > per-pixel ( e ^ > >-d^2 ). > > > >Both of these techniques have the nice property that they > work on arbitrary > >geometry with no > >CPU work on HW T&L cards, and are per-pixel accurate. > > > >See the "Attenuation Maps" portion of Game Programming Gems > for my writeup > >on this idea. > > > >-----Original Message----- > >From: Jason Zisk [mailto:zi...@n-...] > >Sent: Thursday, November 09, 2000 10:36 AM > >To: gda...@li... > >Subject: Re: [Algorithms] Dynamic lights with static shadows > > > > > >> Quake3 is done with a separate pass, which really is a > more sensible way > >to > >> go. > > > >How does the separate pass affect the lightmaps though? I'd > assume you want > >the globe of light to eliminate any shadows under it, is > there a blending > >mode that would do this? Somehow keep the texture > information and just > >eliminate the lightmap where there is a texel of light. > > > >Also, how is the globe of light calculated? I can't seem to > figure that one > >out. Is it just a texture that looks like a circle of light that is > >projected onto the geometry around the light source? I > can't seem to come > >up with a way that would work for a complex environment and > point lights. > > > >Or do you step through each texel on the lightmap > calculating distance to > >the light source? That would seem slow but easier to > program, just need to > >convert the UV on the lightmap texture to world space to > calculate intensity > >of the light at that point. > > > >Thanks, > > > >- Jason Zisk > >- nFusion Interactive LLC > > > >_______________________________________________ > >GDAlgorithms-list mailing list > >GDA...@li... > >http://lists.sourceforge.net/mailman/listinfo/gdalgorithms-list > >_______________________________________________ > >GDAlgorithms-list mailing list > >GDA...@li... > >http://lists.sourceforge.net/mailman/listinfo/gdalgorithms-list > > > > > -------------------------------------- > Charles Bloom www.cbloom.com > > _______________________________________________ > GDAlgorithms-list mailing list > GDA...@li... > http://lists.sourceforge.net/mailman/listinfo/gdalgorithms-list > |