Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

11992 Posts in 1588 Topics- by 3509 Members - Latest Member: fishigon

26. May 2012, 04:13:25 pm
Xith3D CommunityGeneral CategorySupport (Moderator: Marvin Fröhlich)Rendering edges, layering passes
Pages: 1 [2]
Print
Author Topic: Rendering edges, layering passes  (Read 1058 times)
ChrisE
Becoming dependent
**
Offline Offline

Posts: 104


View Profile
« Reply #15 on: 04. January 2011, 10:50:01 pm »

The fun never stops.

So, it seems that layering (at least as discussed as above) does not work.

Code:
RenderPassConfig rpc;
RenderPass rp;
SkySphere ss;

ss = myXith.this.createSkySphere();
ss.setLayeredModeForced(false);
ss.setUnlayeredModeForced(true);
myXith.this.xithEnv.addRenderPass(ss);

rpc = new BaseRenderPassConfig(org.xith3d.render.RenderPassConfig.DEFAULT_CAMERA_MODE);
rp = new RenderPass(myXith.this.groundBranchGroup, rpc);
rp.setLayeredModeForced(true);
rp.setUnlayeredModeForced(false);
myXith.this.xithEnv.addRenderPass(rp);

rpc = new BaseRenderPassConfig(org.xith3d.render.RenderPassConfig.DEFAULT_CAMERA_MODE);
rp = new RenderPass(myXith.this.geomBranchGroup, rpc);
rp.setLayeredModeForced(true);
rp.setUnlayeredModeForced(false);
myXith.this.xithEnv.addRenderPass(rp);

This still fails to Z-sort correctly, regardless of which combination of setLayered and setUnlayered I use (and I've tried all 8, I believe). I've also tried setting the renderer to use layering and to not use layering, and still no dice.

The results of the above, by the way, are a sky sphere in the background, as desired. In front of that is a large flat green plane I use for the ground, and then my foreground geometry always in front of the both the plane and the sphere, even when it should nominally be behind the ground plane (e.g., seen from below ground it should be occluded).

I'm unsure, but do we know for certain that this code works? There don't appear to be any unit-tests/samples in the SDK.
Logged
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« Reply #16 on: 05. January 2011, 01:34:52 pm »

For me it works. Note, that layered mode is the default. So, if you add two branch graphs / render passes, the second one will always be in front, no matter how far away from the camera they are. If you force unlayered mode on the second render pass (on the first one it won't have any effect), the two passes will be sorted (z-buffered) as if they were one big group.

If you always want something in front, you just need to put it into a separate branch graph / render pass, that is added to the scenegraph last and just use the defaults.

Marvin
Logged
ChrisE
Becoming dependent
**
Offline Offline

Posts: 104


View Profile
« Reply #17 on: 05. January 2011, 04:37:01 pm »

So, here's where that code is used:

Code:
// if we're in layered mode, we need to clear the depth buffer.
            if ( ( layeredMode && !renderPass.isUnlayeredModeForced() ) || ( !layeredMode && renderPass.isLayeredModeForced() ) )
            {
                if ( rpIndex > 0 )
                    gl.glClear( GL.GL_DEPTH_BUFFER_BIT );
            }
(RenderPeerImpl.java, line 799)

To the best of my knowledge, that's the only place we use those two functions and the layeredMode variable. So, why don't we just us a setLayeredForced() and isLayeredForced(), instead of also including the unlayered options?

EDIT: Works now. Thanks!
« Last Edit: 05. January 2011, 05:02:44 pm by ChrisE » Logged
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« Reply #18 on: 06. January 2011, 02:54:37 pm »

Because you can change the default Wink.
Logged
ChrisE
Becoming dependent
**
Offline Offline

Posts: 104


View Profile
« Reply #19 on: 06. January 2011, 05:08:35 pm »

Ah, aye, that'd do it. Smiley
Logged
Pages: 1 [2]
Print
Jump to:  

Theme orange-lt created by panic