Hello Christoph, On 04/25/2012 04:09 AM, "Christoph Fünfzig" wrote: > I am wondering if separating a ChunkMaterial into two parts might be possible: > The first containing a SimpleSHLChunk for several childs: > OSG::SimpleSHLChunkUnrecPtr shl = OSG::SimpleSHLChunk::create(); > shl->setVertexProgram (_vp_program); > shl->setFragmentProgram(_fp_program); > // common parameters: > shl->addUniformVariable("texScale0", > OSG::Vec2f(1.0f/OSG::Real32(numTiles), 1.0f/OSG::Real32(numTiles))); > shl->addUniformVariable("texScale1", OSG::Vec2f(1.0f, 1.0f)); > // uniform sampler2D > shl->addUniformVariable("tex_alpha", 0); > shl->addUniformVariable("tex_ground", 1); > shl->addUniformVariable("tex_detail1", 2); > shl->addUniformVariable("tex_height", 3); > shl->addUniformVariable("tex_gradient", 4); > > and a second containing special variables (scalings, coords) for a specific > child node: > OSG::SimpleSHLVariableChunkUnrecPtr shlparam = > OSG::SimpleSHLVariableChunk::create(); > shlparam->addUniformVariable("texOrigin0", > OSG::Vec2f(tx/OSG::Real32(numTiles),ty/OSG::Real32(numTiles))); > shlparam->addUniformVariable("tileCoord", OSG::Pnt2f(tx, ty)); > shlparam->addUniformVariable("tileOrigin", OSG::Pnt2f(-skySize, > -skySize)); > shlparam->addUniformVariable("decimate", 10.0f); > > Is this possible or intended with an ChunkOverrideGroup containing the first?
the shader chunks can be composed with ChunkOverrideGroups (so they behave a bit odd in the sense that they are not really overridden, but aggregated instead). I'm not 100% sure if that works with SimpleSHLChunk or if you need to use ShaderProgramChunk and ShaderProgramVariableChunk. Gerrit: Can you help out here? > Does it have benefits to do so? Your application has to keep track of only one place to change uniform values for groups of objects. Cheers, Carsten ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Opensg-users mailing list Opensg-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensg-users