Hi Kim:
Thank you for the useful informations!
I could understand the "default shader" code a little now.
When I apply the "default shader" to the model, it looks a little bit too
shinning and glaring.... Can I weaken the glaring thing?
Regards,
MT
Kim Bale wrote:
> Hi MT,
>
> If you open boat.3ds in osgviewer you will notice that the model
> itself is white. It doesn't have any textures on it and it's there
> purely as a test case for the collision. But yes the default shader
> has been added to it.
>
>
> > Will you please give us a example about how to add a model to the
> > oceanScene to keep what they are?
> >
>
> The terrain is an external model that has a custom shader applied to
> it, you can look at that. Alternatively look at the default shader
> source.
>
> K.
>
>
>
> 2009/11/3 Tian Ma <>:
>
> > Hi Kim:
> >
> > I have downloaded the newest version through SVN, and also compiled the
> > code successfully.
> >
> > When I turn on the oceanExample's "testCollision", I found that the
> > "boat.3ds" model is just white, the same situation I met before. Is this
> > what the example just want to show us?
> >
> > In the example, you did not add any "shader" to the model. Does this mean
> > that: a default shader was added to the model? But why the model looks just
> > white?
> >
> > Will you please give us a example about how to add a model to the
> > oceanScene to keep what they are?
> >
> >
> > Regards,
> >
> > MT
> >
> >
> > Kim Bale wrote:
> >
> > > Hi MT,
> > >
> > > For the reasons I just gave, you can't add objects to the scene and
> > > have the full compliment of effects without either using the default
> > > shader or using your own shader implementation.
> > >
> > > Reflections/refractions etc will continue to work since they act on
> > > the ocean surface and not the model. However, other such as glare,
> > > depth of field, light scattering, fogging etc will not as they act on
> > > the models themselves.
> > >
> > > However, it is pretty straight forward to duplicate a subset of fixed
> > > pipeline functionality within a shader and then add the relevant
> > > osgOcean shader effects to it, you can just copy functions from the
> > > default shader and mix them in with the result of your shader.
> > >
> > > K.
> > >
> > >
> > > 2009/11/2 Tian Ma <>:
> > >
> > >
> > > > Hi Jan,Kim:
> > > >
> > > > Thank you a lot.
> > > >
> > > > Kim, does it means that: I can never keep the models looks like
> > > > what they are before? And I have to program shaders for every loaded
> > > > models, in order to have reflect or other effects?
> > > >
> > > > I want to know that: is there a simple way to make the models just
> > > > look like what they are?
> > > >
> > > >
> > > >
> > > > Kim Bale wrote:
> > > >
> > > >
> > > > > Hi Jan, Tian,
> > > > >
> > > > > osgOcean uses shaders for pretty much every effect in the scene -
> > > > > fogging, depth of field, glare, lighting etc. If objects that are
> > > > > added to the scene are to look consistent with the ocean effects they
> > > > > will require a shader to be applied that takes into account these
> > > > > effects. This is particularly necessary if the fullscreen effects are
> > > > > used as they require the alpha component of the frame buffer to work.
> > > > >
> > > > > In order to address this issue, OceanScene will apply a default shader
> > > > > to objects added as children (default_scene.frag & vert) which
> > > > > illustrates how to use the uniforms supplied by osgocean (prefixed
> > > > > osgOcean_* ) in conjunction with your own shader. Since I could not
> > > > > anticipate the many wierd and wonderful ways that shaders can be used
> > > > > it only offers a very basic implementation (1 texture unit, limited
> > > > > phong lighting etc) and should be seen as a shader to customise and
> > > > > build on yourself.
> > > > >
> > > > > You can override the default shader either by attaching a new program
> > > > > to the object you wish to use in the scene or by using this function
> > > > > in OceanScene:
> > > > >
> > > > > /** Override the default scene shader for custom shaders.
> > > > > * If custom shaders are required for individual nodes add them
> > > > > before adding to the OceanScene.
> > > > > * Dirties state.
> > > > > */
> > > > > void setDefaultSceneShader( osg::Program* program )
> > > > > {
> > > > > _defaultSceneShader = program;
> > > > > _isDirty = true;
> > > > > }
> > > > >
> > > > > Alternatively you can turn the default shader off completely with
> > > > > setter in OceanScene.
> > > > >
> > > > > Regards,
> > > > >
> > > > > Kim.
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > 2009/11/2 Jan Ciger <>:
> > > > >
> > > > >
> > > > >
> > > > > > "Tian Ma" <> wrote:
> > > > > >
> > > > > >
> > > > > >
> > > > > > > Hi,
> > > > > > >
> > > > > > > When I load a model into the osgOcean scene, the model looks
> > > > > > > white all
> > > > > > > over, without any material. Anybody knows why?
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > > > Yes, I have seen the same thing. I believe that the shaders applied
> > > > > > by
> > > > > > osgOcean are responsible and are not passing the the vertex colors
> > > > > > along.
> > > > > > I have yet to check the shader code, though.
> > > > > >
> > > > > > Regards,
> > > > > >
> > > > > > Jan
> > > > > >
> > > > > > _______________________________________________
> > > > > > osg-users mailing list
> > > > > >
> > > > > > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > _______________________________________________
> > > > > osg-users mailing list
> > > > >
> > > > > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> > > > >
> > > > > ------------------
> > > > > Post generated by Mail2Forum
> > > > >
> > > > >
> > > >
> > > >
> > > > ------------------
> > > > Read this topic online here:
> > > > http://forum.openscenegraph.org/viewtopic.php?p=19021#19021
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > _______________________________________________
> > > > osg-users mailing list
> > > >
> > > > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> > > >
> > > >
> > > >
> > > _______________________________________________
> > > osg-users mailing list
> > >
> > > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> > >
> > > ------------------
> > > Post generated by Mail2Forum
> > >
> >
> >
> > ------------------
> > Read this topic online here:
> > http://forum.openscenegraph.org/viewtopic.php?p=19090#19090
> >
> >
> >
> >
> >
> > _______________________________________________
> > osg-users mailing list
> >
> > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> >
> >
> _______________________________________________
> osg-users mailing list
>
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
> ------------------
> Post generated by Mail2Forum
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=19138#19138
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org