Problem about GrassLoader and densitymap

Nems

09-07-2009 15:07:00

Hi.
I am working on Ogre3D since 6 months and I am using PG to generate outdoor environnement (of course).

I do not know if I am doing something wrong but it seems that the grasslayer does not cope very well with its densitymap.
If I try use a PNG file fill by whith and with a black square in top-left corner, the result is a bit strange.
1°) It is not a perfect square, it looks like a losange.
2°) It seem there a displacement between the densitymap and the terrain.

//-------------------------------------- LOAD GRASS --------------------------------------
grass = new PagedGeometry(camera, 50);
grass->addDetailLevel<GrassPage>(250);

//Create a GrassLoader object
grassLoader = new GrassLoader(grass);
grass->setPageLoader(grassLoader);

grassLoader->setHeightFunction(&HeightFunction::getTerrainHeight);

//Add some grass to the scene with GrassLoader::addLayer()
GrassLayer *l = grassLoader->addLayer("grass");

//Configure the grass layer properties (size, density, animation properties, fade settings, etc.)
l->setMinimumSize(2.0f, 2.0f);
l->setMaximumSize(2.5f, 2.5f);
l->setAnimationEnabled(true); //Enable animations
l->setSwayDistribution(10.0f); //Sway fairly unsynchronized
l->setSwayLength(0.5f); //Sway back and forth 0.5 units in length
l->setSwaySpeed(0.5f); //Sway 1/2 a cycle every second
l->setDensity(1.5f); //Relatively dense grass
l->setFadeTechnique(FADETECH_GROW); //Distant grass should slowly raise out of the ground when coming in range
l->setRenderTechnique(GRASSTECH_QUAD); //Draw grass as scattered quads

l->setColorMap(cfg.getSetting("grass_CMap", "BConfig"));
l->setDensityMap(cfg.getSetting("grass_DMap", "BConfig"));
l->setDensityMapFilter(MAPFILTER_NONE);
l->setMapBounds(TBounds(0, 0, 1500, 1500));

Fish

09-07-2009 17:29:51

Are you able to reproduce the problem with the example application (I think it's Example-4)?

-Fish