PDA

View Full Version : how to: double sided poly material



bsenftner
05-04-2001, 03:37 PM
Is there any way to support a two sided material applied to a geometry, such that entirely different ambient, diffuse, and texture information is applied to the "inside" and "outside" of that geometry?

I am not talking about simple rendering of both sides of a poly geometry, that's butt simple.

Imagine a paper photograph that has an image on one side and that "Kodak" logo on the back side. Does that have to be done with two separate outward facing sets of polygons? There's no way to apply one set of ambient/diffuse/texture to the front faces and another to the back? Even with some of the more advanced extensions that I have not investigated too much into, like register combiners?

I'm looking into supporting 3DSMAX's double sided material in my engine...

thanks for any ideas,
-Blake

j
05-04-2001, 06:15 PM
Two sided lighting is supported by OpenGL. I think that it is not in hardware on most video cards. Two sided texturing as a feature does not exist.

So probably the best/only way to do what you want is to draw the object twice, once with glCullFace(GL_BACK), and once with glCullFace(GL_FRONT).

j

zed
05-04-2001, 06:51 PM
no you can't apply 2 textures onto one polygon, you will need to draw 2 polygons.

WhatEver
05-04-2001, 09:05 PM
You'll need two models to achive what you're asking. Take a sphere for instance. Make two spheres exactly the same. Make one sphere have counter-clockwise triangles, and the other clockwise triangles. Now enable backface culling, and then draw both spheres. If you have a differant texture for each sphere, you'll see the one texture if you're on the outside of the sphere, and the other texture on the inside http://www.opengl.org/discussion_boards/ubb/biggrin.gif.

WhatEver
05-04-2001, 09:07 PM
Or just do what j said, given that the texture coordinates are identicle http://www.opengl.org/discussion_boards/ubb/smile.gif.

SlyFox
05-05-2001, 12:17 AM
You may need to flip the normals though, yes?

j
05-05-2001, 07:30 AM
Heh, I never thought about that.

Yes, flipping the normals is also necessary, unless you use two sided lighting which, as I mentioned before, will probably give you software rendering. On hardware T&L cards, anyway. Other cards, it's already done in software, so I can't see using two sided lighting as being a problem.

j

bsenftner
05-05-2001, 08:17 AM
Yeah, oh well, I guess that makes supporting 2 sided materials fairly straight forward.

Thanks everyone!