Hi Dirk,
On 3/1/06, Dirk Reiners <[EMAIL PROTECTED]> wrote:
>
> Hi Josef,
>
> On Tue, 2006-02-28 at 12:16 +0100, Josef Grunig wrote:
> > Hi all,
> >
> > I have a model which materials are defined as SimpleTexturedMaterial.
> > I would like to add shaders and textures to those materials but seems
> > not to work simply adding a ShaderChunk/TextureChunk to the
> > ChunkMaterial of the geometry.
> >
> > Do TextureChunk and SimpleTexturedMaterial conflict each other?
>
> No, not at all.
>
> > Do I need to convert each SimpleTexturedMaterial into a TextureChunk
> > and then add them to the ChunkMaterial, parent of
> > SimpleTexturedMaterial? Is there a tricky way to do this?
>
> There's always a tricky way, just not always an easy one. ;)
>
> I could see two things: are the models loaded from VRML?
I'm loading an OSB file.
> The VRML loader
> ignores the Geometry's material, and uses a MaterialGroup on top of the
> Geometry for setting the Material. So go to the parent and change that
> Material for VRML.
>
> If not, remember that the SimpleTexturedMaterial does add its own
> TextureChunk to the system, so if you add one, it will be the second one
> and will show up in the second texture unit.
That is not working for me; I already tried that because I supposed
the behaviour you explained here right now.
The shader is OK because it works well with TextureChunk Nodes.
Instead, adding a shader and two textures to a SimpleTexturedMaterial
it got rendered black.
Strange behaviour: if in the same model, with two different
geometries, I have both SimpleMaterial with a TextureChunk (which
works) and a SimpleTexturedMaterial, the second one gets rendered with
the SimpleMaterial's texture .
I do this:
GeometryPtr geo = GeometryPtr::dcast(curNode->getCore());
ChunkMaterialPtr material = ChunkMaterialPtr::dcast(geo->getMaterial());
if( material != NullFC ){
SimpleTexturedMaterialPtr texturedMaterial =
SimpleTexturedMaterialPtr::dcast(material);
if (texturedMaterial != NullFC){
// found SimpleTexturedMaterialPtr
texturedMaterial->addChunk(shader);
texturedMaterial->addChunk(texture1, 1);
texturedMaterial->addChunk(texture2, 2);
}
}
a workaround for me was to manually add (before my textures and
shader) a new textureChunk with the image taken from the
SimpleTexturedMaterial.
Could it be a bug?
Thank you for your help,
--
Josef Grunig
www.blending-life.org
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0944&bid$1720&dat1642
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users