Author Topic: How to solve opacity problem in jPCT  (Read 6910 times)

Offline qjvictor

  • int
  • **
  • Posts: 77
    • View Profile
How to solve opacity problem in jPCT
« on: November 29, 2006, 10:13:48 pm »
as topic, thanks.

Offline manumoi

  • long
  • ***
  • Posts: 121
    • View Profile
    • http://www.iro.umontreal.ca/~blanchae
How to solve opacity problem in jPCT
« Reply #1 on: November 29, 2006, 10:19:36 pm »
not sur to know what you are talking about with "opacity problem"

Are you looking for Object3D.setTransparency(int)?

Offline qjvictor

  • int
  • **
  • Posts: 77
    • View Profile
How to solve opacity problem in jPCT
« Reply #2 on: November 29, 2006, 10:42:19 pm »
For example, I have two 3d objects in 3ds file. the two objects have a little bit overlapping, so if I load these and merge these into one object by jPCT, the part of overlapping will a little bit flashing after applying deferrent texture. Look at the following code:
   
Code: [Select]
for(int index=0;index<terrainObjs.length;index++){
           obj = (Object3D) terrainObjs[index];          
           if(obj.getName().indexOf("track_ground")!=-1){
             obj.setTransparency(1);            
           }
           terrain = Object3D.mergeObjects(terrain, obj);
         }

but I notice that the object's properties I set before merging will be missing after merging, so the object named "track_ground" in terrain is not transparent. That's the problem about opacity, right?
So how to set the property of such a object which will be merged into another object?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11777
    • View Profile
    • http://www.jpct.net
How to solve opacity problem in jPCT
« Reply #3 on: November 29, 2006, 11:03:41 pm »
You can't. If you merge objects, they become one and things like transparency are per object. So you can't merge transparent objects with opaque ones. Just use multiple objects for this purpose.
But i'm not sure how this is related to the flashing problem you described. Sounds more like a zbuffer problem to me, which you can't solve except by reducing or removing the overlapping. If two polygons are sharing the (almost) same space, the depth buffer isn't accurate enough and you'll get these artifacts.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11777
    • View Profile
    • http://www.jpct.net
How to solve opacity problem in jPCT
« Reply #4 on: November 29, 2006, 11:10:05 pm »

Offline qjvictor

  • int
  • **
  • Posts: 77
    • View Profile
How to solve opacity problem in jPCT
« Reply #5 on: November 30, 2006, 04:12:00 pm »
Yes, It looks like this. If you put these 2 layers together, they will flash because overlapping.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11777
    • View Profile
    • http://www.jpct.net
How to solve opacity problem in jPCT
« Reply #6 on: November 30, 2006, 06:47:43 pm »
The only thing you can do against this is not to do it. If they cover exactly the same space, there's no way to tell which one wins. If they don't occupy the exactly same space but are still very close, inaccuracy of the hardware may result in similar effects. It's a rendering artifact known as z-fighting.

Offline qjvictor

  • int
  • **
  • Posts: 77
    • View Profile
How to solve opacity problem in jPCT
« Reply #7 on: November 30, 2006, 07:10:28 pm »
Thanks for your advice.
I will change it in 3ds max

Offline Mizuki Takase

  • int
  • **
  • Posts: 97
    • View Profile
How to solve opacity problem in jPCT
« Reply #8 on: December 06, 2006, 08:51:40 pm »
to qjvictor: How do you fix that in 3D Studio Max? I tried to weld two points together and still got the same problem... I think that collapsing two points did the same thing as well...

Offline qjvictor

  • int
  • **
  • Posts: 77
    • View Profile
Sorry, I cound't fix it in 3ds max
« Reply #9 on: December 07, 2006, 05:42:54 pm »
Sorry, I cound't fix it in 3ds max
So the same problem is existed.
And so far I couldn't find a way to solve it.
My god, who can give me a solution about this.

Offline Mizuki Takase

  • int
  • **
  • Posts: 97
    • View Profile
How to solve opacity problem in jPCT
« Reply #10 on: December 07, 2006, 09:54:03 pm »
Scary~~ In my case, I feel that its a 3d modelling problem... I just need to remember not collapse a plane over another plane and things will be fine~

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11777
    • View Profile
    • http://www.jpct.net
How to solve opacity problem in jPCT
« Reply #11 on: December 12, 2006, 09:37:00 pm »
It has to be fixed in the model. You may experiment with different settings for the far and near clipping plane to increase zbuffer-accuracy, but that just trying to cure the symptoms, not the actual disease.

Offline Mizuki Takase

  • int
  • **
  • Posts: 97
    • View Profile
How to solve opacity problem in jPCT
« Reply #12 on: December 12, 2006, 09:39:49 pm »
Egon: I had no idea that you are back~ Have you looked at clothing simulation? Work has killed me in terms of game programming, so there is no rush at it at all.. Besides, you're participating at the 4K competition... How is that coming along~?

Offline cyberkilla

  • float
  • ****
  • Posts: 413
    • View Profile
    • http://futurerp.net
How to solve opacity problem in jPCT
« Reply #13 on: December 12, 2006, 10:14:01 pm »
Quote from: "Mizuki Takase"
Egon: I had no idea that you are back~ Have you looked at clothing simulation? Work has killed me in terms of game programming, so there is no rush at it at all.. Besides, you're participating at the 4K competition... How is that coming along~?


Clothing simulation? :P
http://futurerp.net - Text Based MMORPG
http://beta.rpwar.com - 3D Isometric MMORPG

Offline Mizuki Takase

  • int
  • **
  • Posts: 97
    • View Profile
How to solve opacity problem in jPCT
« Reply #14 on: December 12, 2006, 10:19:27 pm »
Hee hee... I did some UGLY clothing simulation a while back and I wanted to show Egon this, in hopes of contributing something as well as figure out why the clothing effect is not working as expected... I think that I shall start a thread...