-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Color #56
Comments
Hi Souffou,
All nodes that are added to the ocean scene have a shader applied to them
in order to replicate various above and below water effects (e.g. depth of
field, shadows, water shading). You can see the shader used here:
https://github.com/kbale/osgocean/blob/master/resources/shaders/osgOcean_ocean_scene.frag
https://github.com/kbale/osgocean/blob/master/resources/shaders/osgOcean_ocean_scene.vert
If you look at the fragment shader you will see it doesn't take into
account the the colour of the geometry when computing the final fragment
colour, it relies on all objects that are added to the scene being texture
mapped. It would be fairly trivial to modify this shader to use the
geometry colour if you wish to though.
Hope that helps,
Kim.
…On Mon, 7 Mar 2022 at 09:40, Souffou Daoudou ***@***.***> wrote:
Hello ^^
I placed myself underwater and I would like to know why I can not put
colors on my 2 ShapeDrawable object I tried without osgOcean and its works
but on the example nothing passes as expected I may have forgotten an
essential point '
here is my code if needed in the source file application.cpp before the
"Set up the viewer": (nothing extraordinary)
osg::ref_ptr<osg::ShapeDrawable> cubeMap = new osg::ShapeDrawable();
osg::ref_ptr<osg::ShapeDrawable> cylinderMap = new osg::ShapeDrawable();
osg::ref_ptr<osg::Group> rootGroup = new osg::Group();
cubeMap->setShape(new osg::Box(osg::Vec3(0.0f, 0.0f, -210.0f), 2.0f));
cylinderMap->setShape(new osg::Cylinder(osg::Vec3(5.0f, 0.0f, -210.0f), 1.0f, 8.0f));
cubeMap->setColor(osg::Vec4f(1.0f, 0.0f, 0.0f, 0.0f));
cylinderMap->setColor(osg::Vec4f(1.0f,0.0f,1.0f,0.0f));
cylinderMap->setColorBinding(osg::Geometry::BIND_OVERALL);
osg::ref_ptr<osg::Geode> geode = new osg::Geode;
geode->addDrawable(cubeMap.get());
geode->addDrawable(cylinderMap.get());
scene->getOceanScene()->addChild(geode);
root->addChild(scene->getScene());
thanks in advance
—
Reply to this email directly, view it on GitHub
<#56>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACXXT5PHZ37SPM5WWPTX2G3U6XFIJANCNFSM5QCXTEYQ>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Oh Allright, I’ll see what I can do. |
Hi Souffou,
I should add that you can add your own shader to your scene nodes which
will override the scene shader and use the same uniforms that are applied
to the scene. So you can copy the base scene shader and modify it for your
own node. You don't need to modify the base shader itself.
Cheers,
Kim.
…On Mon, 7 Mar 2022 at 10:38, Souffou Daoudou ***@***.***> wrote:
Oh
Allright, I’ll see what I can do.
Thanks
—
Reply to this email directly, view it on GitHub
<#56 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACXXT5NYW7YGIPYAEPJIA5TU6XMCZANCNFSM5QCXTEYQ>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you commented.Message ID:
***@***.***>
|
HOOOOO Copy and modify the base shader Have a nice day |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello ^^
I placed myself underwater and I would like to know why I can not put colors on my 2 ShapeDrawable object I tried without osgOcean and its works but on the example nothing passes as expected I may have forgotten an essential point '
here is my code if needed in the source file application.cpp before the "Set up the viewer": (nothing extraordinary)
thanks in advance
The text was updated successfully, but these errors were encountered: