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

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

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

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

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

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

2015-01-26 Thread Robert Osfield
Hi Chris, It's not possible to determine what error you have made from the snippets included. The snippet of code you did include didn't show how or whether you added the osg::Program to the StateSet, or whether you attached a vertex shader. I would recommend starting from one of the examples

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

2015-01-26 Thread Chris Hidden
Hey Robert, thanks for answer, hope you had a great weekend! I've been trying to read up on vertex shaders and fragment shaders and maybe I am not quite understanding. Im trying to attach a very basic fragment shader, but I can't seem to get it to work and I am not sure why. I keep

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

2015-01-26 Thread Chris Hidden
Aha, ok, I wasn't clear enough. I literally injected that code snippet into the osganimationhardware.cpp example. I just thougt it would be redundant to repost the entire example. If you shove my code right at in around line 122, thats where I have made the edits. Otherwise my entire

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

2015-01-26 Thread Robert Osfield
Hi Chris, Still can't spot what might be wrong. Try running the application with the OSG_NOTIFY_LEVEL env var set to DEBUG and then capture the output to the console. The shader strings passed to OpenGL should be printed out. This might give some clues. Robert. On 26 January 2015 at 15:18,

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

2015-01-26 Thread Chris Hidden
Ok I solved my problem with the fragment shader. Stupid but I realized that if I didn't instanciate the fragment shader within the if conditional where it checks to make sure the program is valid or not it will add the same fragment shader twice to the program, hence the duplicate main error.

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

2015-01-23 Thread Robert Osfield
Hi Chris, I don't now how the scene graph is set up so can't answer specifics, but in general if you want texturing to appear then the fragment shader will need to apply the texture. I'd guess that the current fragment shader doesn't have texturing in it, so just add this. Robert. On 23

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

2015-01-23 Thread Chris Hidden
I run skinning.vert on my fbx model which has rigging. Ive attached the shader program as in the osg hardware animation example. I have a texture that accompanies the hand model in the FBX file that I export from 3Ds max. If I don't attach the shader program the hand models show up with the