Archived

This topic is now archived and is closed to further replies.

Lightmapping and dynamic lights?

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

Hi i am just wondering how would you go about rendering dynamic lights with lightmapped scenes? imagine the situation where you light a polygon that casts a shadow from a occluder and then gets lid by a point light also how do you sort your scenes? in my current project it attempt to sort the polygons by the first texture unit and apply a lightmap that holds all the lightmaps of the polygons of a certain texture to render the scene i do this pass through the octree and create a linked lists of all the faces to render and then while(texturelist) texturelist->render lightmapped polys texturelist->render non lightmapped polys next texturelist as you see everything is precompiled but dynamic lights somehow don t fit into this design so i need to do it another way any ideas on how to do that to get decent results at decent speed ? thx

Share this post


Link to post
Share on other sites
I guess that you''re not using any comprex pre-processing GI lights given your description (i.e. ray tracing/radiosity), so what I say is probably valid...

Anyway, You are far best generating a hybrid system - whereby static lights are lightmapped, and animated/moving lights are dynamically generated.

Depending on the accuracy you wish, I''ve seen some convincing demo''s whereby a ''difference delta'' is employed for static-LM generation - when the light has moved by x amount the lightmap is updated (best done using time-slicing). This way you can scale the ''x'' value - on low end systems have a near-1/2 second delta but on high end systems you can get a near 1 in 4 frame update (or whatever). Either way, it''ll still look reasonably accurate and scalable across a wide range of distributions.

hth
Jack

Share this post


Link to post
Share on other sites
you may use spherical harmonics lighting if you want a radiosity real time lighting with dynamic lights.It can handle light interreflections, color bleeding, soft shadows and area light sources.the problem with it is that it cannot handle dynamic geometry.

Share this post


Link to post
Share on other sites
Just of note, they''re doing a spherical harmonics online course at GameVersity -

http://www.gameinstitute.com/courses.php?action=display&courseid=34

(also in Gamedev.net news)

plus Robin Green has a good paper on it
(http://www.research.scea.com/gdc2003/spherical-harmonic-lighting.html)

If that''s of interest?

Share this post


Link to post
Share on other sites
Just of note, they''re doing a spherical harmonics online course at GameVersity -

http://www.gameinstitute.com/courses.php?action=display&courseid=34

(also in Gamedev.net news)

plus Robin Green has a good paper on it
(http://www.research.scea.com/gdc2003/spherical-harmonic-lighting.html)

If that''s of interest?

Share this post


Link to post
Share on other sites
quote:
Original post by jollyjeffers
I guess that you''re not using any comprex pre-processing GI lights given your description (i.e. ray tracing/radiosity), so what I say is probably valid...

Anyway, You are far best generating a hybrid system - whereby static lights are lightmapped, and animated/moving lights are dynamically generated.

Depending on the accuracy you wish, I''ve seen some convincing demo''s whereby a ''difference delta'' is employed for static-LM generation - when the light has moved by x amount the lightmap is updated (best done using time-slicing). This way you can scale the ''x'' value - on low end systems have a near-1/2 second delta but on high end systems you can get a near 1 in 4 frame update (or whatever). Either way, it''ll still look reasonably accurate and scalable across a wide range of distributions.

hth
Jack




hm well that s really expensive

another way could be

rendering the scene
with vertex arrays /VBOs by the system i described about

and then collect the lid polygons and draw them with GL_REPLACE
and apply a shader that merges the lightmap with a lightmap of the dynamic spotlight

or add a 3rd layer for lightmaps of lights and change the shader and tex environment states to redraw the lid polygons

Pros:
- minimum function call overhead
- nice and reallooking lights
Cons:
- several texture bounds


the questions is how expensiv is this kind of lightning then

Share this post


Link to post
Share on other sites
quote:
Original post by mohamed adel
you may use spherical harmonics lighting if you want a radiosity real time lighting with dynamic lights.


No, you can''t. SH lighting doesn''t handle moving lights. If has (limited) support for light/shadow rotation (which tuns out to be pretty useless in practice, expect for outdoor lighting). SH lighting doesn''t cope very well with local point light sources either (bad quality compared to lightmapped GI), even when they are static.

SH lighting is just a replacement for lightmaps, with some limited interactivity features at the expense of quality.

Better try an approach like this:

# Store an ambient GI solution in lightmaps, but without direct light component (only reflected, indirect light).

# Use pixel shading magic to add dynamic first order diffuse and specular components.

YannL once talked about encoding the wavelength dependent light incidence direction into a compressed texture map along with radiosity lighting, and somehow reintegrating the thing in a pixelshader (enabling similar dynamic features SH lighting offers, but with much better quality, he posted some cool screenshots). But I can''t remember the details.

Share this post


Link to post
Share on other sites
one of the most important properties of spherical harmonics functions is that it is rotationally invariant,which means in few words that it can be rotated with no problem at all. see the spherical harmonics samples of the Directx sdk and you will find that the light source could be rotated.
and when using with point lihgt source,it give a very good lighting ( a point light is a spherical light source with very small radius). see the samples of the sdk and you will find them excellent compared to old rendering methods and they have a very high performance.

Share this post


Link to post
Share on other sites