[Papervision3D] z-ordering issue
Nikos Chagialas
nikosgroups at gmail.com
Thu Aug 27 08:01:05 PDT 2009
thanks Andy!
2009/8/25 Andy Zupko <azupko at zupko.info>
> There are a couple of ways you could approach this, but probably the
> easiest most sure-fire way is:
> viewport.sortMode = INDEX_SORT;
>
> var cubeLayer:ViewportLayer = new ViewportLayer(null, null);
> viewport.containerSprite.addLayer(cubeLayer);
>
> for(var i=0;i<cubes;i++){
> cubeLayer.addDisplayObject3D(cubes[i]); //where cubes is an array of your
> tall gray rects
>
> //you could also just do cubeLayer.getChildLayer() on each gray cube to
> parent it...
> }
>
> var baseLayer :ViewportLayer = viewport.getChildLayer(redCube);
> baseLayer.layerIndex = 1;
>
>
> function onEnterFrame(){
> if(camera.y > 0)
> cubeLayer.layerIndex = 2;
> else
> cubeLayer.layerIndex = 0;
> }
>
>
> This will swap the 9 gray cubes layer above and below the red cube based on
> camera position. You can obviously tweak this to work with your setup.
>
> Other methods might work and are easier to setup, but this will make it
> work in every situation.
>
> hth!
>
> -andy
>
>
> On Aug 25, 2009, at 6:22 AM, Nikos Chagialas wrote:
>
> z-ordering problems again..
>
> this time I either load a collada file with different objects close to each
> other or I create these objects using pv primitives. Here is an example:
> http://www.devgallery.com/test/pv/
>
> Use ctrl+left mouse to rotate the object around, mousewheel to zoom.
>
> In the scene there is a cube for the base and 9 cubes/columns perpendicular
> to the base, that are located very close to the it. When you rotate the
> object around you see the depth problems appearing and objects overlapping
> each other.
>
> Any ideas how can I fix that? Can the
> viewport.getChildLayer(obj).layerIndex method be used here and how?
>
> Thanks
> nikos
>
> 2009/5/21 Nikos Chagialas <nikosgroups at gmail.com>
>
>> Thanks Paul,
>> I excluded the back-face of the cube and that solved it.
>>
>> I know..I started like that, having a cube and later on I decided that I
>> am gonna use some interactive content so the first thing that came into my
>> mind was to use a plane. I realised it afterwards, but had already done most
>> of the interactive bit..and was a bit lazy too to change it!
>>
>> thanks for your help
>> nikos
>>
>> 2009/5/21 Paul Tondeur <paul at paultondeur.nl>
>>
>> Hi Nikos,
>>> First of all, why don't you add the image and text to one of the sides of
>>> the cube, instead of having the cube and very close in front a plane with
>>> the text and an image. By having the two faces so close to each other, you
>>> are asking for z-sorting issues.
>>>
>>> Beside adding the image as a texture for the back-face of the cube, you
>>> can also mark the back-face of your cube as an excluded face. This can be
>>> achieved by using the last parameter at instantiation of the cube: varcube:cube =
>>> new Cube(mat,500,500,500,1,1,1,0,Cube.BACK);
>>>
>>> ViewportLayers can also be used to solve your issue. Just add the planes
>>> to 1 viewportlayer and leave the cubes as they are. Performance wise this
>>> isn't the best solution, as Papervision3D will first draw the cubes and then
>>> the planes in front. It would be a waste of capacity to first draw the back
>>> face of a cube and then draw the plane above it and never see the cubes
>>> back-face.
>>>
>>> Paul
>>>
>>> On May 21, 2009, at 2:29 PM, Nikos Chagialas wrote:
>>>
>>> Hi,
>>> I know this probably has been talked a lot in the list, but I can't seem
>>> to find any solution.
>>>
>>> I 've got a scene with some floating Panels. Each panel contains a cube
>>> as the basis and a plane for the content (image, text), which is placed -8
>>> pixels in the z axis.
>>>
>>> http://www.devgallery.com/test/pv/1/
>>>
>>> I have used viewport.getChildLayer(obj, true).layerIndex = ++topDepth;
>>> for sorting out the depths on rollover, etc.
>>>
>>> However, even though the content plane is set to have a greater depth
>>> than the cube and also placed in front, a diagonal black line is displayed
>>> in the content-image when animating.
>>>
>>> I have tried useOwnContainer=true but didn't help. If I use it for all
>>> objects it produces the same bug, where if I use it only in the content
>>> plane it fixes the line but breaks the z-ordering.
>>>
>>> Any ideas?
>>>
>>> thanks for your time
>>> nikos
>>>
>>> _______________________________________________
>>> Papervision3D mailing list
>>> Papervision3D at osflash.org
>>> http://osflash.org/mailman/listinfo/papervision3d_osflash.org
>>>
>>>
>>>
>>> _______________________________________________
>>> Papervision3D mailing list
>>> Papervision3D at osflash.org
>>> http://osflash.org/mailman/listinfo/papervision3d_osflash.org
>>>
>>>
>>
> _______________________________________________
> Papervision3D mailing list
> Papervision3D at osflash.org
> http://osflash.org/mailman/listinfo/papervision3d_osflash.org
>
>
>
> _______________________________________________
> Papervision3D mailing list
> Papervision3D at osflash.org
> http://osflash.org/mailman/listinfo/papervision3d_osflash.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://osflash.org/pipermail/papervision3d_osflash.org/attachments/20090827/542833f5/attachment.html>
More information about the Papervision3D
mailing list