Re: [osg-users] How to Preserve FBX baked in textures when running running hardware skinning

2015-01-27 Thread Christian Buchner
The shader needs to receive a sampler uniform containing the integer value
of a texture unit to use.

The right way to do this would be to scan the subgraph of the model for
state sets containing enabled texture units. Use a node visitor here. For
each of these texture units, create a uniform value containing the texture
unit and attach it to the model's state.

It might be a bit of a pain to write a shader for all kinds of different
textures and multitexturing modes though. There is a tool that might be
able to assist you here. So far this isn't integrated into OSG.

ShaderGen

https://github.com/mojocorp/ShaderGen

Christian



2015-01-27 13:50 GMT+01:00 Chris Hidden ch...@erghis.com:

 Ok so now back to the original intent with this question.

 So I can now attach a texture to my hand model with a vertex and fragment
 shader, which is great!  I load the texture via its file path and send it
 along to the shaders.

 However I was hoping to find a way to do this in a different workflow.  I
 have been and would like to continue to do a fair amount of the texture
 work in 3D Studio Max.  So when I export an FBX model and load it into the
 scene graph it under normal circumstances retains its embedded texture
 and displays accordingly.

 Is there a way I can access these textures for the FBX model, so that I
 could in some way load the texture directly from the model.

 So if I have
 osg::ref_ptrosg::Node model = osgDB::readNodeFile(myModel.fbx);

 Then I would like to acheive this somehow (Pseudo Code):

 osg::ref_ptrosg::Texture2D texture = model-GetEmbeddeFBXTexture();

 That way we could have a nice system that will take whatever our designers
 or modelers texture the model with directly through the code instead of
 having to manually switch in the code later on.

 Im sure this can be done one way or another.  Is there a somewhat simple
 approach to this?
 Thank you!

 Cheers,
 Chris

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





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

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


Re: [osg-users] How to Preserve FBX baked in textures when running running hardware skinning

2015-01-27 Thread Chris Hidden
Great thanks guys!

This is the kind of lead I was looking for.  Ill take a look at the shaderGen 
and I also have been poking around the fbxsdk which might help as well.  
Cheers!  If I find a good solution and the time Ill try and post how I managed 
to get it working here later on.  

Thank you!

Cheers,
Chris

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





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


Re: [osg-users] How to Preserve FBX baked in textures when running running hardware skinning

2015-01-27 Thread Christian Buchner
hmm just googled osg ShaderGen and found this:

http://trac.openscenegraph.org/projects/osg//browser/OpenSceneGraph/branches/OpenSceneGraph-3.2/src/osgUtil/ShaderGen.cpp

This seems to create shader code based on some OSG states, but I have no
idea how complete this implementation is. Also I have never used this ;)

Christian


2015-01-27 14:26 GMT+01:00 Chris Hidden ch...@erghis.com:

 Great thanks guys!

 This is the kind of lead I was looking for.  Ill take a look at the
 shaderGen and I also have been poking around the fbxsdk which might help as
 well.  Cheers!  If I find a good solution and the time Ill try and post how
 I managed to get it working here later on.

 Thank you!

 Cheers,
 Chris

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





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

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


Re: [osg-users] [Build error] GL_SEPARATE_ATTRIBS not declared

2015-01-27 Thread Robert Osfield
HI Sverre,

On 27 January 2015 at 13:26, Sverre Aleksandersen 
sverre.aleksander...@gmail.com wrote:

 Shouldn't line 643 and 317 in osgTerrain/GeometryPool.cpp be
 GL_LINES_ADJACENCY_EXT instead of GL_LINES_ADJACENCT?
 That's how it's defined in GLDefines.


Should really be the other way around, with GLDefines providing the
GL_LINES_ADJANCY, the EXT version pre-dates GL-3.2.  I have made changes to
my local GLDefines to address this, I'm currently waiting for a clean build
to see if this change is fine.

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


[osg-users] SmoothingVisitor normals doesn't seem right

2015-01-27 Thread Ash Pat
Hi,

I am trying to use the SmoothingVisitor to generate the normals. I am not 
explicitly setting the normals array. However, when rendered it appears as 
though the normals generated are flipped. The geometry consists of triangle and 
quad primitives.

I tried it in two ways.

Code:
osgUtil::SmoothingVisitor::smooth(*pGeometry);



Code:
osgUtil::SmoothingVisitor sv;
pGeode-accept(sv); 



Any suggestions? 
Is there something more to be done? 

Thank you!

Cheers,
AP

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





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


Re: [osg-users] How to Preserve FBX baked in textures when running running hardware skinning

2015-01-27 Thread Chris Hidden
Ok so now back to the original intent with this question.

So I can now attach a texture to my hand model with a vertex and fragment 
shader, which is great!  I load the texture via its file path and send it along 
to the shaders.  

However I was hoping to find a way to do this in a different workflow.  I have 
been and would like to continue to do a fair amount of the texture work in 3D 
Studio Max.  So when I export an FBX model and load it into the scene graph it 
under normal circumstances retains its embedded texture and displays 
accordingly. 

Is there a way I can access these textures for the FBX model, so that I could 
in some way load the texture directly from the model.  

So if I have
osg::ref_ptrosg::Node model = osgDB::readNodeFile(myModel.fbx);

Then I would like to acheive this somehow (Pseudo Code):

