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 

RenderBin vs. SlaveCamera


 
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General
View previous topic :: View next topic  
Author Message
wernerM
User


Joined: 06 Feb 2013
Posts: 65

PostPosted: Thu Aug 03, 2017 10:00 am    Post subject:
RenderBin vs. SlaveCamera
Reply with quote

Hi all,

I'm restructuring my project because I want to implement some multi pass
effects.
I have some problems understanding the different approaches for example when
creating HUD displays.
The approach I used so far is attaching a SlaveCamera and puttung it in
PostRender pass.
On the other hand I found an approach of just attaching the matrices to
the root node and
assigning the HUD geometry to a RenderBin with high number.

I'd like to understand the difference of the approaches and the pros and
cons.

Is there any one who can help me with that?

Thanks

- Werner -



------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
tianzjyh
Guest





PostPosted: Fri Aug 04, 2017 1:10 am    Post subject:
RenderBin vs. SlaveCamera
Reply with quote

hi Modenbach,
My approach is to use a separate camera(not a slave camera) different with the main camera, and add it to the root node.
In my opinion, there is little difference between these different approaches, since they will all be treated as elements in scene graph and state graph.
But I am a little confused about your using slave camera. Is not slave camera share the same scene with the main camera ? How do you assign different scenes in you HUD display ?




--




Cheers,
---
TianZJ




Quote:
At 2017-08-03 17:59:41, "Werner Modenbach" <> wrote:
Quote:
Hi all,

I'm restructuring my project because I want to implement some multi pass
effects.
I have some problems understanding the different approaches for example when
creating HUD displays.
The approach I used so far is attaching a SlaveCamera and puttung it in
PostRender pass.
On the other hand I found an approach of just attaching the matrices to
the root node and
assigning the HUD geometry to a RenderBin with high number.

I'd like to understand the difference of the approaches and the pros and
cons.

Is there any one who can help me with that?

Thanks

- Werner -




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


Joined: 26 Jan 2017
Posts: 60

PostPosted: Mon Aug 07, 2017 8:21 am    Post subject:
Reply with quote

Hi,

I can help you a little with this.

I personally use a very simple copy shader and a fullscreen quad. Here's an example.

Code:

// camera setup is a bit crowded, but involves render target implementation set to frame_buffer_object, no culling, render order set to PRE, and a ortho2d(w,h) projection matrix.
camera = new Camera()

// we also make and attach a new new Texture2D here
camera->attach( Camera::COLOR_BUFFER, texture.get(), 0, 0, false, 0, 0 );

ref_ptr<Geometry> quad;
quad = createTexturedQuadGeometry(Vec3(), Vec3(Width, 0.0, 0.0), Vec3(0.0, Height, 0.0));

ref_ptr<Geode> geode = new Geode;
geode->addDrawable( quad.get() );

auto ss = geode->getOrCreateStateSet();

ss->setAttributeAndModes( shader->program, StateAttribute::ON );

camera->addChild( geode.get() );

gViewer->addSlave( camera, false );


I called this class RTT .h/.cpp, since I use this as a render-to-texture kind of concept.

You can later simply use the texture for anything you want.

This is reliable and fast, and I use it for a multi-pass eye adaptation shader.

Thank you!

Cheers,
Johny
Back to top
View user's profile Send private message
SMesserschmidt (Sebastian Messerschmidt)
Forum Moderator


Joined: 10 Sep 2013
Posts: 794

PostPosted: Mon Aug 07, 2017 8:34 am    Post subject:
RenderBin vs. SlaveCamera
Reply with quote

Hi Werner,

I'm using slave cameras only for certain multi-channel setups where I
need multiple viewports rendering the same content with different
frusta. For multipass applications (and I simply consider HUD to be a
separate pass) I always use normal cameras (with absolute reference
frame for fullscreen passes and relative for composing passes).

You can assign an explicit number to the camera order by using.

camera->setRenderOrder(osg::Camera::PRE_RENDER, pass_number);

I use the PRE_RENDER scheme, since all passes of my offscreen rendering
need to complete before the output is presented. Given your scenario you
could of course simply set the render order of your HUD camera to
something high.

Setting up rendering order with the Geometry RenderBin seems akward,
since the HUD geometry is supposed to be rendered by the HUD-camera
only. So a slave camera might not be the best option (apart from the
fact, that the HUD is supposed to have its own projection and
transform-matrix).

hth
Sebastian

Quote:
Hi all,

I'm restructuring my project because I want to implement some multi pass
effects.
I have some problems understanding the different approaches for example
when
creating HUD displays.
The approach I used so far is attaching a SlaveCamera and puttung it in
PostRender pass.
On the other hand I found an approach of just attaching the matrices to
the root node and
assigning the HUD geometry to a RenderBin with high number.

I'd like to understand the difference of the approaches and the pros and
cons.

Is there any one who can help me with that?

Thanks

- Werner -




------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General 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 OSG RenderBin reverse order Bruno Oliveira General 0 Mon Nov 07, 2016 2:51 pm View latest post
No new posts Reg: Warning: detected openGL error, ... Nitin Mishra General 2 Mon Apr 20, 2015 5:56 am View latest post
No new posts RenderBin::sortByState does nothing?! mp3butcher General 2 Mon Mar 24, 2014 2:02 pm View latest post
No new posts sorting in renderbin danoo General 1 Mon Feb 03, 2014 9:41 am View latest post
No new posts Per-view RenderBin Aurelien General 3 Tue Jun 25, 2013 4:00 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