accumulator and incostent winding

I have a mesh in which not all surfaces are winded consistently in same direction also I don’t know the direction of any face if it is CW or CCW .In order to solve the problem I use accumulator buffer and two side lighting one time with false and then save it to accumulator and second time with “true” and send it to accumulator too. And finally return from it
(I use following commands
glLightModelf(GL_LIGHT_MODEL_TWO_SIDE
glAccum(GL_ACCUM
)
What you do think? What the possible pitfalls could be?

What about just disabling backface culing ?

I am trying to use culling but It seem it didn’t work
what do you think


glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
glCullFace(GL_FRONT);
glMaterialfv(GL_BACK, GL_DIFFUSE,matCol);
//render here .....(back faces)
glCullFace(GL_BACK);
glMaterialfv(GL_FRONT, GL_DIFFUSE,matCol);
//render her..(front faces)

What meant :
glDisable(GL_CULL_FACE);
then draw only once your model.

You didnt undersrand the problem: part of the normals are directed incorrectly.(And I dont know
which of them)I need to use two-sided lighting model to render these faces [b]and/b render other (with correctly defined normals) in the regular way.

No, I do think I understood your problem, at least if normals and CCW/CW winding order are consistent one with the other, even if not across the model.

Please follow my explanations, and at least try to implement them :

    • front facing/back facing is determined according to CCW or CW winding order, and allow OpenGL to decide is face is culled or not when back (or front) face culling is enabled
    • so that means you need to disable backface culling
    • only the normal direction is used to compute lighting
    • two-sided lighting, when enabled, reverses the normal for back faces (when detected according to 1) and leaves alone normals of front facing triangles.
    • so you need 2 sided lighting too
    • and nothing else

Can you share a picture of this rendering with your data ?

But let me say that if you have to possibility to clean your models before rendering, it would provide you better performance.
Not in the case of completely dynamic geometry, alas.

Can you share how comes you get unclean geometry ? Is that dynamically generated, user generated , … ?

Are you positive that winding order and normals are always consistent one with the other ?
How are the normals created ?

Two side lighting is not a fix for bad geometry, try and get it right first, if you cant do it in a modeler then run the geometry trough some algorithms to fix it.