Simplest settings for Ogre Terrain?

Problems building or running the engine, queries about how to use features etc.
Post Reply
User avatar
petrocket
Gremlin
Posts: 178
Joined: Tue Mar 20, 2007 3:29 am
x 10
Contact:

Simplest settings for Ogre Terrain?

Post by petrocket »

Does anyone have ideas on using Ogre's terrain component on the simplest settings? I'm trying to run it on iOS but get 3fps (in the simulator).

My config is such:

Code: Select all

    mTerrainGlobals->setMaxPixelError(16);
    
    // size for lightmapped terrain
    mTerrainGlobals->setCompositeMapDistance(1000);
    
    mTerrainGlobals->setLightMapDirection(light->getDerivedDirection());
    mTerrainGlobals->setCompositeMapAmbient(sceneMgr->getAmbientLight());
    mTerrainGlobals->setCompositeMapDiffuse(light->getDiffuseColour());
    
    // Configure default import settings for if we use imported image
    Ogre::Terrain::ImportData& defaultimp = mTerrainGroup->getDefaultImportSettings();
    defaultimp.terrainSize = 33;
    defaultimp.worldSize = 12000.0f;
    defaultimp.inputScale = 600; // terrain.png is 8 bpp
    
    defaultimp.minBatchSize = 33;
    defaultimp.maxBatchSize = 33;
I also tried disabling light mapping but it doesn't seem to do anything:

Code: Select all

mTerrainGlobals->getDefaultMaterialGenerator()->setLightmapEnabled(false);
I'd like to make the terrain shader run with the simplest settings if possible - no normal mapping or anything, just diffuse.
Ogre API & Manual | Ogre Wiki

blog | website | work

Follow me on twitter @ twitter.com/petrocket
User avatar
c6burns
Beholder
Posts: 1512
Joined: Fri Feb 22, 2013 4:44 am
Location: Deep behind enemy lines
x 138

Re: Simplest settings for Ogre Terrain?

Post by c6burns »

In all likelihood you will want to make your own TerrainMaterialGenerator and take charge of GLES2 shader generation yourself. I went through this process trying to optimize for lower end android devices. The simplest generator would just reference a standard Ogre material, like this: http://www.ogre3d.org/forums/viewtopic.php?f=5&t=72455

Once you simplify the shaders, you may find you are also bottlenecking on the terrain updates, because you are handling too much terrain data. I had to scale down the amount of vertices I use to meet performance targets on some devices.

Anyway, even sticking with the default generator, the are quite a few options in the profile:

Code: Select all

MyTerrainMaterialGenerator::SM2Profile* matProfile = static_cast<MyTerrainMaterialGenerator::SM2Profile*>(mTerrainGlobals->getDefaultMaterialGenerator()->getActiveProfile());
matProfile->setLightmapEnabled(false);
matProfile->setCompositeMapEnabled(false);
matProfile->setLayerNormalMappingEnabled(false);
matProfile->setLayerSpecularMappingEnabled(false);
matProfile->setLayerParallaxMappingEnabled(false);
matProfile->setGlobalColourMapEnabled(false);
Transporter
Minaton
Posts: 933
Joined: Mon Mar 05, 2012 11:37 am
Location: Germany
x 110

Re: Simplest settings for Ogre Terrain?

Post by Transporter »

Could one of you add a tutorial how to use the terrain component?
http://www.ogre3d.org/tikiwiki/tiki-ind ... +Tutorials
User avatar
petrocket
Gremlin
Posts: 178
Joined: Tue Mar 20, 2007 3:29 am
x 10
Contact:

Re: Simplest settings for Ogre Terrain?

Post by petrocket »

Transporter wrote:Could one of you add a tutorial how to use the terrain component?
http://www.ogre3d.org/tikiwiki/tiki-ind ... +Tutorials
There are actually a couple terrain tutorials on the wiki, but they're inside a larger tutorial set:
http://www.ogre3d.org/tikiwiki/tiki-ind ... =Tutorials
c6burns wrote:In all likelihood you will want to make your own TerrainMaterialGenerator and take charge of GLES2 shader generation yourself. I went through this process trying to optimize for lower end android devices. The simplest generator would just reference a standard Ogre material, like this: http://www.ogre3d.org/forums/viewtopic.php?f=5&t=72455
Thank you! I'll try those settings out.
Ogre API & Manual | Ogre Wiki

blog | website | work

Follow me on twitter @ twitter.com/petrocket
Post Reply