Sign in to follow this  

Spot light effect (HL2)

This topic is 4336 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey All, I'm trying to implement a spot light effect by projecting a texture onto the scene from the spotlight point of view (camera). This way the spot light confirms to the geometry. But that is just half of the effect! What I really want is to include the lightning effect from the light source to the final destination, just like this shot: So it will be a matter of brighten up the area effected by the light from the source to the destination. I've seen this in Half Life 2 .. Any suggestions/help on how to archive this (in a pixel shader, HLSL) ?

Share this post


Link to post
Share on other sites
I'd suggest just using a big billboard like triangle(s). You could texture them with a "foggy" texture, like in that image if you want. It would take some effort to get it working right, but could, potentially, look pretty impressive.

I suppose another way would be something similar to volumetric shadows (aka stencil shadows), if you know what those are. Instead of making a shadow, you're making a lit area, but the concept is the same. You'd also want to light up the volume itself, and maybe even blur it a bit, but this would be much more accurate than the standard billboard.

Hope this helps :).

Share this post


Link to post
Share on other sites
Quote:
Original post by sirob
I'd suggest just using a big billboard like triangle(s). You could texture them with a "foggy" texture, like in that image if you want. It would take some effort to get it working right, but could, potentially, look pretty impressive.

I suppose another way would be something similar to volumetric shadows (aka stencil shadows), if you know what those are. Instead of making a shadow, you're making a lit area, but the concept is the same. You'd also want to light up the volume itself, and maybe even blur it a bit, but this would be much more accurate than the standard billboard.

Hope this helps :).


one question:
if you implemented the light volume with a stencil buffer, could u also create smooth edges? i have once implemented shadow with stencil shadows but i could only create "hard shadows" with hard edges. but i suppose u need 2 cones to make the lightspot look good.

Share this post


Link to post
Share on other sites
Quote:
Original post by compiler
if you implemented the light volume with a stencil buffer, could u also create smooth edges? i have once implemented shadow with stencil shadows but i could only create "hard shadows" with hard edges. but i suppose u need 2 cones to make the lightspot look good.

You can apply post-processing effects to soften the edges of a shadow volume - but the performance hit can be really nasty. Getting true soft shadows from a stencil volume technique would be pretty difficult - getting the umbra/penumbra to smoothly interpolate wouldn't be easy.

I won't be able to find it in my posting history, but someone posted their masters thesis (?) on the topic. Might be worth searching for if you're interested.

hth
Jack

Share this post


Link to post
Share on other sites
Yes, I remember that thesis. I found it very interesting, but didn't have the time to look through all the code.

I'm afraid applying post-process effects to stencil shadows in the traditional way just wouldn't be pixel perfect. That thesis had a whole process to applying blur to the shadow without causing glitches.

On the other hand, I guess you could use some technique when actually rendering the fullscreen quad, to maybe make it smoother:
It should be pretty easy to transform the light into screen coords, and use that to draw some kind of glow in the general direction its pointing at. Once you do this, you use the stencil shadow volume (the actual volume too, not just the shadows) and render your generated "glow". You'll get pixel perfect lighting, and depending on how good the "glow" is, it could look pretty, very pretty.

Hope this helps.

Share this post


Link to post
Share on other sites

This topic is 4336 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this