[osg-users] [osgOcean] 3D model material display error!
kcbale at googlemail.com
Thu Nov 5 02:14:47 PST 2009
That set up was designed to work with the terrain shader not the
default shader. Unless you've added support for texture units 1 and 2
and attribute 6 to the default shader, they'll be ignored.
Somehow your alpha is getting set to an value greater than the glare
threshold defined in OceanScene. I'm afraid I can't tell what it is
from that code snippet.
2009/11/5 Tian Ma <tianxiao888 at foxmail.com>:
> Hi Kim:
> Thanks a lot!
> The code you said already exits in the default shader file. But the glare
> still appear on the model,even it is above the water.
> My shader code is as follow:
> void setupModelShader( osg::ref_ptr<osg::Node> model )
> static const char model_vertex = "resources/shaders/default_scene.vert";
> static const char model_fragment = "resources/shaders/default_scene.frag";
> osg::Program* program = osgOcean::ShaderManager::instance().createProgram("model_shader", model_vertex, model_fragment, true);
> program->addBindAttribLocation("aTangent", 6);
> model->getStateSet()->addUniform( new osg::Uniform( "uTextureMap", 0 ) );
> model->getStateSet()->addUniform( new osg::Uniform( "uOverlayMap", 1 ) );
> model->getStateSet()->addUniform( new osg::Uniform( "uNormalMap", 2 ) );
> Is there anything wrong with the "shader applying" code above?
> Thank you !
> Kim Bale wrote:
>> Set the alpha on the model to 0 when it's above water and the glare
>> won't appear on the model
>> final_color.a = 0.0;
>> Alternatively tweak the glare intensity from OceanScene. All the
>> functions have been commented in the header.
More information about the osg-users