Issues with shadows and 1.8 on iOS

Discussion of issues specific to mobile platforms such as iOS, Android, Symbian and Meego.
Carlyone
Kobold
Posts: 38
Joined: Thu Jul 05, 2012 3:51 pm
x 4

Issues with shadows and 1.8 on iOS

Post by Carlyone »

Hello,

I posted recently about receiving the 'isAttributeValid' bad access in my application.
http://www.ogre3d.org/forums/viewtopic.php?f=21&t=70835

In this post I solved the issue by declaring the rtshader section in the materials file. I've also found that calling the validate material method when doing on the fly dae/3ds/stl etc conversion stops most problems with the shading.

Now I'm trying to get shadows working, initially any shadow technique will do, and for simplicity I'm just using SHADOWTYPE_TEXTURE_MODULATIVE but having the shadows on causes the isAttributeValid error. I've tried getting that texture and validating it against the shader generator but that still doesn't fix it.

I put some outputs in the handleSchemeNotFound method for the RTShader system and the Ogre/TextureShadowCaster leaves that method with a NULL technique.

I'm not sure if this is the cause or if it is something else. Any help would be appreciated.
User avatar
masterfalcon
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 4270
Joined: Sun Feb 25, 2007 4:56 am
Location: Bloomington, MN
x 126

Re: Issues with shadows and 1.8 on iOS

Post by masterfalcon »

From the sounds of it you need to define shadow caster and receiver programs.
Carlyone
Kobold
Posts: 38
Joined: Thu Jul 05, 2012 3:51 pm
x 4

Re: Issues with shadows and 1.8 on iOS

Post by Carlyone »

Hello,
Thanks for the response, I took your advice and went and found some shadow caster and receiver programs.

After looking at the sample 'Shadows' in ogre I am using the following code:

Code: Select all

sceneManager->setShadowTechnique(Ogre::SHADOWTYPE_TEXTURE_MODULATIVE);
     sceneManager->setShadowTextureSettings(512, 2);
    sceneManager->setShadowColour(ColourValue(0.5, 0.5, 0.5));
    sceneManager->setShadowTexturePixelFormat(PF_FLOAT16_R);
    sceneManager->setShadowTextureCasterMaterial("Ogre/DepthShadowmap/Caster/Float");
    sceneManager->setShadowTextureReceiverMaterial("Ogre/DepthShadowmap/Receiver/Float");
    sceneManager->setShadowTextureSelfShadow(true);
I also tried

Code: Select all

sceneManager->setShadowTexturePixelFormat(PF_X8R8G8B8);
    sceneManager->setShadowTextureCasterMaterial(StringUtil::BLANK);
    sceneManager->setShadowTextureReceiverMaterial(StringUtil::BLANK);
    sceneManager->setShadowTextureSelfShadow(false);
It doesn't crash anymore but the screen is just black. If i set the setCastShadows(false) on the lights then everything displays, except the shadows.

Not really sure where I am going wrong, I also still get material errors when not setting the below on every material

Code: Select all

rtshader_system
 			{	 	
 				// Override lighting stage with per pixel lighting. 			
 				lighting_stage per_pixel				
 			}
or validating every material in a model.

Starting to think my setup of Ogre is wrong as other people seem to have Ogre running on iOS devices with OpenGLES2 with no problems.

As you can guess I'm pretty new to Ogre and 3D programming, my background is mainly web based applications/frameworks, so any further advice and help would be greatly appreciated.
oiram
Halfling
Posts: 87
Joined: Sun Dec 13, 2009 5:06 am
x 6

Re: Issues with shadows and 1.8 on iOS

Post by oiram »

1. set texture filtering trilinear for default filtering.
2. texture_unit shadowMap
{
content_type shadow
filtering binear
}

just try this~
Carlyone
Kobold
Posts: 38
Joined: Thu Jul 05, 2012 3:51 pm
x 4

Re: Issues with shadows and 1.8 on iOS

Post by Carlyone »

Hi Oiram,
Thanks for the response, I put in your suggestions in my test harness and the screen isn't black, which is nice and the shadows look decent, many thanks.

I think I've found the main cause of the isAttributeValid() error I've been having for a couple of months now. It was due to the fact I didn't have the OgreDemo class (or equivalent, the one that starts the ogre framework) in an Objective C class and also that the OgreDemo class should just be "OgreDemo demo" and not "OgreDemo* demo".

Seems that the screen is still black in my main application, but pretty certain I've missed something so will go through and find the difference.

Thanks for all the help on this

Carl
oiram
Halfling
Posts: 87
Joined: Sun Dec 13, 2009 5:06 am
x 6

Re: Issues with shadows and 1.8 on iOS

Post by oiram »

textures with filtering trilinear setting it's must be generated mipmaps texture.
shadow map has only 1 mipmap so filtering must set binear.
this issue only caused on ogl es2.