www.jpct.net

jPCT - a 3d engine for Java => Support => Topic started by: qjvictor on November 29, 2006, 10:13:48 pm

Title: How to solve opacity problem in jPCT
Post by: qjvictor on November 29, 2006, 10:13:48 pm
as topic, thanks.
Title: How to solve opacity problem in jPCT
Post by: manumoi 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)?
Title: How to solve opacity problem in jPCT
Post by: qjvictor 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?
Title: How to solve opacity problem in jPCT
Post by: EgonOlsen 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.
Title: How to solve opacity problem in jPCT
Post by: EgonOlsen on November 29, 2006, 11:10:05 pm
Does the flashing look similar to this? http://content.answers.com/main/content/wp/en/5/58/Z-fighting.png
Title: How to solve opacity problem in jPCT
Post by: qjvictor 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.
Title: How to solve opacity problem in jPCT
Post by: EgonOlsen 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.
Title: How to solve opacity problem in jPCT
Post by: qjvictor on November 30, 2006, 07:10:28 pm
Thanks for your advice.
I will change it in 3ds max
Title: How to solve opacity problem in jPCT
Post by: Mizuki Takase 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...
Title: Sorry, I cound't fix it in 3ds max
Post by: qjvictor 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.
Title: How to solve opacity problem in jPCT
Post by: Mizuki Takase 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~
Title: How to solve opacity problem in jPCT
Post by: EgonOlsen 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.
Title: How to solve opacity problem in jPCT
Post by: Mizuki Takase 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~?
Title: How to solve opacity problem in jPCT
Post by: cyberkilla 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
Title: How to solve opacity problem in jPCT
Post by: Mizuki Takase 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...
Title: How to solve opacity problem in jPCT
Post by: cyberkilla on December 12, 2006, 10:23:13 pm
Please do:) I am interested in all things about clothing
in 3d;).