Jump to content

what exactly zsort does?


omid3098
 Share

Recommended Posts

wiki says:

zsort:

If set to 1, the surface will be sorted with other z-sorted object in the scene. Sorted objects will be drawn last, from back to front. Use this setting with transparency.

I can't understand what this means.

what are z-sorted objects?

 

the reason I ask is that when I have two animated elements into a single model (key-frame animation), always one of them will animate around another one.

in this picture:

post-50-0-06613300-1350579220.jpg

the front blade should rotate along it's green axis. and the back blade should rotate along its red axis. but when we animate them, the front blade rotates around the back one:

post-50-0-59697600-1350579210.jpg

 

we used separate materials for each one. we even used separate textures(may look silly! but we did it), tried to export separate meshes and then animate them using LUA. we also checked .vert and .frag shaders (we have separate .vert and .frag for each material) but nothing changed.

after we tried almost everything we understood that the problem is because of z-sort=1 in their materials.

and by removing zsort=1 from materials, the problem solved.

 

so. what exactly z-sort does. (please explain in an example)

Omid Saadat

OD Arts Blog

 

AMD Phenom II X4 940 - Geforce 8800GTS - 4GB RAM - XP x86

AMD 6000+ - Geforce 9800 GT - 2GB RAM - XP x86 (Home pc)

Intel Core i7 - Geforce 310M - 4GB Ram - Win7 x64 (Laptop)

Link to comment
Share on other sites

I don't see why z-sort would do that....

 

Are you animating the props with bones or are you just using LE::TurnEntity().. I don't see why z-sort would cause the one to turn around the other if you are using the latter... and I'm not sure why it would do this even with bones.

 

From my very limited understanding z-sorting is all about which objects to draw first so that objects closer to you are drawn on top of objects further away. I would have thought this would only affect the rendering. Then again I don't know a whole deal about the topic so maybe I'm wrong. Can't say I know exactly what z-sort = 1 in the material does have only used it a few times and for what I can't remember lol.

STS - Scarlet Thread Studios

AKA: Engineer Ken

 

Fact: Game Development is hard... very bloody hard.. If you are not prepared to accept that.. Please give up now!

Link to comment
Share on other sites

It is a keyframe motion. and there is no need to code for animating them. cuz I check animation in model viewer. (however I used LoadAnimation to check results in editor but there is no different)

when both blades are in the same view, one of them will rotate around another and if there were one blade in viewport it will rotate correctly. so I thought the problem should be in shader/material.

The only change I've made is that I removed zsort form materials. and this is why I'm curious about this.

Omid Saadat

OD Arts Blog

 

AMD Phenom II X4 940 - Geforce 8800GTS - 4GB RAM - XP x86

AMD 6000+ - Geforce 9800 GT - 2GB RAM - XP x86 (Home pc)

Intel Core i7 - Geforce 310M - 4GB Ram - Win7 x64 (Laptop)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...