Author Topic: Primitives and Z layer view.  (Read 1652 times)

Offline icarusfactor

  • int
  • **
  • Posts: 58
    • View Profile
Primitives and Z layer view.
« on: March 08, 2011, 01:07:53 pm »
I was having problems with z layers and when primitive spheres are close together.
If you look at this animation you will see the spheres pop over one another. Does JPCT have an option to make it where the sphere is protruding through the other one instead of either behind or in front of one another.

Would like the sphere cutting to look like this?

Can a primitive do this or do I need to use a 3ds sphere model and can it do it?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12198
    • View Profile
Re: Primitives and Z layer view.
« Reply #1 on: March 08, 2011, 01:36:51 pm »
That's a sorting issue caused by the fact that transparent objects have to be sorted back to front to be rendered correctly (so objects in the back are shining through object in front). It will go away when disabling transparency. Apart from that, there's not really much you can do. Sorting a primitive (or any object) is done based on it's center point in space. This can never be correct in all cases especially if the objecs are very close. There's is an option to set a sorting offset per object. However, to make this work with a such kind of model, you would have to compute the z-offset based on whatever formula for each object in each frame...and even simply can't calculate an order that sorts complex objects based a single point correctly in all cases. It might by worth a try to sort the inner red spheres always into the back or something like this though.