Textured Light (l4d2 style)

Anything and everything that's related to OGRE or the wider graphics field that doesn't fit into the other forums.
Post Reply
white_waluigi
Goblin
Posts: 253
Joined: Sat Sep 28, 2013 3:46 pm
x 10

Textured Light (l4d2 style)

Post by white_waluigi »

Is there a way to create a textured spotlight in Ogre like in L4d2? So that you can make the light look like an actual flashlight? Normal lights just seam to prefect and are therefore a bit unatural.

(you have to look close to see that it is actaully textured)
Image

(I know that this Picture is a modded Flashlight, but im sure it explains the Problem better)
Image
User avatar
Zonder
Ogre Magi
Posts: 1168
Joined: Mon Aug 04, 2008 7:51 pm
Location: Manchester - England
x 73

Re: Textured Light (l4d2 style)

Post by Zonder »

Search decal
There are 10 types of people in the world: Those who understand binary, and those who don't...
white_waluigi
Goblin
Posts: 253
Joined: Sat Sep 28, 2013 3:46 pm
x 10

Re: Textured Light (l4d2 style)

Post by white_waluigi »

The Flashlight should still throw shadows,react to materials correctly, etc.. i'm not sure if a decal is capable of doing that.
User avatar
Xavyiy
OGRE Expert User
OGRE Expert User
Posts: 847
Joined: Tue Apr 12, 2005 2:35 pm
Location: Albacete - Spain
x 87

Re: Textured Light (l4d2 style)

Post by Xavyiy »

A deferred spotlight would work like a charm. Otherwise, using forward rendering, you will have to adapt all your materials in order to correctly handle this textured spotlight.
white_waluigi
Goblin
Posts: 253
Joined: Sat Sep 28, 2013 3:46 pm
x 10

Re: Textured Light (l4d2 style)

Post by white_waluigi »

K ill try it out, thx.
But i suppose this means there is no build in function for textured light?
Last edited by white_waluigi on Wed Nov 20, 2013 3:28 pm, edited 1 time in total.
User avatar
Xavyiy
OGRE Expert User
OGRE Expert User
Posts: 847
Joined: Tue Apr 12, 2005 2:35 pm
Location: Albacete - Spain
x 87

Re: Textured Light (l4d2 style)

Post by Xavyiy »

Btw, I remember that Ogre3D used to automatically handle textures in spotlight's shadows, I assume that "rendering" the light with extra passes (modulative shadows). Although this is not physically correct, might work for you. Have a look to the wiki / API / showcase demos, I'm sure it has been showcased before.

If you want to look at some code, have a look to OgreSceneManager.cpp -> renderModulativeTextureShadowedQueueGroupObjects. If I remember correctly, this hardcoded texture thing was there.
white_waluigi
Goblin
Posts: 253
Joined: Sat Sep 28, 2013 3:46 pm
x 10

Re: Textured Light (l4d2 style)

Post by white_waluigi »

ok, ill have a look at it, thx.
User avatar
Xavyiy
OGRE Expert User
OGRE Expert User
Posts: 847
Joined: Tue Apr 12, 2005 2:35 pm
Location: Albacete - Spain
x 87

Re: Textured Light (l4d2 style)

Post by Xavyiy »

There is built-in support, but as far as I can see in OgreSceneManager.cpp, the texture to be used is hardcoded:

Code: Select all

targetPass->getTextureUnitState(1)->getTextureName() == "spot_shadow_fade.png"
...
 TextureUnitState* t = 
                        targetPass->createTextureUnitState("spot_shadow_fade.png");
                    t->setProjectiveTexturing(!targetPass->hasVertexProgram(), cam);
This *shit* really needs to be rewritten... we will see in Ogre 2.X ;)

But, with minor changes there, you will be able to use whatever texture you want.
white_waluigi
Goblin
Posts: 253
Joined: Sat Sep 28, 2013 3:46 pm
x 10

Re: Textured Light (l4d2 style)

Post by white_waluigi »

Yeah i hope that this is implemented soon. It seams a little bit gimicky but with a little bit of fantasy im sure you could realise some realy fun stuff.
I hope i can find a way to replace the png, but it seams to be hardcoded for whatever reason.
Thx.
User avatar
spacegaier
OGRE Team Member
OGRE Team Member
Posts: 4304
Joined: Mon Feb 04, 2008 2:02 pm
Location: Germany
x 135
Contact:

Re: Textured Light (l4d2 style)

Post by spacegaier »

Xavyiy wrote:This *shit* really needs to be rewritten... we will see in Ogre 2.X ;)
As usual: Please create a short JIRA ticket for it, otherwise it might get lost!
Ogre Admin [Admin, Dev, PR, Finance, Wiki, etc.] | BasicOgreFramework | AdvancedOgreFramework
Don't know what to do in your spare time? Help the Ogre wiki grow! Or squash a bug...
User avatar
Xavyiy
OGRE Expert User
OGRE Expert User
Posts: 847
Joined: Tue Apr 12, 2005 2:35 pm
Location: Albacete - Spain
x 87

Re: Textured Light (l4d2 style)

Post by Xavyiy »

al2950
OGRE Expert User
OGRE Expert User
Posts: 1227
Joined: Thu Dec 11, 2008 7:56 pm
Location: Bristol, UK
x 157

Re: Textured Light (l4d2 style)

Post by al2950 »

Just in case this is any help, someone tried to do this or something similar not too long ago;
http://www.ogre3d.org/forums/viewtopic.php?f=4&t=67475
Post Reply