Hardly any games use OpenGL''s built in lights.
Most games these days are using lightmaps, and some of the "next gen" games like Doom 3 use per pixel lights, where there is no 8 light limit.
Eight GL_LIGHT limit
so how do those work? just a quad that stays alligned with its object? then how do they make the light hit 2 zones like this? :
side view:
------------------> |
--------------> =====
--------------> |
but is this the idea? :
top view:
. -
| o |
. -
| and - symbolise quads. o is an object emmitting ''light''
side view:
------------------> |
--------------> =====
--------------> |
but is this the idea? :
top view:
. -
| o |
. -
| and - symbolise quads. o is an object emmitting ''light''
Q3 uses the OpenGL lights for models. Only static geometry is lightmapped.
What on earth are you talking about?
The only time a pass will destroy the previous contents of the framebuffer is when the blend state is set to ( GL_ONE, GL_ZERO ). Ie, blending is disabled. Or, when you use standard alpha blending and everything has a full alpha.
Learn what you''re talking about before you start to spread mis-information.
For instance, lets see how you can apply a shadow map to a scene, in a two pass fashion. In the first pass, you''d set the blending state to GL_ONE, GL_ZERO, and render the decal texture. For the second pass you''d set the blending state to GL_DST_COLOR, GL_ZERO ( a modulation ), and render the shadowmap. Now, at no point does the second pass destroy the first. No stencil buffer is used.
Death of one is a tragedy, death of a million is just a statistic.
quote:
Original post by Wildfire
One rendering pass will destroy the previous, unless you preserve the results of the previous one. So you''d have to do all sorts of alpha blending or bit masking etc...
The only place I remember ever using multiple passes was with shadow volumes. You have one rendering pass that marks that parts of the screen that are in shadow, then you render the non-shadow part, then the shadow part. This works only because those rendering passes occur in different parts of the screen, and thus don''t cancel each other out. The first rendering pass does not produce visible results, and will do bit masking only.
What on earth are you talking about?
The only time a pass will destroy the previous contents of the framebuffer is when the blend state is set to ( GL_ONE, GL_ZERO ). Ie, blending is disabled. Or, when you use standard alpha blending and everything has a full alpha.
Learn what you''re talking about before you start to spread mis-information.
For instance, lets see how you can apply a shadow map to a scene, in a two pass fashion. In the first pass, you''d set the blending state to GL_ONE, GL_ZERO, and render the decal texture. For the second pass you''d set the blending state to GL_DST_COLOR, GL_ZERO ( a modulation ), and render the shadowmap. Now, at no point does the second pass destroy the first. No stencil buffer is used.
Death of one is a tragedy, death of a million is just a statistic.

If at first you don't succeed, redefine success.
quote:
The only time a pass will destroy the previous contents of the framebuffer is when ... blending is disabled.
Which is exactly what I said:
quote:
One rendering pass will destroy the previous, unless you preserve the results of the previous one.
So you'd have to do all sorts of alpha blending or bit masking [in order to preserve/use the previous frame buffer content]
I just put it the other way round.
And, as far as I know, blending is disabled by default in OGL.
So, again, any rendering pass that produces visible results will destroy the previous one, unless you enable blending or use the stencil buffer, or other means of preserving previous frame buffer contents or mixing them with the new ones in some way or the other (most likely blending of some sort).
I have implemented both shadow volumes with one and multiple light sources, so I think I know a bit about multiple rendering passes and using the stencil buffer/alpha bleding (w. extensions) to produce a final visible output.
[edited by - Wildfire on July 5, 2003 10:55:07 AM]
How do I set my laser printer on stun?
Ok.
Still, there are far more applications of multipass rendering than shadow volumes. The way you said that the only thing you''d used multipass rendering was for your shadow volumes implied that it''s hardly ever used, and isn''t used for much. This made me think that you didn''t know what you were talking about.
Death of one is a tragedy, death of a million is just a statistic.
Still, there are far more applications of multipass rendering than shadow volumes. The way you said that the only thing you''d used multipass rendering was for your shadow volumes implied that it''s hardly ever used, and isn''t used for much. This made me think that you didn''t know what you were talking about.
Death of one is a tragedy, death of a million is just a statistic.

