Game Development Community

Z sorting problem

by Devin Olsen · in Artist Corner · 01/22/2006 (9:37 pm) · 15 replies

How do I fix this?
Z Sorting Problem

#1
01/25/2006 (1:50 pm)
So no one knows huh?
#2
01/25/2006 (2:39 pm)
Your file does not load.
try using a simple screen shot.
#3
01/25/2006 (3:03 pm)
Screenshots wont cut it, the error happens when the player moves around.

Guess I could try and explain it, when ever I have a single tree on the terrain no z sorting problems occur and looks great, but soon as I take that same tree and replicate it over the terrain the trees flicker against each other.

Again single tree is fine but soon as I add another tree behind it, this flickering/backwards z sort happens from one tree against another.

The flickering looks like the trees are competing against each other for who should be sorted first.
#4
01/25/2006 (3:10 pm)
This is not just a Z sort problem it sound more like an Alpha/Depth sort problem.

there has been much research and work done to fix things like this.
im not 100% sure of all the facilities used in torque to overcome the issue. but I do know that it has been revisited alot.

you can probably search this site for information on the alpha sorting process and what it entails with this engine.

it most certianly will start with modifications during export to inform the engine.
if you have done all that and just not specified it then, your stuck reading doc and searching for already available solutions.

if you havent then you need only find the doc :)
#5
01/25/2006 (3:38 pm)
Alpha Sorting? not to be confused with Z sorting correct?
Because I have studied this tutorial front to back... or shall I say top to bottom :)
Z Sorting Explained

Also I am sure I could find something with in the forums here but might there be some other sites out there that are dedicated to Torque Engine?
#6
01/25/2006 (4:13 pm)
Ok that doc should cover it.
so what method did you use?
SORT ? or hierarchy?

you really need to provide more input if you dont want the simplest answers.
if you have read the doc then you understand most of what I already said.
But I wasnt able to gleen that from any of your posts.
so give more info on what you have done when exporting this model to combat the alpha layer sorting issue's that cause the z buffer to freak out.
#7
01/25/2006 (4:42 pm)
This is strange (watched the video). The tree does look properly sorted either using sort: or hierarchy. Did you use the fxShapeReplicator? Could the fog be causing some clipping weirdness maybe?
#8
01/25/2006 (5:02 pm)
I have gone with the Hierarchy method, and as I stated above the tree alone works awesome and no sorting problems occur in fact I can see ground foliage through the alpha branches just fine.

I have the trees trunk that's got two levels of branches subdivided branches (3) and non sub divided (3).

My lower branches are the ones that have the 3 sub divisions to them and my upper branches have only one protruding straight out from the main trunk.

On my branches I have placed planes of alpha branches evenly over the branches.

There are 12 to 4 alpha planes per branch that I grouped accordingly before doing any Hierarchy attaching.

UpperFront = 4 alpha plans at the end of the subdivided branch.
LowerFront = 4 alpha plans at the end of the subdivided branch.

UpperMiddle = 4 alpha plans at the middle of the subdivided branch.
LowerMiddle = 4 alpha plans at the middle of the subdivided branch.

UpperBack = 4 alpha plans at the back of the subdivided branch.
LowerBack = 4 alpha plans at the back of the subdivided branch.
= One Subdivided Branch

Upper = 4 alpha plans on a non-subdivided branch.
Lower = 4 alpha plans on a non-subdivided branch.
= One Non-subdivided Branch

Total
There are 3 subdivided branches = 36 alpha planes
and 3 non-subdivide branches=12 alpha planes

Comes to 48 alpha planes.

When I came to attaching my pieces together I did a lot of thinking and figured all planes that are uppers need to be attached to our tree trunk first starting from UpperBack and working our way to UpperFronts beings the UpperFronts are going to be sorted over the Upper Backs in most viewings.

I then did the same for the Lowers attaching them from LowerFronts to LowerBack.

So to make a long story short the hierarchy should go Lowers over Uppers (Because Lower are attached after Uppers) and Fronts over Back (Because Fronts are attached after Backs)

I really wish that .wma video would work cause you can see what the problem is I am having clear as day, so soon as I get home I am going to see about ftp up a zip of the video.

Thank you for your help to this point though badguy and really do appreciate it.
#9
01/25/2006 (8:00 pm)
Welcome to torque.


