jpct transparency problem

Started by toyswarm, May 19, 2012, 08:48:02 PM

Previous topic - Next topic

toyswarm

Hi, I'm toyswarm ^^ and about my problem:
I created a small terrain of cubes like Minecraft;
the chunk (6 * 6 * 6) arrays are created by id with the type of cubic
and I created using:
new Object3D(vertices, texCoords, indices, tm.getTextureID("example"));
(I'm sorry for my English but I hope the picture helps to understand my problem)

http://imageshack.us/photo/my-images/12/problemje.jpg/

EgonOlsen

Looks like a sorting issue. Transparent object have to sorted and will be rendered in that order. This sorting is per object (or per polygon for uncompiled objects) and is never perfect. The problem will go away if you don't make the ground transparent too.

toyswarm

(thanks for reply)
What should I do? I must to set "setTransparency(int x)" parameter?
what number is optimal?
I tried the numbers from 0 to 5 but the problem remains.

Thomas.

value -1 helps... I had same problem...

toyswarm

mmh... and if I don't compile this 3d objects?
I would only lower performance?
if I had no other issue... it would be the solution to my problem.  ::)

toyswarm

#5
Thomas if I remove ". compileAndStrip ();" object should work,
but I don't know if I have other problems with this choice.  :(

toyswarm

#6
Thomas, Value -1 disable the transparency.

Thomas.

just setTrasparency(-1) for bottom plane and brown brick, I mean, that it will be OK...

toyswarm

This also disables the transparency of the green cube.  :-\

EgonOlsen

Quote from: toyswarm on May 20, 2012, 12:44:41 PM
This also disables the transparency of the green cube.  :-\
Why should it? What has this cube to do with the ground? A setTransparency(-1); for the ground only should do it. If not, you can play around with Object3D.setSortOffset() to offset the ground in sorting so that it will always be drawn first.

Not using compile() will slow things down but other than that, it has no drawbacks (unless you want to use shaders, which you can't in that case).

toyswarm

The ground and the green cube are the same object, then setTransparency (-1) disables full transparency...

for "compile()" I understand, thanks.  :)