OpenSceneGraph Forum Forum Index OpenSceneGraph Forum
Official forum which mirrors the existent OSG mailing lists. Messages posted here are forwarded to the mailing list and vice versa.
 
   FAQFAQ    SearchSearch    MemberlistMemberlist    RulesRules    UsergroupsUsergroups    RegisterRegister 
 Mail2Forum SettingsMail2Forum Settings  ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
   AlbumAlbum  OpenSceneGraph IRC ChatOpenSceneGraph IRC Chat   SmartFeedSmartFeed 

Shader again.


 
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> osgOcean [osgOcean]
View previous topic :: View next topic  
Author Message
benang
User


Joined: 31 Jan 2011
Posts: 21

PostPosted: Tue Feb 22, 2011 1:04 pm    Post subject:
Shader again.
Reply with quote

Hi,

I seem to stumbled a lot on osgOcean's shaders. I've got lots of graphics artefacts because of them. Can you point me to the ones that are actually working on them? I may need to disturb them a bit with my questions. Thanks. Oh yea BTW I've successfully made my own bloom shader. Here's the screenshot. Very Happy




Thank you!

Cheers,
Bawenang
Back to top
View user's profile Send private message
Kim Bale
Guest





PostPosted: Tue Feb 22, 2011 1:07 pm    Post subject:
Shader again.
Reply with quote

Hi Bawenang,

To my knowledge all the shaders work correctly.


Can you be more specific?


Regards,


Kim.



On 22 February 2011 13:04, Bawenang Rukmoko < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)> wrote:
Quote:
Hi,

I seem to stumbled a lot on osgOcean's shaders. I've got lots of graphics artefacts because of them. Can you point me to the ones that are actually working on them? I may need to disturb them a bit with my questions. Thanks. Oh yea BTW I've successfully made my own bloom shader. Here's the screenshot. Very Happy




Thank you!

Cheers,
Bawenang

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




Attachments:
http://forum.openscenegraph.org//files/glow2_129.jpg
http://forum.openscenegraph.org//files/glow_139.jpg


_______________________________________________
osg-users mailing list
(
Only registered users can see emails on this board!
Get registred or enter the forums!
)
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


------------------
Post generated by Mail2Forum
Back to top
Mahendra G.R
Guest





PostPosted: Tue Feb 22, 2011 1:12 pm    Post subject:
Shader again.
Reply with quote

Hi Bawenang,

Did you manage to load a model by anychance, and get the material properites (for example color) without changing the shaders?, it would really help me.


Thanks,
Regards

On Tue, Feb 22, 2011 at 2:07 PM, Kim Bale < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)> wrote:
Quote:
Hi Bawenang,

To my knowledge all the shaders work correctly.


Can you be more specific?


Regards,


Kim.




On 22 February 2011 13:04, Bawenang Rukmoko < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)> wrote:
Quote:
Hi,

I seem to stumbled a lot on osgOcean's shaders. I've got lots of graphics artefacts because of them. Can you point me to the ones that are actually working on them? I may need to disturb them a bit with my questions. Thanks. Oh yea BTW I've successfully made my own bloom shader. Here's the screenshot. Very Happy




Thank you!

Cheers,
Bawenang

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




Attachments:
http://forum.openscenegraph.org//files/glow2_129.jpg
http://forum.openscenegraph.org//files/glow_139.jpg


_______________________________________________
osg-users mailing list
(
Only registered users can see emails on this board!
Get registred or enter the forums!
)
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org






_______________________________________________
osg-users mailing list
(
Only registered users can see emails on this board!
Get registred or enter the forums!
)
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org




--
http://www.mahendragr.com

------------------
Post generated by Mail2Forum
Back to top
benang
User


Joined: 31 Jan 2011
Posts: 21

PostPosted: Wed Feb 23, 2011 10:38 am    Post subject:
Reply with quote

Hi,

@Kim:

Well for starter, I can't render a more complex model if I enabled glare. First I was successful in rendering the smiley ball. But then I tried with a much larger model but it wasn't rendered if I activated the glare, although it can definitely be loaded. But if I deactivate it, the model can be rendered.

Secondly, I am actually using Delta 3D but seeing that it is actually built on top of OSG, it's actually the same thing, right? I attached the camera on one of the nodes of a model (a ship) and it will also display a part of the front of the ship (like an FPS game that will render a part of the character's weapon). But another artefact appears. The front of the ship is often culled and can actually disappear from time to time. So I tried disabling the near/far calculation from the camera with setComputeNearFarMode() set to "osg::CullSettings::DO_NOT_COMPUTE_NEAR_FAR". It worked if the glare (again) is disabled. If it isn't then the screen would be all black. If it is disabled, another artefact came up though. While the player's ship is not culled, the ship or other objects lightings will be screwed. The objects will occasionally flashes (like their material properties have been changed or so), and the lighting is so messed up. I'll put the screenshot here for your pleasure.

