xml3d / xml3d.js

The WebGL/JS implementation of XML3D
Other
75 stars 25 forks source link

Disabled face culling #36

Open K1ll3rF0x opened 10 years ago

K1ll3rF0x commented 10 years ago

Hi,

I noticed that face culling has been disabled everywhere in the XML3D.js renderer, is there a reason for this? Usually one wants to enable at least backface culling by default.

lachsen commented 10 years ago

At this point it is disabled, since many (rather bad) mesh assets don't work properly with backface culling on.

The thing I would propose is to have an additional mesh data entry named "solid". (e.g. <bool name="solid" >true</bool>) When a mesh is declared solid, backface culling is enable and normals are always used exactly as provided. When a mesh is not declared solid, backface culling is disabled and normals are flipped toward the viewpoint. This is something you want to use e.g. for simple planes.

This should not be much work to implement and is definitely something we should provide.

K1ll3rF0x commented 10 years ago

In my opinion a mesh data entry named "cullFace" or similar that could take in values such as "none", "front", "back" or "frontback" could be a good idea.

ksons commented 9 years ago

This can currently be done globally with options: https://github.com/xml3d/xml3d.js/wiki/Options

This is only a intermeddiate solution.