ETM + dynamic lightning => bad shadows for objects :S

Oceax

09-11-2008 17:20:38

Im using SongOfTheWeave´s method for dynamic lightning and the terrain looks good but not the shadows from movable objects. Shadow Technique is "SHADOWTYPE_TEXTURE_MODULATIVE", Light source is Cealums sun, a directional light.

http://www.oceax.eu/cube_shadows.jpg

Looks ok like this in certain camera angles... but the shadow still flickers.
http://www.oceax.eu/cube_shadows2.jpg

Im using these Addon libs in my project:
ETM
Caelum
PhysX

Anyone using similar project setup and got good looking shadows?

emre2345

10-11-2008 21:18:23

It can be depth-fighting. Can you post your material file?

Oceax

10-11-2008 23:05:15


material ETTerrainMaterial_512
{
technique
{
pass Ambient
{
vertex_program_ref ETAmbient_VS
{
}
}

pass Lighting
{
scene_blend add
iteration once_per_light

vertex_program_ref ET/Programs/VSDynLightingNM
{
}

fragment_program_ref ET/Programs/PSDynLightingNM
{
param_named splatScaleX float 128
param_named splatScaleZ float 128
}

texture_unit
{
// first coverage map, dynamically managed
texture ETSplatting0
}
texture_unit
{
// second coverage map, dynamically managed
texture ETSplatting1
}

texture_unit
{
texture splatting0_norm.png
}
texture_unit
{
texture splatting1_norm.png
}
texture_unit
{
texture splatting2_norm.png
}
texture_unit
{
texture splatting3_norm.png
}
texture_unit
{
texture splatting4_norm.png
}
texture_unit
{
texture splatting5_norm.png
}


}

// primary splatting technique, requires PS 2.0
pass Splatting
{


scene_blend modulate

vertex_program_ref ET/Programs/VSLodMorph2
{
}

fragment_program_ref ET/Programs/PSSplat2
{
param_named splatScaleX float 128
param_named splatScaleZ float 128
}


texture_unit
{
// first coverage map, dynamically managed
texture ETSplatting0
}
texture_unit
{
// second coverage map, dynamically managed
texture ETSplatting1
}

// splatting textures
texture_unit
{
texture splatting0.png
}
texture_unit
{
texture splatting1.png
}
texture_unit
{
texture splatting2.png
}
texture_unit
{
texture splatting3.png
}
texture_unit
{
texture splatting4.png
}
texture_unit
{
texture splatting5.png
}

}
}
}

CABAListic

11-11-2008 08:04:37

You must write a custom shadow receiver technique for the terrain which takes LOD morphing into account. As you can see from the screenshot, the shadows are rendered on a different geometry than the rest of your passes because they know nothing about LOD. That's what causes the holes in the shadows.
You could also disable LOD morphing or set the number of LOD levels to 1 for a quick test. That should fix the problem.

MisterMayhem

21-06-2009 19:59:31

Sorry to bump an old thread, but could anyone provide some more details on how to "write a custom shadow receiver technique for the terrain which takes LOD morphing into account". I'm searching in circles trying to figure it out. I tried a few things, like shadow_caster_vertex_program_ref using ET/Programs/VSLodMorph2, and even a texture_unit with content_type shadow, but I clearly don't know what I'm doing.

Even if assuming we start with the example ETM material, it would be very helpful.

SongOfTheWeave

31-08-2009 21:04:14

Sorry to bump an old thread, but could anyone provide some more details on how to "write a custom shadow receiver technique for the terrain which takes LOD morphing into account". I'm searching in circles trying to figure it out. I tried a few things, like shadow_caster_vertex_program_ref using ET/Programs/VSLodMorph2, and even a texture_unit with content_type shadow, but I clearly don't know what I'm doing.

Even if assuming we start with the example ETM material, it would be very helpful.



Look at my thread that the OP referenced: viewtopic.php?f=16&t=7009

MisterMayhem

17-09-2009 23:28:08

Thanks for the reference, but could you be more specific? That topic has 5 pages full of many topics. I'm just not seeing the means to "write a custom shadow receiver technique for the terrain which takes LOD morphing into account". Maybe it's right in front of me, but I'm not seeing it. Thanks.

SongOfTheWeave

18-09-2009 10:21:07

Thanks for the reference, but could you be more specific? That topic has 5 pages full of many topics. I'm just not seeing the means to "write a custom shadow receiver technique for the terrain which takes LOD morphing into account". Maybe it's right in front of me, but I'm not seeing it. Thanks.

In the first post. It's step by step. As things changed I edited the original post, all the rest is just discussion. Any changes that resulted from the discussion appear in the first post now.

EDIT: OH! I'm sorry, that thread only has a dynamic lighting step by step! It's the foundation of what you want though, as it shows how to take LOD into account and how to do lighting. I haven't posted any of my shadow shaders or instructions for using/adapting them, but I created them from the dynamic lighting shaders that are posted.

I think I probably meant that you should look at that thread as a base for creating a shadowing technique in my last post.

For taking the LOD morphing into account look at the vertex programs in the aforementioned lighting thread.