The more modern approach would be texture-arrays which might outperform texture atlas implementation in terms of implementation effort and memory bandwidth. It requires all textures to be of the same dimensions. I'm successfully using this for texture variation on terrain and vegetation. Unfortunately you'll have to use the shader pipeline and write your own visitor to map the different textures to the instances of your geometry by adding an uniform to them or using an attribute (which might be a bit better performance-wise as there are no state-changes)

Cheers
Sebastian
--



Trajce Nikolov NICK <trajce.nikolov.nick <http://trajce.nikolov.nick>@gmail.com>schrieb:

   Hi Aaron,

   I would do this with texture atlas - all roofs in one large texture
   and map them separately. This is sort of common in database development

   On Sat, Aug 29, 2015 at 11:14 PM, Aaron Andersen<[email protected]
   <mailto:[email protected]>> wrote:

       Hello,

       Consider if I have a mesh file constructed from 2 geometries: a
       cube, and a pyramid on top of the cube, representing a simple
       house. When I load this house it is pulled into OSG as a single
       Geode composed of 2 Geometry instances.

       I have 2 image files for this house: a brown brick house texture
       and a black shingle texture which can be applied to the 2
       geometries of the house mesh. Now consider if I have 2 more
       textures: a dark grey vinyl siding texture, and a dark green
       metal roof texture. If I keep producing more image files you can
       imagine all the different possibilities I might have in
       constructing a home.

       Now consider if I want to make a row of 25 houses:

       osg::Group * rootOfScene = new osg::Group;

       osg::Node * houseGeode = osgDB::readNodeFile("house-mesh.ext");

       for (int i = 0; i < 25; i++)
       {
            osg::PositionAttitudeTransform * transform = new
       osg::PositionAttitudeTransform;

            transform->setPosition(osg::Vec3d(i * 20.f, 0, 0));
            transform->addChild(houseGeode);

            rootOfScene->addChild(transform);
       }

       What is the most efficient way to apply these different texture
       sets so that I can have a row of houses, each with different
       textures being applied to the cube mesh and the pyramid mesh?

       Any help is greatly appreciated.

       Thank you,
       Aaron
       _______________________________________________
       osg-users mailing list
       [email protected]
       <mailto:[email protected]>
       http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org




   --
   trajce nikolov nick
   _______________________________________________ osg-users mailing
   list
   
[email protected]http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to