Multiple transparency
-
- Posts: 260
- Joined: Thu Apr 17, 2008 1:38 pm
- Location: Brasopolis - Brazil
Multiple transparency
Hello guys,
I made a shader with help of Nespa using reflection and transparency. I want now know if is possible to render those clipped polygons. Using OpenGL. Take a look.
Uploaded with ImageShack.us
How can I solve this?
I made a shader with help of Nespa using reflection and transparency. I want now know if is possible to render those clipped polygons. Using OpenGL. Take a look.
Uploaded with ImageShack.us
How can I solve this?
Professional Software Developer and Amateur Game Designer
-
- Posts: 260
- Joined: Thu Apr 17, 2008 1:38 pm
- Location: Brasopolis - Brazil
I have not alls the informations about your sphere to analyze what is happend.
I'm afraid i didn't understood what polygons in your sphere are clipped, they are separate objects or belong of the same object(sphere)?
If it is about the behind polygons around of the sphere, set flags frontface and backface too.
I'm afraid i didn't understood what polygons in your sphere are clipped, they are separate objects or belong of the same object(sphere)?
If it is about the behind polygons around of the sphere, set flags frontface and backface too.
The transparent polygons are drawn last, and without ZBuffering. You would have to draw the inner sphere BEFORE to the outer one, so the transparency is correctly drawn.
The transparency is an important issue in 3d engines because it doesn't get along well with the ZBuffering, and normaly, the way to deal with it is to delay the rendering of the transparent objects to the last part of the render, where they will be sorted back to front and drawn over the solid objects.
The problem is that this z-sorting is done only with the objects, and not with the faces that compose them, so, is posible that some faces are drawn incorrectly, and that is what happens with your screenshot.
The transparency is an important issue in 3d engines because it doesn't get along well with the ZBuffering, and normaly, the way to deal with it is to delay the rendering of the transparent objects to the last part of the render, where they will be sorted back to front and drawn over the solid objects.
The problem is that this z-sorting is done only with the objects, and not with the faces that compose them, so, is posible that some faces are drawn incorrectly, and that is what happens with your screenshot.
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
-
- Posts: 260
- Joined: Thu Apr 17, 2008 1:38 pm
- Location: Brasopolis - Brazil
Hi guys,
I'll take a look at the stack overflow. But I'll explain better what is my object.
I'm not using backface culling because the normals was a bit messed (but I was using a bad shader that time).
So I made two spheres one over the other. Exactly the same sphere. But, one of them I flipped the normals, and it is visible from inside, you got?
Thanks for the replies!
I'll take a look at the stack overflow. But I'll explain better what is my object.
I'm not using backface culling because the normals was a bit messed (but I was using a bad shader that time).
So I made two spheres one over the other. Exactly the same sphere. But, one of them I flipped the normals, and it is visible from inside, you got?
Thanks for the replies!
Professional Software Developer and Amateur Game Designer
-
- Posts: 260
- Joined: Thu Apr 17, 2008 1:38 pm
- Location: Brasopolis - Brazil
The 1st shader is "one side lighting".
Try a "two sides lighting" shader;
here is the doc:
http://www.gamedev.net/page/resources/_ ... rary-r2428
Try a "two sides lighting" shader;
here is the doc:
http://www.gamedev.net/page/resources/_ ... rary-r2428
Nope.. it is a problem that took me months to fight, ultimately having to modify Irrlicht to make things work as I needed.Kalango wrote:Doesnt irrlicht have polygon offset atribute to avoid z fighting? If it doesnt it nees ASAP...
From your post, I did a search and found out that openGL does have a polygon offset attribute, and DirectX/Direct3D might too (not sure)... never knew this.
3 objects here:
- sphere1(middle sphere) -> material type : transparent & reflections 2 layers;
material flag : backface ON;frontface ON;
- sphere2(inner sphere) -> material type : solid;
material flag : backface ON;frontface ON;
- sphere3(outer sphere) -> material type : solid;
material flag : backface ON;frontface ON;
Don't apply shader to sphere1;
You can apply shader to sphere2 and sphere3;
- sphere1(middle sphere) -> material type : transparent & reflections 2 layers;
material flag : backface ON;frontface ON;
- sphere2(inner sphere) -> material type : solid;
material flag : backface ON;frontface ON;
- sphere3(outer sphere) -> material type : solid;
material flag : backface ON;frontface ON;
Don't apply shader to sphere1;
You can apply shader to sphere2 and sphere3;
-
- Posts: 260
- Joined: Thu Apr 17, 2008 1:38 pm
- Location: Brasopolis - Brazil
Re: Multiple transparency
Hi Nespa,
After a long time, I'm on active again (was dealing with logic). Yes, your suggestion worked very well. I made a bit different:
I used two domes, one for inside another for outside e none for the solid part.
Thanks man!
After a long time, I'm on active again (was dealing with logic). Yes, your suggestion worked very well. I made a bit different:
I used two domes, one for inside another for outside e none for the solid part.
Thanks man!
Professional Software Developer and Amateur Game Designer