Question

So, I am making a card game. I have a consistent problem where no matter what I try, java3d renders my objects wrong. Here is what I'm talking about: enter image description here

When the camera is looking at them from the back, they are all in order as they should be.

But when you rotate around to the other side...

s

enter image description here

The cards that are actually supposed to be in the back render on top.

enter image description here

I know it's not a normals problem because I checked them in Blender (where I made them as x3ds), and they all point outwards. Furthermore, if I flip the cards over (so that in the first picture, the front sides are facing the camera), I get the same problem but in reverse; the cards render and cover each other up correctly when looked at from the face side, and mess up when looked at from the back side.

This is an absolutely catastrophic problem for my game (Egyptian Ratscrew), because I need to lay the cards in a pile, face up, and they need to be shown in the right order.

I import them using com.interactivemesh.j3d.interchange.ext3d.XModelLoader. I have other objects in the scene, including a table and a pair of hands, and they don't have this problem. I suspect it might be because the cards are very thin.

So... has anybody seen anything like this before or have any ideas on what's causing this?

Was it helpful?

Solution

Looks like there's no depth buffer, or the depth buffer information is ignored. Have a look at your RenderingAttributes.

OTHER TIPS

There is the TransparencySortController which does the ordering for calculating transparency -- maybe it will work in your case? I don't think so, because even if it works, it will reverse your problem. But you can try.

I would guess that the problem may be in using a single surface rendered from both sides -- both sides share the same normal, and I think it may cause the invalid ordering. I had some issues with this.

I would suggest using two opposite surfaces for each single card -- each transparent from one side. Then their normals would point in correct directions.

Also: post your nodes creation code. There may be a mistake there.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top