Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

11991 Posts in 1587 Topics- by 3508 Members - Latest Member: PienueDut

26. May 2012, 09:12:09 am
Xith3D CommunityGeneral CategorySupport (Moderator: Marvin Fröhlich)Rendering Ontop of Everything
Pages: [1]
Print
Author Topic: Rendering Ontop of Everything  (Read 1387 times)
Patheros
Getting respectable
***
Offline Offline

Posts: 267


Dead Dolphin


View Profile WWW Email
« on: 02. February 2007, 11:05:52 pm »

I've got a Foreground node that I'm attaching things to (TextRectangles right now)

I've set the CameraMode to FIXED, but the other objects can still get rendered ontop of the text. Is there a way to ensure that the text (being rendered last since its in a Foreground node) is always rendered ontop of things.

I've tried the following code with no avail:
Code:
text.getAppearance().getRenderingAttributes().setDepthBufferEnable(false);
text.getAppearance().getRenderingAttributes().setDepthBufferWriteEnable(false);
text.getAppearance().getRenderingAttributes().setDepthTestFunction(RenderingAttributes.ALWAYS);
Logged

"I like my method, what was my method again?" - Jon
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« Reply #1 on: 02. February 2007, 11:51:04 pm »

Use multiple RenderPasses.

I assume, you have an instance of Xith3DEnvironment (env) and that you want to render the TextRectangle in parallel projection.

Code:
RenderPass persPass = env.addPerspectiveRenderPass();
RenderPass paraPass = env.addParallelRenderPass();

persPass.getBranchGroup().addChild( createScene() );
paraPass.getBranchGroup().addChild( createTextRectangleInFixedForegroud() );

The RenderPasses are rendered in the order, they are added to the SceneGraph (the Xith3DEnvironment). And by default they are rendered in "layered mode". This means, the second RenderPass overpaints the first one.

But make sure, you are not doing, what is already done in the HUD. Do you know the HUD?

Marvin
« Last Edit: 02. February 2007, 11:58:41 pm by Marvin Fröhlich » Logged
Patheros
Getting respectable
***
Offline Offline

Posts: 267


Dead Dolphin


View Profile WWW Email
« Reply #2 on: 04. February 2007, 07:21:04 pm »

Thanks.

Yes I probably can use the HUD for this. However the one thing I'm not sure it does is allow me to render LineArray (or other Node) onto the HUD. If I just set the HUD's group with setGroup(Group group) and add the Nodes I want to the group, it doesn't seem to render on top.
Logged

"I like my method, what was my method again?" - Jon
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« Reply #3 on: 04. February 2007, 07:36:09 pm »

Thanks.

Yes I probably can use the HUD for this. However the one thing I'm not sure it does is allow me to render LineArray (or other Node) onto the HUD. If I just set the HUD's group with setGroup(Group group) and add the Nodes I want to the group, it doesn't seem to render on top.

Never modify the HUD's Group! I will see, if I can even block this. It will lead to unpredictable behaviour.

I don't know, if this does what you want, but you could create a third RenderPass and define its Viewport to the same coordinates, you have a Widget at. Then put the LineArray into this third RenderPass'es BranchGroup.

But be aware, that I have added the Viewport feature about a week ago. So it won't be available in the beta1.

Is this, what you need?

Marvin
Logged
Patheros
Getting respectable
***
Offline Offline

Posts: 267


Dead Dolphin


View Profile WWW Email
« Reply #4 on: 05. February 2007, 06:30:48 am »

Sounds like it would do what I need it to do. When I get a chance I'll see if I can actually get it to work. Thanks.
Logged

"I like my method, what was my method again?" - Jon
Patheros
Getting respectable
***
Offline Offline

Posts: 267


Dead Dolphin


View Profile WWW Email
« Reply #5 on: 05. February 2007, 10:15:00 pm »

I assume, you have an instance of Xith3DEnvironment (env)

This actually isn't the case. (at some point down the road I might change that)

So instead I do this:

Quote
      universe.addLocale(locale);
      
      root = new BranchGroupControl();
      locale.addBranchGraph(root);
      
      hudRoot = new BranchGroupControl();
      locale.addBranchGraph(hudRoot);
      
      RenderPassConfig passConfig = new RenderPassConfig( RenderPassConfigProvider.PERSPECTIVE_PROJECTION );
      passConfig.setBackClipDistance(64000f);
      RenderPass renderPass = new RenderPass(root, passConfig);
      universe.getRenderer().addRenderPass( renderPass );
      
      RenderPassConfig hudPassConfig = new RenderPassConfig( RenderPassConfigProvider.PERSPECTIVE_PROJECTION );
      hudPassConfig.setProjectionPolicy(RenderPassConfig.PARALLEL_PROJECTION);
      hudPassConfig.setScreenScale(1f);
      RenderPass hudRenderPass = new RenderPass(hudRoot, hudPassConfig);
      universe.getRenderer().addRenderPass( hudRenderPass );

The problem is the second render pass disappears as soon as the view changes. Does anyone have any thoughts as to why this my occur?
Logged

"I like my method, what was my method again?" - Jon
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« Reply #6 on: 05. February 2007, 11:09:52 pm »

The problem is the second render pass disappears as soon as the view changes. Does anyone have any thoughts as to why this my occur?

Try this for the HUD:
Code:
locale.addBranchGraph( hud.getRenderPass().getBranchGroup() );
universe.getRenderer().addRenderPass( hud.getRenderPass() );

Marvin
Logged
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic