Shadowmap transparency for multiple objects

Started by
13 comments, last by ankhd 10 years, 2 months ago

Shadow map creation is not a post process shader, so that question doesn't make sense.

Then thats why I'm having difficulty, because my shadowmap is created as a post process shader. My shadowmap RTT is declared inside my post process shader and that shader then processes each vertex in the scene. But it sounds like this is wrong and I need to declare the RTT in my program and pass it to every object shader to get updated, then pass the final shadowmap texture to the post process shader. Is that the way it's meant to work?

Advertisement

Then thats why I'm having difficulty, because my shadowmap is created as a post process shader.

No, it’s not. Because that defies the laws of physics. Why do you think you are having so much trouble? Your approach to a very simple problem is so flawed it is literally impossible. By definition, your approach requires an infinite amount of texture units, yet you only have 32 or 64 or so.

That’s the whole reason you started this topic. Because of your misunderstanding you took an impossible approach to the problem. Since you couldn’t figure it out you posted asking how to do it.

The only answer is: Stop trying to put the square peg into the circular hole.


I am not going to repeat my answer. Your line of thinking is so wrong it confused so many people no one even knew how to reply until you posted with a few more details.
Reread my answer until it makes sense. Do not stop rereading as long as you believe your current path makes any form of sense in this universe.


L. Spiro

I restore Nintendo 64 video-game OST’s into HD! https://www.youtube.com/channel/UCCtX_wedtZ5BoyQBXEhnVZw/playlists?view=1&sort=lad&flow=grid


my shadowmap is created as a post process shader

You mean it's a render target you render to after you've rendered the scene from the main camera's perspective? Because that would be true. If you're doing forward rendering you would need to have the shadow map ready when you're rendering and lighting the scene, but in a deferred setup you could do it afterwards (before applying lighting).

1. Render the scene with colors and all to render target 1 (or MRTs). For models with alpha textures, bind those textures and discard accordingly.

2. Render scene's depth from a light's perspective into render target 2 (shadow map). For models with alpha textures, bind and discard.

3. Apply lighting based on data in g-buffers + shadow map.

Forward rendering: first do step 2, then 1 and 3 combined.

Each mesh gets drawn to the shadow map one at a time. This is the same shadow map. With your tree mesh you want only your leaf and not the quad. So the bit of code you use for your leaf rendering needs to be in your draw to shadow shader.

Hello Im home now this is what I do im my shadow fx file

void PS(VS_OUT pIn)
{
float4 diffuse = gDiffuseMap.Sample( gTriLinearSam, pIn.texC );

// Don't write transparent pixels to the shadow map.
clip(diffuse.a - 0.15f);
}

This topic is closed to new replies.

Advertisement