z sorting

Software: Away3D 4.x

iridefix, Newbie
Posted: 24 September 2011 01:00 PM   Total Posts: 4

Hi,

I’m working on a page flip application with the latest away3d. Unfortunately I have some trouble with the z sorting. Since there is no backmaterial like in Away3d 3, I now have two planes for one sheet with one plane rotated by 180 degrees. During the flip/bend animation, when the backplane heads over the frontplane, I get the wrong z sorting, since I see the frontplane in front of the backplane. In Away3d 3 there was something like CORRECT_Z_ORDER. Is something similar avaible now? I have solved the problem to some degree, by changing the order by which the planes are added the the scene, but it only works sometimes and is someway arbitrary. Any Suggestions?

Thanks in advance

   

Richard Olsson, Administrator
Posted: 24 September 2011 02:06 PM   Total Posts: 1192   [ # 1 ]

This should absolutely not happen if you are using Away3D 4.0. First of all everything is sorted properly on the GPU, so there should never be sorting issues. Second, if you are using planes that are not two-sided, they will be invisible when you look at them from behind, so if the front page is facing away you should not be able to see it.

Can you upload your application somewhere for us to see the problem?

   

iridefix, Newbie
Posted: 24 September 2011 09:33 PM   Total Posts: 4   [ # 2 ]

I can see the backplane where it is not hidden by the frontplane. Here pageflip you can see it. Paging up works just fine, paging down not confused. Sorry for the low framerate, but using the progress slider should help seeing the problem.

   

Richard Olsson, Administrator
Posted: 24 September 2011 09:41 PM   Total Posts: 1192   [ # 3 ]

I see. This is not a z-sorting issue. Looks to be a problem with your normals. You are obviously re-shaping the mesh. When you do so, are you just moving the vertices, or do you make sure to rotate the normals as well? Also, have you tried looking at the book from another angle? If you try to move the camera around a bit, it might be easier to spot what the problem is, because it is likely related to the normals or the winding of the faces.

   

iridefix, Newbie
Posted: 26 September 2011 08:55 AM   Total Posts: 4   [ # 4 ]

I might have guessed. Right now, I’m just moving the vertices and rotating the planes. I was assuming the normals would be updated automatically. Now I see you can set autoDeriveVertexNormals and autoDeriveVertexTangents to true. But there is nothing similar for faceNormals. Is there another way to derive normal data from geometry or is it my task to do so manually?

   

Richard Olsson, Administrator
Posted: 26 September 2011 08:58 AM   Total Posts: 1192   [ # 5 ]

There is no such thing as “face normals” in the world of Stage3D and hence the world of Away3D. smile The only way to store normals so that they can be available to the shaders is to upload them as “vertex attributes”, which is essentially coupling them with the vertices. Hence, face normals make little sense, and instead you should be focusing solely on vertex normals.

   

iridefix, Newbie
Posted: 06 October 2011 08:27 AM   Total Posts: 4   [ # 6 ]

Yesterday I had some time to look into this. Face normals are usually used to calculate vertex normals, aren’t they? Looks likes _faceNormalsData in SubGeometry is just used this way, please correct me if I’m wrong. The vertex normals looks fine (pageflip_normals) I guess. It’s quite mysterious that there is no error when flipping backward.

   

Avatar
TheSillyOne, Newbie
Posted: 31 October 2011 03:32 PM   Total Posts: 28   [ # 7 ]

(Backface) Culling is done via winding order, not normals. Normals are only used for lighting etc. A mesh can have no normals and still be correctly culled. wink

This looks like a bug in the application.

EDIT: Are you using blending / transparency of some sort? Like for the text on the pages? It seems it’s only the text part that doesn’t render correctly, but it doesn’t look like a culling problem.

Best regards.

   

readingebook, Newbie
Posted: 13 August 2012 07:03 AM   Total Posts: 1   [ # 8 ]

I have made a page flipping file (http://bit.ly/K5bn5j ) and it goes in this way. So what do you mean the sorting? I never come across this kind of problem.

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X