Author Topic: sort offset  (Read 3357 times)

Offline raft

  • quad
  • ******
  • Posts: 1993
    • View Profile
    • http://www.aptalkarga.com
sort offset
« on: March 19, 2006, 02:35:37 am »
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

Code: [Select]
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 ;)

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
sort offset
« Reply #1 on: March 19, 2006, 01:33:36 pm »
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.

Offline raft

  • quad
  • ******
  • Posts: 1993
    • View Profile
    • http://www.aptalkarga.com
sort offset
« Reply #2 on: March 19, 2006, 03:21:09 pm »
ok, i got the point. thx for quick reponse ;)