*long discription:
Even if the object is sorted correctly by itself, that still dosnt matter, torque has issues with sorting, and its compunded if you use the same texture. It just dosnt matter what you do. placing the same texture with the same alpha in the same line of sight in the engine does this. Placing the same texture on two difrent objects and then placing them in the engine makes this effect. you need to make sure that the objects are seprated from each other and not able to be seen in a stright line. The only true way to fix this is to eather use a diffrent texture for each and every plane (and make sure the same texture is seprated by some other texture).

This is why most games made with torque have very little use of alphas, or none at all.

Particles, the sun flair, the Fxlight..all of them can be seen right threw objects, unless they are just to far away to be renderd.

It has to be the most frustrating issue in torque.

*Short discription:
Alpha transparencies must never be allowd to see itself. even if its on another object.

/flameshield on!
#10
02/02/2006 (9:58 pm)
I have been doing some more experimenting with this, and upon studying/compiling one of the trees TGE provides, I think I have stumbled onto what might be causing my problem.

Allyn you are correct about using more than one texture for trees foliage, but to have new foliage textures per foliage plane (I assume this is what you're saying) didn't do anything for me.
The TGE tree is only are using two textures for what looks like more than 10 plans of foliage per LOD, but I feel that this is only to give a more robust looks to the over all color the tree foliage gives off.

The TGE tree its self works fine when replicating it like I did with my trees.
The only thing that this TGE tree is doing that I can't seem to pull off is they have the foliage plans and trees trunk are separated into their own meshes that are linked together schematically, not attached into one single mesh.

I have tried to do the same on some of my own trees, but the only result I get is that only one piece of the model or the other shows up in the editor. (Foliage Plans or tree trunk)

If someone knows what might be preventing me from linking separate meshes schematically like the TGE tree, and having all the mesh pieces show up in the editor, I think I might be able to get some of my trees to work as the TGE tree douse.

Thanks again for everyone's help.
#11
02/03/2006 (8:56 am)
This is kinda hard to explain so I put some pictures together to help. Click on the links below.
You need to LINK your shapes together heirarchly. If you don't know how to link use the schematic veiw of 3dsmax to put your part together. Or search Linking in your help files.

You need to break your shape up into peices and name the peices according to the detail level they correspond with. Then link them in the order they need to render.

Model of tree
WireFrame of tree

You the shape is all broke up into peices. The peices are the trunk and the folaige.
This Schematic veiw shows how the peices are linked together.
You can see that each peice is named according to the section it is in and has a corresponding detail number.

The trunk has a non Transperant texture on it and is parented by the Start Node. The Efol100 is on top and parented by the trunk

Dfol100 is the child of Efol100
Cfol100 is the child of Dfol100

You get were I am going. The model has 6 parts and the render from the inner most point out and from top to bottom.

Bfol100 is the child of Cfol100
Afoll100 is the child of Bfol100 and does not have any children. It will render last.
Doesn't sound like you need all that info (but I put it in there anyway) You are having a naming and linking problem. Just look at the naming conventions and how things are linked up according to there place on the shape.

Hope that helps
Matt

PS you could post the model and I'll rig it for example for ya. Its up to you.
#12
02/03/2006 (12:23 pm)
I am sure I have done all the of the above but never the less there is an issue here and its probly me :)

Im at the office right now, so I dont have all my models with me but soon as I get home im going to give it another shot and ill post my model with some screens.
#13
02/03/2006 (5:10 pm)
Well like I said if all else fails you can send me the model or post it and I'll rig it up. Some models are trickier than others.

Matt
#14
02/10/2006 (10:45 am)
I'm having a similar problem with a fairly complex plant. I can't get it to render correctly at all in Torque, part of the problem being that I'm trying to do this with Maya and the documentation for sorting in Maya is pretty sparse.

I exported the object to .OBJ format for use with 3DSMax. Do you think you could take a look at it and see if you can figure out the sorting problem?

Here's the model and texture:
www.metaversalstudios.com/henry/desert_plant.zip

I'm not familiar with 3DSMax so please let me know if something is missing or didn't export correctly.
#15
02/10/2006 (4:18 pm)
I can take a look but the problem with OBJ is it will come in with one shape and your heirarchy will be non existant.

See what I can do..
Matt