## Re: [Algorithms] Volumetric light rays

 Re: [Algorithms] Volumetric light rays From: shankar ghosh - 2002-11-04 07:16:08 ```THanks everyone for the replies, I was very busy the last few days. Nicholas, That's the method I have for volumetric fog.To get backface depth - frontface depth in the alpha channel. But I'm not sure about how to etend this to light volumes.Supply the attenuation with a 1d texture and then integrating along the view ray should do it.But I'm not sure if this will work if this will work with concave light beams. But light beams are interesting only when the volumes are concave. I'll go through all of your replies, thanks. S --- Nicholas Francis wrote: > Just my own thoughts about this: > > What really determines the strength of the light > volumes is the amount > of air between entering and exiting the ray (yeah, > yeah.. the number of > dust particles). If you then use sphere-like rays, > getting the alpha > from the normal is a nice way. This will also - > (almost) work with > cylinders. It was the way I did it in 3DStudio back > in DOS :) > > There is another thing (I'm unsure why): When you > look along a light > ray, it is _much_ sharper towards the light source > than away from it. > This can also be fudged rather easily. > > One thing that always peeves me, though is when I > see games that have > objects moving through the volume. They are always > fully affected by > the ray 'till they get to the front of it, where the > depth buffer pulls > them out of it. They should fade in (as they move > towards the front). > > I don't think this can easily be done on todays HW, > but here I'll try > to get the ball rolling: > > What we really want is the depth between the > backfaces of the ray, and > the frontfaces: > RayAlpha = backDepth - FrontDepth (at a given pixel) > - > If we render the backfaces first, and set the > Z-buffer to the depth > (while still maintaining the standard depth test > setup), we get > backDepth in the Z-buffer > If somebody moves through the light volume, they > change the depth, > hence they make the Z become nearer. Thus the > fogging amunt becomes > less (which is what we want). > > The problem I see is that we can't do blending math > on the Z-buffer. > But couldn't we use the aplha channel and set up > blending when we > render the frontfaces? then the blending factor for > the light polygons > would simply be DestAplha - SrcAlpha. Unfortunately, > I haven't been > able to fit this blend operation into the OpenGL > pipeline, and sort of > stopped my exploration there... > > Can anyone take it further (in a way that is not way > too expensive :-)? > > cheers, > Nicholas > __________________________________________________ Do you Yahoo!? HotJobs - Search new jobs daily now http://hotjobs.yahoo.com/ ```