@Mahendra

What do you mean? For the glow shader? The glow shader I am using are actually based on the article on nvidia's website here: http://http.developer.nvidia.com/GPUGems/gpugems_ch21.html. The actual algorithm is the shader would glow the area with an alpha of below 1.0f. Now when I looked at the glare shader, it was actually pretty much the same but the parameter is the other way around. The alpha value between _glareThreshold and 1.0f would be glared and the rest is not. So I used the alpha of between 0.0f - 0.1f for my glow parameter.

If you want to get the material properties, you can use your own shader and render it to texture so you can isolate the model using a parameter (for me it is the alpha channel). I don't know how else besides using shaders.

Oh yea, I would like to say thanks to the osgOcean's devs because you've made my life easier by making the RTT and downsampling methods so I won't have to make them myself. Very Happy

Thank you!

Cheers,
Bawenang
Back to top
View user's profile Send private message
benang
User


Joined: 31 Jan 2011
Posts: 21

PostPosted: Thu Feb 24, 2011 11:15 am    Post subject:
Reply with quote

Hi,

I've tried meddling around and put "camera->setComputeNearFarMode(osg::CullSettings::DO_NOT_COMPUTE_NEAR_FAR);" on both the cameras of "OceanScene::renderToTexturePass()" and "OceanScene::glareCombinerPass()".

The results are:
1. If I put it on the RTT method, it will cause the glare to be disabled and no glare rendered.
2. If I put it on the glareCombinerPass method, the screen would turn black like the one I experienced.
3. Furthermore, I think I know what causes the models' (ships in this case) color to be changed erratically if the camera angle is changed. I think it is because of the above water fog's calculation that has gone wrong if I use "camera->setComputeNearFarMode(osg::CullSettings::DO_NOT_COMPUTE_NEAR_FAR);"

So now I've got a situation here. If I don't use "camera->setComputeNearFarMode(osg::CullSettings::DO_NOT_COMPUTE_NEAR_FAR);", the front of the ship will be culled and displays wrongly. But if do, the whole shaders from osgOcean will be corrupted. Any other idea to solve this guys? I'm so lost right now. Sad


Thank you!

Fare Thee Well,
Bawenang
Back to top
View user's profile Send private message
benang
User


Joined: 31 Jan 2011
Posts: 21

PostPosted: Mon Feb 28, 2011 6:25 am    Post subject:
Reply with quote

No reply yet? I guess I've got to do this the hard way, researching them myself. Sad

Thanks anyway guys.

Thank you!

Cheers,
Bawenang

_________________
"There's no place like 127.0.0.1"
Back to top
View user's profile Send private message
Kim Bale
Guest





PostPosted: Tue Mar 01, 2011 9:27 am    Post subject:
Shader again.
Reply with quote

Hi Bawenang,

You should need to use osg::CullSettings::DO_NOT_COMPUTE_NEAR_FAR.


I'm not familiar with Delta3D but last time I heard about the osgOcean actor that was generated for it, it was using osgOcean 1.0. The version in the trunk now contains quite a few changes.


The glare RTT camera simply takes the view and projection matrices from the main camera, so it shouldn't be behave any differently from your main camera. The glare is then rendered as a post render in a full screen quad.


You can see an example of how to include additional elements into the scene in the OceanExample exe, take a look at the terrain and examine the shader that is attached to it. The shader shows you how to deal with the glare passes. Note: the version in the trunk is best for this.


Regards,


Kim.


On 28 February 2011 06:25, Bawenang Rukmoko < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)> wrote:
Quote:
No reply yet? I guess I've got to do this the hard way, researching them myself. Sad

Thanks anyway guys.

Thank you!

Cheers,
Bawenang

------------------------
&quot;There's no place like 127.0.0.1&quot;

------------------
Read this topic online here:

http://forum.openscenegraph.org/viewtopic.php?p=37165#37165






_______________________________________________
osg-users mailing list
(
Only registered users can see emails on this board!
Get registred or enter the forums!
)
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org




------------------
Post generated by Mail2Forum
Back to top
Kim Bale
Guest





PostPosted: Tue Mar 01, 2011 9:28 am    Post subject:
Shader again.
Reply with quote

You should need to use osg::CullSettings::DO_NOT_COMPUTE_NEAR_FAR.

*shouldn't 


K.

