Re: [osg-users] Blending Multiple Texture on one triangle mesh with coordinate control

2010-09-27 Thread Brian Tse
thank you very much for your reply Robert.

Sorry to reply late. I finally got it working.

At the end i used texture3D instead of texture2D.

One problem i had with texture was shadowing. Originally, i used ShadowMap, but 
some reason, the second texture never show up. the shadowmap doesn't seems to 
let me set any texture unit higher than 0. I have changed it to shadowtexture, 
and it works.

I will tidy my code up and post it up to check if it is the most optimized.

Once again, Many thanks for your help, we appreciate your time.

Brian

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=32097#32097





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Blending Multiple Texture on one triangle mesh with coordinate control

2010-09-19 Thread Robert Osfield
Hi Brian,

To do multi-texturing you simple need to assign a texture coordinate
array per texture unit you want to address, with a texture coord per
vertex.  So if you want two texture's you'll need to assign two
texture arrays.  The method to use is
osg::Geometry::setTextureCoordArray(unit, array).   Then you need to
set up with textures to use, which you use
osg::StateSet::setTextureAttributeAndModes(myTexture,
osg::StateAttribute::ON);

A good example of geometry setup can be found in osggeometry, this
doesn't do multi-texturing, but it does provide an code segment that
sets up the StateSet and Geometry for a single texture, this code
segment can easily be extended to do multi-texturing with the above
suggestions.  Another example that will be useful is osgmultitexture,
this does multi-texturing, but rather than use another texture coord
array it use tex gen to generate the coordinates.

Robert.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Blending Multiple Texture on one triangle mesh with coordinate control

2010-09-18 Thread Brian Tse
Hi Alberto

Thank you very much for your quick response.

One of the reason our team has to do it via open scene graph is because our 
program has to modified the triangle mesh in real time, this include additional 
or removal or triangles. Therefore, (I may be wrong, because i m very new to 3D 
graphic) we can not do it via Blender or 3dMAX. 

Do you know if any function in osg i should look into to do that function?

Many Thanks for your help and we appreciate your effort.
Regards
Brian

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=31796#31796





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Blending Multiple Texture on one triangle mesh with coordinate control

2010-09-17 Thread Alberto Luaces
Brian Tse writes:

 Currently, I build a triangle mesh in osg (eg. triangle mesh is a
 teddy bear model)
 I want to implement 2 texture (eg. hair.jpg and skin.jpg)

 Is there a way i can blend 2 texture together on one single triangle
 mesh? (eg. hair.jpg showing on one side of the teddy bear model and
 skin.jpg showing on the other side?) Between them, they can blend
 together nicely in some way?

 In the other words, is there a way we can control the texture based on
 the mesh vertices coordinate information with multiple texture?

Hi Brian,

this is more a 3D modelling question rather than a programming
question. Sure, you could do what you want with OSG, but modifying
texture coordinates and assigning different materials to every polygon
in the model is something that is best done in a 3D editor. Try to use
one (www.blender.org, for example), and then feed your OSG program with
the model you have done.

-- 
Alberto

___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Blending Multiple Texture on one triangle mesh with coordinate control

2010-09-16 Thread Brian Tse
Hi All

I am very new to Open Scene Graph and please accept my apology if this is a 
very obvious question. Your answer is grateful appreciated.

Currently, I build a triangle mesh in osg (eg. triangle mesh is a teddy bear 
model)
I want to implement 2 texture (eg. hair.jpg and skin.jpg)

Is there a way i can blend 2 texture together on one single triangle mesh? (eg. 
hair.jpg showing on one side of the teddy bear model and skin.jpg showing on 
the other side?) Between them, they can blend together nicely in some way?

In the other words, is there a way we can control the texture based on the mesh 
vertices coordinate information with multiple texture?

Thank you very much and sorry this might be a very obvious question. Your 
Answer will be very helpful.
Brian

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=31690#31690





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org