Z-fighting/clipping issue with plotting objects on a globe (sphere)

View: New views
4 Messages — Rating Filter:   Alert me  

Z-fighting/clipping issue with plotting objects on a globe (sphere)

by Aaron Meyers-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,

I am starting work on a project where objects will be plotted on the earth. I've put together a quick test and found that when i position objects around a sphere, I have some clipping problems with the polygons of these objects. I put together an example to show what I'm talking about:


You can click to change from plotting planes to cubes. I've actually offset the planes a bit away from the radius of the sphere, but the clipping problem is still pretty severe. I once encountered something similar in an OpenGL project and it turned out to be z-fighting and after adjusting the near clip and far clip distance on my projection matrix, it was fine. I suspect something like this might be the cause of my problem, but I don't really understand the inner workings of the Papervision3D transformation pipeline.

Does anyone know how to get around this? Any tips? Thanks for any help.

-Aaron

_______________________________________________
Papervision3D mailing list
Papervision3D@...
http://osflash.org/mailman/listinfo/papervision3d_osflash.org

Re: Z-fighting/clipping issue with plotting objects on a globe (sphere)

by Paul Tondeur :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Aaron,

The sorting on your globe can perfectly solved with viewportLayers. The globe can be rendered at layer 1 and the planes at layer 2, so they will appear always on top.

An example implementation of this looks as follows:

var globe:Sphere = new Sphere();
scene.addChild(sphere);

var plane:Plane = new Plane();
scene.addChild(plane);

var globeLayer:ViewportLayer = viewport.getChildLayer(globe);
var planeLayer:ViewportLayer = viewport.getChildLayer(plane);
globeLayer.layerIndex = 1;
planeLayer.layerIndex = 2;
viewport.containerSprite.sortMode = ViewportLayerSortMode.INDEX_SORT;

This is just one of the ways you can use viewport layers. I hope this helps.

Paul

On Jul 3, 2009, at 12:18 AM, Aaron Meyers wrote:

Hello,

I am starting work on a project where objects will be plotted on the earth. I've put together a quick test and found that when i position objects around a sphere, I have some clipping problems with the polygons of these objects. I put together an example to show what I'm talking about:


You can click to change from plotting planes to cubes. I've actually offset the planes a bit away from the radius of the sphere, but the clipping problem is still pretty severe. I once encountered something similar in an OpenGL project and it turned out to be z-fighting and after adjusting the near clip and far clip distance on my projection matrix, it was fine. I suspect something like this might be the cause of my problem, but I don't really understand the inner workings of the Papervision3D transformation pipeline.

Does anyone know how to get around this? Any tips? Thanks for any help.

-Aaron
_______________________________________________
Papervision3D mailing list
Papervision3D@...
http://osflash.org/mailman/listinfo/papervision3d_osflash.org


_______________________________________________
Papervision3D mailing list
Papervision3D@...
http://osflash.org/mailman/listinfo/papervision3d_osflash.org

Viewport layer sorting problem

by jmerrill_2001 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

I’m having a problem sorting some viewport layers.  Two of the layers in the code below, menuPlaneLayer and gameBoardLayer sort fine, but the one that contains the Collada file (gameComponentsLayer) does not – it appears behind everything.  What am I doing wrong?

 

var testColladaMaterialsList:MaterialsList = new MaterialsList();

testColladaMaterialsList.addMaterial ( new ColorMaterial ( 0xD3C8AD), "ERDefaultMaterial"); 

var testCollada:Collada = new Collada("assets/componentmodels/testmodel1/testmodel1.dae", testColladaMaterialsList);

testCollada.rotationX = -90;

testCollada.z = -100;

_gameComponents.addChild(testCollada);

 

//Create gameboard plane

var planeMaterial:ColorMaterial = new ColorMaterial(0x);

planeMaterial.doubleSided = true;

_gameboard = new Plane(planeMaterial, 500, 400, 3, 3);

_gameboard.addChild(_gameComponents);

_gameboard.rotationX = 70;

 

//separate and sort layers for proper clipping:

var menuPlaneLayer:ViewportLayer = _viewport.getChildLayer(_menuPlane);

var gameboardLayer:ViewportLayer = _viewport.getChildLayer(_gameboard);

var gameComponentsLayer:ViewportLayer = _viewport.getChildLayer(_gameComponents);

menuPlaneLayer.layerIndex = 1;

gameboardLayer.layerIndex = 2;

gameComponentsLayer.layerIndex = 3;

_viewport.containerSprite.sortMode = ViewportLayerSortMode.INDEX_SORT;

 

_scene.addChild(_gameboard);

 

Thanks for any advice,

 

Jason Merrill

Bank of  America smallLogo  Global Learning

Shared Services Solutions Development


Monthly meetings on the Adobe Flash platform for rich media experiences - join the Bank of America Flash Platform Community

 

 



_______________________________________________
Papervision3D mailing list
Papervision3D@...
http://osflash.org/mailman/listinfo/papervision3d_osflash.org

Re: Viewport layer sorting problem

by jmerrill_2001 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

Nevermind, I figured it out.  I wasn’t waiting for the Collada file to fully load before assigning it to a layer.  I did some further googling and found this post:

 

http://www.nabble.com/--Viewport-layers,-Colladas,-and-z-fighting-td19716296.html

 

 

 

Jason Merrill

Bank of  America smallLogo  Global Learning

Shared Services Solutions Development


Monthly meetings on the Adobe Flash platform for rich media experiences - join the Bank of America Flash Platform Community

 

 

 

 

From: Merrill, Jason
Sent: Friday, July 03, 2009 7:19 AM
To: 'papervision3d@...'
Subject: Viewport layer sorting problem

 

I’m having a problem sorting some viewport layers.  Two of the layers in the code below, menuPlaneLayer and gameBoardLayer sort fine, but the one that contains the Collada file (gameComponentsLayer) does not – it appears behind everything.  What am I doing wrong?

 

var testColladaMaterialsList:MaterialsList = new MaterialsList();

testColladaMaterialsList.addMaterial ( new ColorMaterial ( 0xD3C8AD), "ERDefaultMaterial"); 

var testCollada:Collada = new Collada("assets/componentmodels/testmodel1/testmodel1.dae", testColladaMaterialsList);

testCollada.rotationX = -90;

testCollada.z = -100;

_gameComponents.addChild(testCollada);

 

//Create gameboard plane

var planeMaterial:ColorMaterial = new ColorMaterial(0x);

planeMaterial.doubleSided = true;

_gameboard = new Plane(planeMaterial, 500, 400, 3, 3);

_gameboard.addChild(_gameComponents);

_gameboard.rotationX = 70;

 

//separate and sort layers for proper clipping:

var menuPlaneLayer:ViewportLayer = _viewport.getChildLayer(_menuPlane);

var gameboardLayer:ViewportLayer = _viewport.getChildLayer(_gameboard);

var gameComponentsLayer:ViewportLayer = _viewport.getChildLayer(_gameComponents);

menuPlaneLayer.layerIndex = 1;

gameboardLayer.layerIndex = 2;

gameComponentsLayer.layerIndex = 3;

_viewport.containerSprite.sortMode = ViewportLayerSortMode.INDEX_SORT;

 

_scene.addChild(_gameboard);

 

Thanks for any advice,

 

Jason Merrill

Bank of  America smallLogo  Global Learning

Shared Services Solutions Development


Monthly meetings on the Adobe Flash platform for rich media experiences - join the Bank of America Flash Platform Community

 

 



_______________________________________________
Papervision3D mailing list
Papervision3D@...
http://osflash.org/mailman/listinfo/papervision3d_osflash.org