1
votes

I have InstancedBufferGeometry working in my scene. However, some of the instances are mirrors of the source, hence they have a negative scale to represent the geometry.

This flips the winding order of those instances and look wrong due to Back Face Culling (which I want to keep).

I'm fully aware of the limitations within this approach, but I was wondering if there was a way to tackle this that I may have not come across yet? Maybe some trick in the shader to specify which ones are front face and which are back face? I don't recall this being possible though...

Or should I be doing two separate loads? (Which will duplicate the draw calls) I'm loading a lot of different geometries (which are all instanced) so trying to make sure I get the best performance possible.

Thanks!

Ant

[EDIT: Added a little more detail]

1

1 Answers

0
votes

It would help if you provide an example. As far as I can understand your question, simple answer is - no, you can't do that. As far as i'm aware, primitives are rejected before they get to the shader, meaning that it's not in your control. If you want to use negative scaling, and make sure that surfaces are still visible - enable rendering of both faces (Front and Back). Alternatively, you might be okay with simply rotating objects and sticking to positive scale - if you have to have mirroring - you're out of luck here. One more idea: have 2 instanced objects, one with normal geometry and one with mirrored, you can fix up normals in the mirrored geometry.