Multiple projective textures with pixel lights?

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
JunkerKun
Posts: 97
Joined: Mon Jan 28, 2013 12:52 am

Multiple projective textures with pixel lights?

Post by JunkerKun »

How do they do it in, say, Source? I mean, would using projective textures and point lighting in one shader work?
How do I even do multiple projective textures for shadows? Like, do I render every object in one texture for every light? But then how do I combine them? Multi-pass?
mongoose7
Posts: 1227
Joined: Wed Apr 06, 2011 12:13 pm

Re: Multiple projective textures with pixel lights?

Post by mongoose7 »

You have to evaluate the light direction (from the object) and sample the texture. No, you don't texture the object with that texture.

Probably an advanced technique. Have you tried Phong shading with a shader. It might help if you've used some lighting techniques.
JunkerKun
Posts: 97
Joined: Mon Jan 28, 2013 12:52 am

Re: Multiple projective textures with pixel lights?

Post by JunkerKun »

mongoose7 wrote:You have to evaluate the light direction (from the object) and sample the texture. No, you don't texture the object with that texture.

Probably an advanced technique. Have you tried Phong shading with a shader. It might help if you've used some lighting techniques.
I do use Phong shading. What I want to do is projected shadows like ones in Source Engine. I just wonder how they render shadows from multiple light sources.
mongoose7
Posts: 1227
Joined: Wed Apr 06, 2011 12:13 pm

Re: Multiple projective textures with pixel lights?

Post by mongoose7 »

I know nothing about Source, but there are two ways to create shadows - stencil shadows and shadow maps. Irrlicht implements stencil shadows. Maybe give them a try and see if that is what you are looking for.
JunkerKun
Posts: 97
Joined: Mon Jan 28, 2013 12:52 am

Re: Multiple projective textures with pixel lights?

Post by JunkerKun »

mongoose7 wrote:I know nothing about Source, but there are two ways to create shadows - stencil shadows and shadow maps. Irrlicht implements stencil shadows. Maybe give them a try and see if that is what you are looking for.
Projective textureing is one of the part to make shadow mapping. The difference is we don't check for depth and just leave the shadow texture projected on geometry.
As I said the problem is not implementing shadows themselves. It's combining multiple of them and render in one or few passes.
mongoose7
Posts: 1227
Joined: Wed Apr 06, 2011 12:13 pm

Re: Multiple projective textures with pixel lights?

Post by mongoose7 »

Well you still need to do it in a shader. When you calculate the vector from the current pixel to the light source, you add the amount of light according to the projective texture. To do it for more than one light you need to enable blending and render the scene once for each light.

But no object will cast a shadow, so the effect will be similar to caustics. Everything will be dappled but nothing will have a shadow.
JunkerKun
Posts: 97
Joined: Mon Jan 28, 2013 12:52 am

Re: Multiple projective textures with pixel lights?

Post by JunkerKun »

I think you misunderstand me :V
I use projective textures not for lighting but for shadows: I use a render texture to render shadow textures.
If I render a scene multiple times with blending... wouldn't it really add color or would it redraw everything in the buffer?
christianclavet
Posts: 1638
Joined: Mon Apr 30, 2007 3:24 am
Location: Montreal, CANADA
Contact:

Re: Multiple projective textures with pixel lights?

Post by christianclavet »

This description remind me of the "blob" shadows that they use in Unity to project a circle texture on the ground at the feet of the characters. If the name is correct it's based on the projective texturing technique.

From your last post, you want to create a projective texture from a RTT (perhaps take a shot of the character from the top, and render it black for the RTT texture), then project it on the ground? It that it?

If your RTT is calculated one time the texture will be less realistic, but will gain a lot more speed than shadow maps, since your would only have to project this texture on the ground at each frame instead of rendering the geometry shadow.

I still think the projective texturing would need a shader to be applied to the ground material and a reference point for the projection for the shader (character position). Mongoose7 is right about the "light" aspect of this technique, it's like a projector.
JunkerKun
Posts: 97
Joined: Mon Jan 28, 2013 12:52 am

Re: Multiple projective textures with pixel lights?

Post by JunkerKun »

I already implemented projective texturing. I just want to know how to draw more than one projecive texture :V
christianclavet
Posts: 1638
Joined: Mon Apr 30, 2007 3:24 am
Location: Montreal, CANADA
Contact:

Re: Multiple projective textures with pixel lights?

Post by christianclavet »

I think you would need more render passes. 1 pass for each projector (Unless you program your shader to draw more than 1 source).

If you need maximum performance and don't have much sources, you could use multiples shaders.

Shader 1 that handle one source.
Shader 2 that handle 2 sources
Shader 3... etc.

Then you would change the shader when you change the number of projectors on your scene. If you have tons of source, then this could still apply but you would be forced to use render passes. (Ex: 9 sources, would do 3 passes with the shader that handle 3 projectors). But at that point, should be simpler to use 1 projection per pass, I don't think you would gain that much.
JunkerKun
Posts: 97
Joined: Mon Jan 28, 2013 12:52 am

Re: Multiple projective textures with pixel lights?

Post by JunkerKun »

Okay, thanks.
Post Reply