Hi to all,
i'm trying to visualize the "depth field" effect in my osg application, using 
shader (vertex and fragment) from this link 
http://devmaster.net/posts/3021/shader-effects-depth-of-field

The vertex program, requires as uniform the following :

uniform mat4 ProjectionMatrix;
uniform mat4 ViewMatrix;
uniform mat4 ModelMatrix;
uniform vec3 ModelScale;

So, in my osg application, i suppose to pass :

myProgram->addShader(mVertexShader.get());
myProgram->addShader(mFragShader.get());
        
mStateset = mMyModel3D->getOrCreateStateSet();
mStateset->setTextureAttributeAndModes(new osg::Uniform( "ProjectionMatrix", 
myCamera->getProjectionMatrix() ));

mStateset->setTextureAttributeAndModes( new osg::Uniform("ViewMatrix", 
myCamera->getViewMatrix() ));



mStateset->setAttributeAndModes(mProgram.get());

...

Does it correct?

How can i pass also mat4 ModelMatrix and vec3 ModelScale?

mStateset->addUniform( new osg::Uniform("ModelMatrix",??? ) );

mStateset->addUniform( new osg::Uniform("ModelScale", 
myMatrixTransformObject->getMatrix().getScale() ) );  // ???


Thank you!

Cheers,
Andrea

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





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

Reply via email to