osg::ref_ptrosg::Texture2D texture = model-GetEmbeddeFBXTexture();

That way we could have a nice system that will take whatever our designers or 
modelers texture the model with directly through the code instead of having to 
manually switch in the code later on.  

Im sure this can be done one way or another.  Is there a somewhat simple 
approach to this?
Thank you!

Cheers,
Chris

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





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


Re: [osg-users] How to Preserve FBX baked in textures when running running hardware skinning

2015-01-27 Thread Trajce Nikolov NICK
Hi Chris,

 osg::ref_ptrosg::Texture2D texture = model-GetEmbeddeFBXTexture();

I think you have to write NodeVisitor that will traverse your model and
extract the Texture from the StateSet. But you can also work with the
texture that is mapped in your FBX model. I didn't followed your
conversation with Robert on this topic, but maybe you just put in your
shader the texture unit to which the texture is assigned?

On Tue, Jan 27, 2015 at 1:50 PM, Chris Hidden ch...@erghis.com wrote:

 Ok so now back to the original intent with this question.

 So I can now attach a texture to my hand model with a vertex and fragment
 shader, which is great!  I load the texture via its file path and send it
 along to the shaders.

 However I was hoping to find a way to do this in a different workflow.  I
 have been and would like to continue to do a fair amount of the texture
 work in 3D Studio Max.  So when I export an FBX model and load it into the
 scene graph it under normal circumstances retains its embedded texture
 and displays accordingly.

 Is there a way I can access these textures for the FBX model, so that I
 could in some way load the texture directly from the model.

 So if I have
 osg::ref_ptrosg::Node model = osgDB::readNodeFile(myModel.fbx);

 Then I would like to acheive this somehow (Pseudo Code):

 osg::ref_ptrosg::Texture2D texture = model-GetEmbeddeFBXTexture();

 That way we could have a nice system that will take whatever our designers
 or modelers texture the model with directly through the code instead of
 having to manually switch in the code later on.

 Im sure this can be done one way or another.  Is there a somewhat simple
 approach to this?
 Thank you!

 Cheers,
 Chris

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





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




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


Re: [osg-users] [Build error] GL_SEPARATE_ATTRIBS not declared

2015-01-27 Thread Sverre Aleksandersen
Hi,

Shouldn't line 643 and 317 in osgTerrain/GeometryPool.cpp be
GL_LINES_ADJACENCY_EXT instead of GL_LINES_ADJACENCT?
That's how it's defined in GLDefines.

Regards,
Sverre A:

On Sun, Jan 25, 2015 at 12:45 PM, Alexey Pavlov alex...@gmail.com wrote:



 2015-01-23 20:21 GMT+03:00 Mattias Helsing helsin...@gmail.com:

 Hi,
 I have been seeing these errors for a while when building OSG using an
 old android NDK. I don't use it but just tried to build OSG using a
 new Toolchain file provided a few months ago. I discarded it thinking
 it was due to me using an old NDK, but if anyone is interested i post
 nightly builds once in a while to:
 http://cdash.openscenegraph.org

 Matters maybe you know Ray Donnelly he works on Android NDK some time
 ago. We work with him on MSYS2 project now.

 I'm fix building OSG using next patch for including extra GL header:

 --- OpenSceneGraph/CMakeLists.txt.orig 2015-01-25 14:09:28.10540 +0300
 +++ OpenSceneGraph/CMakeLists.txt 2015-01-25 14:09:37.49660 +0300
 @@ -508,7 +508,7 @@
  SET(OPENGL_HEADER2  CACHE STRING #include line for
 additional OpenGL Headers if required)
  ELSE()
  SET(OPENGL_HEADER1 #include GL/gl.h CACHE STRING #include
 line for OpenGL Header)
 -SET(OPENGL_HEADER2  CACHE STRING #include line for
 additional OpenGL Headers if required)
 +SET(OPENGL_HEADER2 #include GL/glext.h CACHE STRING
 #include line for additional OpenGL Headers if required)
  ENDIF()
  ENDIF()



 Regards,
 Alexey.





 cheers
 Mattias

 On Fri, Jan 23, 2015 at 9:25 AM, Alexpux alex...@gmail.com wrote:
 
  23 янв. 2015 г., в 10:59, Robert Osfield robert.osfi...@gmail.com
  написал(а):
 
  Hi Alexey,
 
  On 22 January 2015 at 21:02, Alexey Pavlov alex...@gmail.com wrote:
 
  All defines are present in glext.h for mingw-w64. Wonder why  they not
  defined. See:
 
 
 
 https://github.com/Alexpux/mingw-w64/blob/master/mingw-w64-headers/include/GL/glext.h
 
 
 
  Perhaps CMake is using the Windows gl.h rather than the mingw one.
 Have a
  look to see what CMake has selected for the path to the OpenGL headers
 - the
  variable is OPENGL_INCLUDE_DIR:PATH.
 
  Here:
 
 https://github.com/Alexpux/mingw-w64/tree/master/mingw-w64-headers/include/GL
  You can see that «gl.h» is also present. So maybe need include not only
 this
  header?
 
  Alexey.
 
  Robert.
  ___
  osg-users mailing list
  osg-users@lists.openscenegraph.org
 
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
 
 
 
  ___
  osg-users mailing list
  osg-users@lists.openscenegraph.org
 
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
 
 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org



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


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