Horde3D

Next-Generation Graphics Engine
It is currently 19.05.2024, 00:11

All times are UTC + 1 hour




Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: textured lights
PostPosted: 01.09.2010, 13:48 
Offline

Joined: 11.08.2010, 12:58
Posts: 3
Is there a way to project a texture from a light as a light gobo.I understand I would need to create a custom light shader and modify calcPhongSpotLight in fragLighting.glsl. how would I go about generating the uv coordinates needed for the texture2D lookup (is the shadowMats useful here or only in dealing with shadow maps.
otherwise it would appear that using just the lightDir and the pos won't be enough determine the uv coordinates

Im a bit of beginner still at horde and dealing with shading so Im a little rusty on some of the matrix maths surrounding what need to be done


Top
 Profile  
Reply with quote  
 Post subject: Re: textured lights
PostPosted: 02.09.2010, 00:12 
Offline
Engine Developer

Joined: 10.09.2006, 15:52
Posts: 1217
The easiest thing you can do is using a cube map as your projective texture which you just sample using the light vector as input. You can even apply an old trick from UE3 and use two cube maps between which you lerp based on distance. This can fake some nice soft shadows.


Top
 Profile  
Reply with quote  
 Post subject: Re: textured lights
PostPosted: 02.09.2010, 04:16 
Offline

Joined: 11.08.2010, 12:58
Posts: 3
Thats an interesting one I hadn't considered using cubemaps. Do I have a way of orientating the light vector or am I limited to using the cubemap in world space?


Top
 Profile  
Reply with quote  
 Post subject: Re: textured lights
PostPosted: 02.09.2010, 06:18 
Offline

Joined: 15.02.2009, 02:13
Posts: 161
Location: Sydney Australia
marciano: yeah I remember that:

http://www.youtube.com/watch?v=Plnh28ykavQ

About 1:12 into the video is the cube map shadow example.

_________________
-Alex
Website


Top
 Profile  
Reply with quote  
 Post subject: Re: textured lights
PostPosted: 02.09.2010, 18:25 
Offline

Joined: 17.01.2010, 13:30
Posts: 7
Yes, marciano is right - it very easy way to render them to use cubemaps. You can try to search phoenix64 modifications of Horde engine in University of Augsburg SVN of Horde3D - he implemented cubemap shadows - you can try this method but using textured projection the same way like shadow. But I dont have nothing in my head how to make textured spot lights. May be you can try the same method as shadow mapping like with cubemap technique.
Yeah, cubemaps are good, but rendering each face independently not good... Sometimes it may become not nice bottleneck. It would be better to try Virtual Depth Shadow Textures technique, but I don't know how good it would be to use with textured lights... It is a nice try to inspect how it works with VSDT technique.
Sometimes I hate this advice, but... Another technique is for DX10 and higher hardware - to use Geometry Shaders and Instancing. Render all cubemap faces with Geometry Shader with one draw call, and Instancing when there are a lot of cubemaps(draw all of them one draw call).

Update:
Branch SVN is here and phoenix64 experiments also here: http://mm-werkstatt.informatik.uni-augs ... /branches/


Top
 Profile  
Reply with quote  
 Post subject: Re: textured lights
PostPosted: 02.09.2010, 20:41 
Offline

Joined: 15.06.2008, 11:21
Posts: 166
Location: Germany
Wait... someone actually still knows that code?

Don't expect anything good in there. Well, textured spot lights actually shouldn't be difficult either, the same principles still apply, only you use a different projection matrix for texture coords of your light texture.


Top
 Profile  
Reply with quote  
 Post subject: Re: textured lights
PostPosted: 03.09.2010, 04:58 
Offline

Joined: 15.02.2009, 02:13
Posts: 161
Location: Sydney Australia
ZONER wrote:
Yes, marciano is right - it very easy way to render them to use cubemaps. You can try to search phoenix64 modifications of Horde engine in University of Augsburg SVN of Horde3D - he implemented cubemap shadows - you can try this method but using textured projection the same way like shadow. But I dont have nothing in my head how to make textured spot lights. May be you can try the same method as shadow mapping like with cubemap technique.
Yeah, cubemaps are good, but rendering each face independently not good... Sometimes it may become not nice bottleneck. It would be better to try Virtual Depth Shadow Textures technique, but I don't know how good it would be to use with textured lights... It is a nice try to inspect how it works with VSDT technique.
Sometimes I hate this advice, but... Another technique is for DX10 and higher hardware - to use Geometry Shaders and Instancing. Render all cubemap faces with Geometry Shader with one draw call, and Instancing when there are a lot of cubemaps(draw all of them one draw call).

Update:
Branch SVN is here and phoenix64 experiments also here: http://mm-werkstatt.informatik.uni-augs ... /branches/


Dual-paraboloid shadow mapping is what you're after if 6 draw passes to 6 different sides of a cube is a bit too hardcore and you don't have access to geometry shaders. This will bring the passes down to 2. And if this is too much and you don't mind major artefacts, there's this technique to bring it down to 1 pass:

http://www.gamedev.net/community/forums ... _id=517022

Edit: actually the "minor" artefacts are quite major... :)

_________________
-Alex
Website


Top
 Profile  
Reply with quote  
 Post subject: Re: textured lights
PostPosted: 03.09.2010, 16:59 
Offline

Joined: 17.01.2010, 13:30
Posts: 7
MistaED, I don't know exactly about Dual-paraboloid shadow mapping technique, I heard only that it works only with Forward Rendering. Techniques says "NO!" to Deferred Shading(info from Shiskovtsov 2005 - GPU Gems 2 - Deferred Shading on S.T.A.L.K.E.R.) I am Deferred Shading-man :D But thanks for the link to this good topic on gamedev!


Top
 Profile  
Reply with quote  
 Post subject: Re: textured lights
PostPosted: 07.09.2010, 14:04 
Offline

Joined: 11.08.2010, 12:58
Posts: 3
I think this is might be a method to get textured lights without a cubemap (slide 13) but requires the view matrix and projection matrix of the light in order to use texture2DProj.

http://www.csee.wvu.edu/~tmcgraw/cs570s ... ture12.pdf


Top
 Profile  
Reply with quote  
 Post subject: Re: textured lights
PostPosted: 07.09.2010, 15:32 
Offline

Joined: 22.11.2007, 17:05
Posts: 707
Location: Boston, MA
ZONER wrote:
MistaED, I don't know exactly about Dual-paraboloid shadow mapping technique, I heard only that it works only with Forward Rendering. Techniques says "NO!" to Deferred Shading(info from Shiskovtsov 2005 - GPU Gems 2 - Deferred Shading on S.T.A.L.K.E.R.) I am Deferred Shading-man :D
The stalker guys said that quite a while ago, and things have changed a bit since then.

In particular, they were worried about artefacts arising from the post-vertex transform linear-space interpolation (which is incorrect in a paraboloid space). You can solves this by correcting for it in the pixel shader, see here http://osman.brian.googlepages.com/dpsm.pdf

_________________
Tristam MacDonald - [swiftcoding]


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group