Entity::setCastShadow(false) doesn´t work

Problems building or running the engine, queries about how to use features etc.
User avatar
xadhoom
Minaton
Posts: 973
Joined: Fri Dec 28, 2007 4:35 pm
Location: Germany
x 1

Entity::setCastShadow(false) doesn´t work

Post by xadhoom »

Hi!

I use the soft shadow implementation of Nullsquared and I have a problem with
deactivating shadowing of an entity. By setting castShadow to false I can see
the shadow of this entity (which is attached to a bone) anyhow.

Did I miss something I have to consider?

Thx
User avatar
nullsquared
Old One
Posts: 3245
Joined: Tue Apr 24, 2007 8:23 pm
Location: NY, NY, USA
x 11

Post by nullsquared »

Hm. That's odd :|.

Technically, the shadow map needs both casters and receivers in this case. But, Ogre treats receivers as those who don't cast shadows, and casters as those who cast shadows, but don't receive shadows. When you call SceneManager::setShadowTextureSelfShadow(true), then Ogre will ignore what it thinks and render both casters *and* receivers into the shadow map. So, maybe, that's why your entity is still casting shadows (it's in the shadow map), even though it shouldn't.

This would be easily solvable using Shoggoth's in-place shadow_caster_material directives, but I'm personally using Eihort, so I can't write up an example of how to solve it using shadow_caster_material.
User avatar
xadhoom
Minaton
Posts: 973
Joined: Fri Dec 28, 2007 4:35 pm
Location: Germany
x 1

Post by xadhoom »

Thank you for the answer. Yes you are right. I call SceneManager::setShadowTextureSelfShadow(true). This could be the answer...

I really look forward to see Shoggoth soon. Especially the flexible Material inheritance concepts would be the update worth!

:D
User avatar
xadhoom
Minaton
Posts: 973
Joined: Fri Dec 28, 2007 4:35 pm
Location: Germany
x 1

Post by xadhoom »

Ok, I solved my problem by using the shadow_caster_material as sugggested and it works.
Here is an example of how I did it:

Code: Select all

material no_shadow
{
	technique
	{
		pass
		{
			alpha_rejection greater_equal 128
			diffuse 0 0 0 0
		}
	}
}

material testMaterialWithoutShadows
{
	technique
	{
		shadow_caster_material no_shadow
		pass
		{
			// the shader code
		}
	}
}
Cheers!