Main Menu

sort offset

Started by raft, March 19, 2006, 02:35:37 AM

Previous topic - Next topic

raft

hello,

how should Object3D.setSortOffset(float) be used ? javadoc says it sets on offset for the z-Sorting but i couldnt get it. i guess it's sth like objects are sorted by given float for render but what about the camera ? should one track where the camera is by himself and set the sort offset accordingly ?

i'm having a strange rendering artifact:  it seems like polygons are sliding when camera approachs to them, as can be seen in image below. i have two transparent objects one covering another. the inner one is actually rendered (it has visible pixels) but the outer one is never seen (all black) and used for collision purposes.



strange rendering disappears if i dont put the outer one into to the world.  that made me think this may have something with that sort offset thing.

so how should i use Object3D.setSortOffset() thing ?
thx

r a f t
ps: the two objects arent that close, the inner one is fine grained (has a lot of polygons) but the outer one is a simple box with 6 faces.
ps2: infact the invisible one is inside, but their normals are looking inside and the camera in always inside ;)

EgonOlsen

sort offset is not really usable for such things. It's almost impossible to get a proper sorting of interleaving transparent objects for all cases. setSortOffset() is meant to be used to sort some transparent objects behind others (for example the "line of sight" in Paradroidz). To get rid of your problem (and to increase performance) disable the collision meshes while rendering and only enable them when doing the collision detection. That's what i do in Paradroidz too.

raft

ok, i got the point. thx for quick reponse ;)