Shadows starting away from mesh intersections, video

Discussion area about developing with Ogre2 branches (2.1, 2.2 and beyond)
Post Reply
Nickak2003
Gremlin
Posts: 194
Joined: Thu Jun 10, 2004 4:19 am
x 11
Contact:

Shadows starting away from mesh intersections, video

Post by Nickak2003 »

Shadows are appearing after a distance from mesh intersections instead of right away, shadow constant bias seems to have no major effect. This happens with the directional light.


Here is the shadow code which is inside the terra compositor, which is the default stuff + some static stuff which isn't being used for the directional light.

Code: Select all

compositor_node_shadow Tutorial_TerrainShadowNode
{
	technique pssm

	texture atlas 3072 2048 PFG_D32_FLOAT
	texture atlasStatic	4096 8192 PFG_D32_FLOAT
	texture tmpCubemap	1024 1024 PFG_R32_FLOAT cubemap depth_format PFG_D32_FLOAT



	num_splits		3
	pssm_lambda		0.95
	shadow_map 0 atlas uv 0.000000000000000 0.0 0.666666666666667 1.0 light 0 split 0
	shadow_map 1 atlas uv 0.666666666666667 0.0 0.333333333333333 0.5 light 0 split 1
	shadow_map 2 atlas uv 0.666666666666667 0.5 0.333333333333333 0.5 light 0 split 2

	technique focused
	shadow_map 3 atlasStatic uv 0.0 0.0 1.0 0.5 light 1
	shadow_map 4 atlasStatic uv 0.0 0.5 1.0 0.5 light 2


	target atlas
	{
		pass clear
		{
			colour_value 1 1 1 1
		}
	}

	shadow_map_target_type directional
	{
		shadow_map 0 1 2
		{
			pass render_scene
			{
			}
		}
	}

	//Clear the static atlas first. Do this inside a shadow_map_target_type block so that it only
	//gets executed if shadow_map 3 is flagged as dirty (instead of clearing every frame).
	shadow_map_target_type directional spot point
	{
		shadow_map 3
		{
			pass clear
			{
				clear_colour_reverse_depth_aware	1 1 1 1
				shadow_map_full_viewport yes
			}
		}
	}

	shadow_map_target_type point
	{
		shadow_map_repeat 3 4
		{
			target tmpCubemap +X : cubemap_target_shadow {}
			target tmpCubemap -X : cubemap_target_shadow {}
			target tmpCubemap +Y : cubemap_target_shadow {}
			target tmpCubemap -Y : cubemap_target_shadow {}
			target tmpCubemap +Z : cubemap_target_shadow {}
			target tmpCubemap -Z : cubemap_target_shadow {}

			shadow_map
			{
				pass render_quad
				{
					material Ogre/DPSM/CubeToDpsm
					input 0 tmpCubemap
				}
			}
		}
	}

	shadow_map_target_type directional spot
	{
		shadow_map 3 4
		{
			pass render_scene
			{
			}
		}
	}

}

Lax
Orc
Posts: 482
Joined: Mon Aug 06, 2007 12:53 pm
Location: Saarland, Germany
x 30

Re: Shadows starting away from mesh intersections, video

Post by Lax »

Hi Nickak2003,

checkout those topic:

viewtopic.php?f=25&t=95723
Adjust your shadows via mShadowConstantBias

Best Regards
Lax
Image
http://www.lukas-kalinowski.com/Homepage/?page_id=1631
Please support Second Earth Technic Base built of Lego bricks for Lego ideas: https://ideas.lego.com/projects/81b9bd1 ... b97b79be62
Image

Nickak2003
Gremlin
Posts: 194
Joined: Thu Jun 10, 2004 4:19 am
x 11
Contact:

Re: Shadows starting away from mesh intersections, video

Post by Nickak2003 »

From what I can tell, modifying shadowbias in real time, it seems to affect acne to some extent, but it has basically no effect on the outline. I think that argo may be correct in saying that it could be broken, but I wouldn't know.

Nickak2003
Gremlin
Posts: 194
Joined: Thu Jun 10, 2004 4:19 am
x 11
Contact:

Re: Shadows starting away from mesh intersections, video

Post by Nickak2003 »

OK, I got the lines to go away. I had to do this setting:

Code: Select all

root->getHlmsManager()->setShadowMappingUseBackFaces(false);
For the rocks, I then set the shadowConstantBias to -19 and it seems to be mostly acne free.

User avatar
SolarPortal
OGRE Contributor
OGRE Contributor
Posts: 203
Joined: Sat Jul 16, 2011 8:29 pm
Location: UK
x 50
Contact:

Re: Shadows starting away from mesh intersections, video

Post by SolarPortal »

This topic might interest you
viewtopic.php?f=25&t=95836
Lead developer of the Skyline Game Engine: https://aurasoft-skyline.co.uk

Post Reply