On 28 February 2011 06:25, Bawenang Rukmoko < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)> wrote:
Quote:
No reply yet? I guess I've got to do this the hard way, researching them myself. Sad

Thanks anyway guys.

Thank you!

Cheers,
Bawenang

------------------------
&quot;There's no place like 127.0.0.1&quot;

------------------
Read this topic online here:

http://forum.openscenegraph.org/viewtopic.php?p=37165#37165






_______________________________________________
osg-users mailing list
(
Only registered users can see emails on this board!
Get registred or enter the forums!
)
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org




------------------
Post generated by Mail2Forum
Back to top
benang
User


Joined: 31 Jan 2011
Posts: 21

PostPosted: Wed Mar 02, 2011 4:14 am    Post subject:
Re: Shader again.
Reply with quote

Thanks for the reply.

Well I know I shouldn't and I wouldn't if I don't have this artefact of the culled tip of the ship. I noticed that you're replying as a guest, not a member of this forum, so I'm not sure that you can see all of my screenshots that I've put here. If not, then I'll give you an illustration.

Imagine a quake clone game. You've got a part of the weapon's model visible at the bottom of the screen, near the HUD, that will also move along with your first person camera. Now, in my application, that weapon will be culled and won't be rendered perfectly, even invisible at times, based on that camera's (and model along with it) translation and rotation. Now if I disabled near / far computation, the screen turns blank because the glare shader is also enabled. If I disable both the near / far computation and the glare shader, the scene seemed normal and right. However there's another artefact. The above water fog isn't implemented correctly. Even when there are two objects with the same distance with the camera, one of them can be rendered as if it's inside a fog and one of them is not.

As for the missing model if I enabled glare, I've found the answer. It seems like osgOcean hates targa. One of my model's textures is a targa image file and that's why it wasn't rendered. When I changed it to a jpg, it worked just fine. Maybe you should put this as a warning somewhere in the documentation or such.

Thanks again.

Kim Bale wrote:
You should need to use osg::CullSettings::DO_NOT_COMPUTE_NEAR_FAR.

*shouldn't 


K.

On 28 February 2011 06:25, Bawenang Rukmoko < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)> wrote:
Quote:
No reply yet? I guess I've got to do this the hard way, researching them myself. Sad

Thanks anyway guys.

Thank you!

Cheers,
Bawenang

------------------------
&quot;There's no place like 127.0.0.1&quot;

------------------
Read this topic online here:

http://forum.openscenegraph.org/viewtopic.php?p=37165#37165






_______________________________________________
osg-users mailing list
(
Only registered users can see emails on this board!
Get registred or enter the forums!
)
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org




------------------
Post generated by Mail2Forum

_________________
"There's no place like 127.0.0.1"


Last edited by benang on Wed Mar 02, 2011 3:45 pm; edited 1 time in total
Back to top
View user's profile Send private message
benang
User


Joined: 31 Jan 2011
Posts: 21

PostPosted: Wed Mar 02, 2011 10:50 am    Post subject:
Reply with quote

Hi,

Ok, after many googling (and stumbling around aimlessly) I've found a similar situation (and a revelation): http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/2008-April/009746.html

So I think I'll try that one suggestion. Adding another camera pass that will only render the tip of my ship (which will have the osg::CullSettings::DO_NOT_COMPUTE_NEAR_FAR settings) and merge it with the scene. Wish me luck. Smile

PS: Should I also put my code here? It's pretty situational though.

Thank you!

Cheers,
Bawenang

_________________
"There's no place like 127.0.0.1"
Back to top
View user's profile Send private message
benang
User


Joined: 31 Jan 2011
Posts: 21

PostPosted: Wed Mar 02, 2011 11:16 am    Post subject:
Re: Shader again.
Reply with quote

EDIT: I accidentally clicked quote instead of edit. Ignore this if you will.

_________________
"There's no place like 127.0.0.1"
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> osgOcean [osgOcean] All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

Similar Topics
Topic Author Forum Replies Posted
No new posts draw primitive sets and geometry shad... wernerM General 0 Wed May 24, 2017 3:20 pm View latest post
No new posts passing material properties to shader... gpantar General [forum] 3 Mon May 15, 2017 1:17 pm View latest post
No new posts Scale problem while transforming obje... YuraIU02 General 1 Sat Apr 15, 2017 4:26 pm View latest post
No new posts shader 崔 献军 General 1 Fri Apr 07, 2017 1:55 am View latest post
No new posts Merge Shader::Program from differents... Paradox General 1 Tue Feb 28, 2017 3:53 pm View latest post


Board Security Anti Bot Question MOD - phpBB MOD against Spam Bots
Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP