Jump to content
  • Advertisement
Sign in to follow this  
D.V.D

OpenGL Geomtery based lighting

This topic is 2062 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

I had this idea that Im sure has been implemented before, I wanted to make a lighting technique where you have a set of vertices and use those vertices as your light volume. For example, if you had a area light kind of like in the crysis 3 tech demo, you would have a box where one face of the box projects a light texture that won't go past the other side of the mesh. Im pretty sure one of the crysis 3 developer video's had this, but I was then wondering how you would go about defining which faces generate the light and I couldn't think of a way that would be easy to program without a predefined set of shapes. Does anyone know how I would go about doing something like this in OpenGL, C++?

Share this post


Link to post
Share on other sites
Advertisement

I would recommend you download the Cryengine free SDK and look at the source code. I know exactly what you're talking about and I used it for the lights on the helipad I built. But I'm pretty sure there is no "easy to program" way of doing this.

 

It is really just a trick, the light is not coming from the surface. It is not well documented.

 

First I created a small object and textured it. I also painted some glow on the surface (incadescence) and then I created a light right in front of it. Then I used a shape to clip the light so it looks like it is coming from the glowing surface. The lightshape is linked to the light and the glowing surface is not actually emitting.

 

I hope this helps. Now I am late for class unsure.png

 

http://www.zbrushcentral.com/attachment.php?attachmentid=347274 

Share this post


Link to post
Share on other sites
Many tutorials on deferred rendering will do this. The projected light texture is sometimes called a 'gobo'.

Share this post


Link to post
Share on other sites

For clarification, is this calculating the effect of lighting *as emitted from the polygons* or just bounding an area of influence? If it's the former, you're in for one hell of a time trying to calculate all that analytically. If it's the latter, see Hodgman's post.

Share this post


Link to post
Share on other sites

Actually, now that I look at the question again. I think it is asking about two different lighting methods.

 

The projected light texture that Hodgman is talking about gives you similar, and probably way more control over the shape of the emission but is not the same as geometry clipping light shape. You would then be controlling the light shape with a texture instead of geometry. It works like a lot like a decal.

Share this post


Link to post
Share on other sites
Well i was thinking more along the lines of the light being controlled by the geometry and the volume inside the geometry is where the light is, not outside of the volume ( before the first bounce that is )

I guess you could say projected textures, i tried looking up what a gobo is and thats pretty much what i was looking for except that i only found real world examples, not any programmed or in engine versions. Is there a tutorial about how to do something like this? Im not really worried whether it is forward or deferred rendering since im doing this for an art project and having more control over the lights shape is a higher priority to me.

Share this post


Link to post
Share on other sites

The projected light texture that Hodgman is talking about gives you similar, and probably way more control over the shape of the emission but is not the same as geometry clipping light shape. You would then be controlling the light shape with a texture instead of geometry. It works like a lot like a decal.

There's two main ways to apply lights in a deferred renderer -- either by screen-space quads that cover the screen-space area of the light, or by 3D geometry that covers the volume of the light. Any deferred rendering tutorial that uses the latter technique will teach you how to apply light only to areas inside a meshes volume using the stencil buffer. You can use any aribtray, closed mesh to apply the lighting if you wanted to.
No matter which lighting technique you're using (deferred with quads, deferred with volumes, forward...), you can also apply projected gobo texture as part of the same lighting effect.

Is there a tutorial about how to do something like this?

Googling "deferred rendering tutorial" and "projected texture tutorial" brings up a lot of hits.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!