Stranges in adding trees !

compvis

23-07-2009 08:37:37

Hi,

I have a problem with adding trees to my scene. My code:

mTrees = new Forests::PagedGeometry();
mTrees->setCamera(mCam);
mTrees->setPageSize(80);

    mTrees->setInfinite();
    mTrees->addDetailLevel<BatchPage>(150, 50);
    mTrees->addDetailLevel<ImpostorPage>(500, 50);

    mTreeLoader = new Forests::TreeLoader3D(mTrees,Forests::TBounds(0,0,3000,3000));
    mTrees->setPageLoader(mTreeLoader);

    //Load a tree entity
    Entity *myEntity = mScene->createEntity("Tree", "fir14_25.mesh");

    HeightFunction::initialize(mScene);

    Vector3 position;
    Radian yaw;
    Real scale;
    for (LONGLONG i = 0; i < 200000; i++)
    {
    yaw = Degree(Math::RangeRandom(0, 360));
    position.x = Math::RangeRandom(0, 3000);
    position.z = Math::RangeRandom(0, 3000);
    position.y = HeightFunction::getTerrainHeight(position.x, position.z);

    scale = Math::RangeRandom(0.8f, 0.9f);
    mTreeLoader->addTree(myEntity, position, yaw, scale);
    }

    Then my trees loader displays normally, but if i set like:
    position.z = Math::RangeRandom(0, 1500);

    then no trees displays on terrain ?

    What i was wrong ?

    Fish

    23-07-2009 13:57:41

    Can you reproduce the problem with the example tree loader application? I think it's Example #1.

    -Fish

    compvis

    24-07-2009 07:28:42

    wow, thank you so much, i loaded successfully trees, then, i i tried to load grass but i wasn't successfully.
    Pls see my image:



    In that image, i only see the close grass. I can't see the far grass, only texture of terrain.

    My goal is to spread the grass all over the terrain

    Fish

    24-07-2009 13:55:07

    That behavior is by design. The visible range is adjustable to accommodate slower computers. You can increase the visible range of the grass by increasing the PageSize variable in your call to addDetailLevel<Forests::GrassPage>();

    You should read through the documents in your "forests\docs" directory, they are very helpful. They are OpenOffice documents that discuss the implementation of PG. They have not been updated to discuss the recently patched in features so if you should get stuck please post. :)

    -Fish

    compvis

    27-07-2009 03:04:15

    thanks, i have new images: