How to solve opacity problem in jPCT

Started by qjvictor, November 29, 2006, 10:13:48 PM

Previous topic - Next topic

manumoi

not sur to know what you are talking about with "opacity problem"

Are you looking for Object3D.setTransparency(int)?

qjvictor

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:
   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?

EgonOlsen

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.


qjvictor

Yes, It looks like this. If you put these 2 layers together, they will flash because overlapping.

EgonOlsen

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.

qjvictor

Thanks for your advice.
I will change it in 3ds max

Mizuki Takase

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...

qjvictor

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.

Mizuki Takase

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~

EgonOlsen

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.

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~?

cyberkilla

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

Mizuki Takase

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...