Terra detailweight

Discussion area about developing with Ogre-Next (2.1, 2.2 and beyond)


Nickak2003
Goblin
Posts: 272
Joined: Thu Jun 10, 2004 4:19 am
x 26

Terra detailweight

Post by Nickak2003 »

How do I add 4 more detail textures to terra?
right now to set the main detail, I do this:

Code: Select all

        datablock->setTexture(Ogre::TerraTextureTypes::TERRA_DETAIL_WEIGHT, mSplat.getTexture());

and then to set the details, I do this:

Code: Select all

       auto createDetail = [&](const std::string& name, std::size_t i) {

        loadTexture(name, static_cast<Ogre::TerraTextureTypes>(Ogre::TerraTextureTypes::TERRA_DETAIL0 + i), datablock);
        loadTexture(name, static_cast<Ogre::TerraTextureTypes>(Ogre::TerraTextureTypes::TERRA_DETAIL_METALNESS0 + i), datablock);
        loadTexture(name, static_cast<Ogre::TerraTextureTypes>(Ogre::TerraTextureTypes::TERRA_DETAIL_ROUGHNESS0 + i), datablock);
        //load normal map too

        datablock->setRoughness(i, 1);
        datablock->setMetalness(i, 1);
        datablock->setDetailMapOffsetScale(i, { 0,0,256,256 });
    };

Do I need to make modifications to terra/shaders to support four more details?

User avatar
Crystal Hammer
Orc
Posts: 405
Joined: Sat Jun 23, 2007 5:16 pm
x 115

Re: Terra detailweight

Post by Crystal Hammer »

Yes, you would need to modify terra shaders to support four more details (so 8 in total).
Because TERRA_DETAIL_WEIGHT is RGBA, it only has 4 layers, so a 2nd DETAIL (blend) map would be needed, and sampled also in shaders.
Also all the TERRA_DETAIL0, TERRA_DETAIL_ROUGHNESS0 etc defines go up to 3 (4 total), so you'd need to add more there too and increase iterations in shaders too for it. I wonder how much slower will this get, because all detail textures are sampled in each pixel (not just those which appear, i.e. are above zero in weight/blend map).

Lax
Gnoll
Posts: 667
Joined: Mon Aug 06, 2007 12:53 pm
Location: Saarland, Germany
x 64

Re: Terra detailweight

Post by Lax »

Cool, I need this feature too, as 4 texture layer are not suitable for serious game programming.
Also your other question, in having x-terra placed is very interesting.

http://www.lukas-kalinowski.com/Homepage/?page_id=1631
Please support Second Earth Technic Base built of Lego bricks for Lego ideas: https://ideas.lego.com/projects/81b9bd1 ... b97b79be62