If at first you don't succeed, redefine success.
I admit my statement was a bit misleading. By saying shadow volumes were the only thing I used multiple passes on, I didn't mean to imply it was the only use at all.
My guess would be that your example, shadow mapping, is by far the most common. Which makes it a better example for multiple rendering passes.
But, as I think about it again, Silvermace's suggestion to use multiple passes to realize more then eight lights, shouldn't be too different from doing shadow volumes for more then one light source. You should be able to use additive blending (ogl-extension) to produce the final image. This blending mode isn't supported by all hardware though (mostly older hardware, by now), so this solution has it's own limits.
You'd have to render the scene using the first eight lights, then disable those, enable the next eight lights, and add both images together.
[edited by - Wildfire on July 5, 2003 11:25:30 AM]
My guess would be that your example, shadow mapping, is by far the most common. Which makes it a better example for multiple rendering passes.
But, as I think about it again, Silvermace's suggestion to use multiple passes to realize more then eight lights, shouldn't be too different from doing shadow volumes for more then one light source. You should be able to use additive blending (ogl-extension) to produce the final image. This blending mode isn't supported by all hardware though (mostly older hardware, by now), so this solution has it's own limits.
You'd have to render the scene using the first eight lights, then disable those, enable the next eight lights, and add both images together.
[edited by - Wildfire on July 5, 2003 11:25:30 AM]
How do I set my laser printer on stun?
Additive blending is supported without extensions.
All you do is use the blend state of GL_ONE, GL_ONE.
Death of one is a tragedy, death of a million is just a statistic.
All you do is use the blend state of GL_ONE, GL_ONE.
Death of one is a tragedy, death of a million is just a statistic.

If at first you don't succeed, redefine success.
I guess using glBlendFunc(GL_ONE,GL_ONE) || GL_FUNC_ADD_EXT may in fact produce the same output. My fault
[dang, again]
I was using GL_FUNC_REVERSE_SUBTRACT_EXT, so using an extension for additions too seemed only natural

I was using GL_FUNC_REVERSE_SUBTRACT_EXT, so using an extension for additions too seemed only natural

How do I set my laser printer on stun?
How is this 8-lights limit problem solved in games like Splinter Cell or Max Payne 2? If there is a fire, near walls and models (humans) are affected by the yellow light. In Max Payne 2 for example the character''s face is covered in a yellow color when shooting. Now, if there are more than 8 characters shooting at once, how is that done? Do they use vertex shaders for that?
Most likely by avoiding it. Just think about this:
Take a room with say 10 characters in it, shooting at each other. What do you expect? Probably some flickering to simulate the guns muzzleflash. If all the guns would fire in synch, all ten muzzleflash-lights would have to go on and off same time. However, this is not the case. All lights will flicker on and off at random order. You would have to work out some kind of 'collision detection' (CSMA/CD anyone?
) that avoids more then eight lights being switched on. Something like: if there's already eight lights on, delay any other light from switching on. As soon as one light goes out, switch on the light that requested to switch on first.
Besides that, it's an action game, so the player is most likely more busy with dodging bullets, then trying to see if all firing guns really produce a muzzle flash. So you could simply limit the effect to the first eight guns firing.
Or you could use some multi-texturing to superimpose a 'glow'-texture over the walls and players whenever a gun is fired. Scaling and brightening/darkening the texture according to distance from 'lit' object.
Edit: This is a few suggestions how it might be done. In no way do I claim to know that this is how the programmers of 'Max Payne' or 'Splinter Cell' did it. If you really want to know, you'd have to ask them
[edited by - Wildfire on July 5, 2003 2:53:44 PM]
Take a room with say 10 characters in it, shooting at each other. What do you expect? Probably some flickering to simulate the guns muzzleflash. If all the guns would fire in synch, all ten muzzleflash-lights would have to go on and off same time. However, this is not the case. All lights will flicker on and off at random order. You would have to work out some kind of 'collision detection' (CSMA/CD anyone?

Besides that, it's an action game, so the player is most likely more busy with dodging bullets, then trying to see if all firing guns really produce a muzzle flash. So you could simply limit the effect to the first eight guns firing.
Or you could use some multi-texturing to superimpose a 'glow'-texture over the walls and players whenever a gun is fired. Scaling and brightening/darkening the texture according to distance from 'lit' object.
Edit: This is a few suggestions how it might be done. In no way do I claim to know that this is how the programmers of 'Max Payne' or 'Splinter Cell' did it. If you really want to know, you'd have to ask them

[edited by - Wildfire on July 5, 2003 2:53:44 PM]
How do I set my laser printer on stun?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement