Two sided polygons?

Chris

30-05-2006 13:40:42

How can I make two sided polygons/materials? I trial-and-errored two passes one clockwise other anticlockwise cull hardware and it does cover both sides, however lighting information is incorrect (one side dark, both sides dark and such)

This is mainly a question about foliage and how to make it without killing polygon limits by doubling polygon count. So, possible?

Lioric

30-05-2006 16:47:18

You just need a single pass with the cull options set, but the vertex normals (used to calculate the lighting) will be on a single polygon side

In this case, you can bake the vetices colors to store the lighting information and then disable lighting on this polygons, so they are not affected by the light(s) position

Or a more advanced approach is to use shaders to generate correct lighting

Chris

30-05-2006 18:15:21

Any tips how would I go on doing it with shaders? Lighting needs to be dynamic and not baked, but I have no idea where to begin with as far as double sided lighting goes with shaders.

Evak

31-05-2006 07:30:11

I normaly just clone to an element and flip to make things two sided. Doesn't work if your object recieves shadows though, as that causes z fighting.

You need to add some thickness to avoid the shadow problem.

Chris

31-05-2006 12:38:05

I normaly just clone to an element and flip to make things two sided. Doesn't work if your object recieves shadows though, as that causes z fighting.

You need to add some thickness to avoid the shadow problem.


Yes but the thing is, this duplicates polygon count, and in a landscape on four square kilometers you really dont want to duplicate foliage polygon count.

Does anyone know how is the grass demo in ogre done? It seems to have two sided polygons, but I didnt find the material files related.

Lioric

31-05-2006 21:35:54

The grass demo uses the up vector (wrt world) as the normal directions, in this case the lighting is not on a single side of the polygon

BlasterN

31-05-2006 23:46:16

try this.
Create your model. Copy it, use Normal modifier and attach the other model.
With that you create a model with a good normals.
And maybe to improve the model you can select all vertices and Weld->Selected (in edit/mesh modifier)