Author Topic: jpct transparency problem  (Read 5263 times)

Offline toyswarm

  • byte
  • *
  • Posts: 17
    • View Profile
jpct transparency problem
« on: May 19, 2012, 08:48:02 pm »
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/

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: jpct transparency problem
« Reply #1 on: May 19, 2012, 08:53:48 pm »
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.

Offline toyswarm

  • byte
  • *
  • Posts: 17
    • View Profile
Re: jpct transparency problem
« Reply #2 on: May 20, 2012, 12:09:53 pm »
(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.

Offline Thomas.

  • double
  • *****
  • Posts: 833
    • View Profile
Re: jpct transparency problem
« Reply #3 on: May 20, 2012, 12:24:17 pm »
value -1 helps... I had same problem...

Offline toyswarm

  • byte
  • *
  • Posts: 17
    • View Profile
Re: jpct transparency problem
« Reply #4 on: May 20, 2012, 12:25:42 pm »
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.  ::)

Offline toyswarm

  • byte
  • *
  • Posts: 17
    • View Profile
Re: jpct transparency problem
« Reply #5 on: May 20, 2012, 12:27:57 pm »
Thomas if I remove ". compileAndStrip ();" object should work,
but I don't know if I have other problems with this choice.  :(
« Last Edit: May 20, 2012, 12:38:34 pm by toyswarm »

Offline toyswarm

  • byte
  • *
  • Posts: 17
    • View Profile
Re: jpct transparency problem
« Reply #6 on: May 20, 2012, 12:33:03 pm »
Thomas, Value -1 disable the transparency.
« Last Edit: May 20, 2012, 12:43:06 pm by toyswarm »

Offline Thomas.

  • double
  • *****
  • Posts: 833
    • View Profile
Re: jpct transparency problem
« Reply #7 on: May 20, 2012, 12:42:50 pm »
just setTrasparency(-1) for bottom plane and brown brick, I mean, that it will be OK...

Offline toyswarm

  • byte
  • *
  • Posts: 17
    • View Profile
Re: jpct transparency problem
« Reply #8 on: May 20, 2012, 12:44:41 pm »
This also disables the transparency of the green cube.  :-\

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: jpct transparency problem
« Reply #9 on: May 20, 2012, 09:43:56 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).

Offline toyswarm

  • byte
  • *
  • Posts: 17
    • View Profile
Re: jpct transparency problem
« Reply #10 on: May 21, 2012, 07:34:00 pm »
The ground and the green cube are the same object, then setTransparency (-1) disables full transparency...

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