Page 1 of 2

Multiple transparency

Posted: Sat Mar 05, 2011 5:07 pm
by Auradrummer
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.

Image
Uploaded with ImageShack.us

How can I solve this?

Posted: Sat Mar 05, 2011 6:54 pm
by nespa
material settings: material flags , normals, z-buffer.....

If You have applied the shader to the sphere, You must apply the shader to the alls objects inside of the sphere. The shader is rendered the last, so, if the objects inside are not rendered again, they will be cliped.

Posted: Sun Mar 06, 2011 1:19 am
by Auradrummer
Hi Nespa,

I don't think is this. I did the following, make a sphere, copied it, flipped normals and paste inside. This is the same material. There is some way to order the engine to render the inner sphere after the outer?

Posted: Sun Mar 06, 2011 7:41 am
by nespa
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.

Posted: Sun Mar 06, 2011 7:51 am
by Mel
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.

Posted: Sun Mar 06, 2011 8:19 am
by nespa

Posted: Sun Mar 06, 2011 1:25 pm
by Auradrummer
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!

Posted: Sun Mar 06, 2011 1:30 pm
by Kalango
Doesnt irrlicht have polygon offset atribute to avoid z fighting? If it doesnt it nees ASAP...

Posted: Sun Mar 06, 2011 1:36 pm
by Auradrummer
Tried to use backface culling again.

With your shader, Nespa, worked well. But still with that problem.

Posted: Sun Mar 06, 2011 1:47 pm
by nespa
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

Posted: Sun Mar 06, 2011 9:55 pm
by Mel
Maybe your best option here would be to split the sphere into two separate objects and make sure the fliped sphere is drawn before the other.

Posted: Sun Mar 06, 2011 10:23 pm
by agamemnus
Kalango wrote:Doesnt irrlicht have polygon offset atribute to avoid z fighting? If it doesnt it nees ASAP...
Nope.. it is a problem that took me months to fight, ultimately having to modify Irrlicht to make things work as I needed.

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.

Posted: Mon Mar 07, 2011 1:24 pm
by nespa
build your sphere like that :

-a grid as a separate object;
-many windows as the children of the grid;

-apply the shader to the alls objects in a separate mode;

Posted: Mon Mar 07, 2011 7:38 pm
by nespa
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;




Image

Re: Multiple transparency

Posted: Fri Aug 05, 2011 8:36 pm
by Auradrummer
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!