no shadows on terrain

Arcanor

04-03-2008 17:30:05

I am creating my terrain based on a heightmap, and using Ogre's Terrain Scene Manager, using the following code:
// create the ground:
Ogre::Real maxHeight = 200;
mSceneMgr->setWorldGeometry("terrain.cfg");
NxOgre::ShapeParams sParams;
sParams.setToDefault();
sParams.mMeshScale = NxVec3(NxReal(2048.0f / 512.0f), 1, NxReal(2048.0f / 512.0f));
NxOgre::ActorParams aParams;
aParams.setToDefault();
aParams.mMass = 0;
aParams.mDensity = 0;
Ogre::Vector3 centerOffset = Ogre::Vector3(0, maxHeight / 2.0f, 0);

NxOgre::Actor* terr = mScene->createActor("terrain", new NxOgre::TerrainShape("HumanZone513x513.raw", maxHeight, sParams), NxOgre::Pose(Ogre::Vector3::ZERO, Ogre::Quaternion::IDENTITY), aParams);
terr->setGlobalPosition(centerOffset);

I'm also setting the shadow technique as follows:
mSceneMgr->setShadowTechnique(Ogre::SHADOWTYPE_TEXTURE_ADDITIVE);

The terrain seems to be working fine in terms of size/scale, etc. However, I'm not seeing any shadows on my terrain at all.

I believe that I need to turn shadow casting on the terrain itself by doing Ogre::Entity::setCastShadows(true), however I can't do this to my terrain actor as there is no Entity associated with it (it's created with a TerrainShape blueprint instead of a mesh file).

I thought about possibly creating my own Ogre::Entity and passing it into NxOgre's createBody() function, but since I'm using a blueprint I can't pass in a mesh filename and I'm not sure how to make the entity, or if that's even really needed.

How can I get shadows to work on a terrain created with a TerrainShape blueprint?

betajaen

04-03-2008 17:33:05

This is an Ogre question.

NxOgre doesn't create the visualization of terrain in Ogre - you do.