Open elyrank opened 2 years ago
"It's not a bug, it's a feature" By default, surfaces are only visible from 1 side (for performance reasons). In your case, from the outside of the object. Slicing it allows you to see it from the inside, but the surface is not shown.
is there any way to change it so it will be shown?
There is some low-level stuff but I never used it. @xeolabs?
Only when building scenes using the Geometry
, Node
, Mesh
components will you lose control over the visibility of backfaces.
That's by design, because we rarely want to slice open things built with those components, to see their backfaces (eg. NavCubePlugin).
However, you can control backface visibility within models loaded into the SceneModel
scene representation (so far implemented by VBOSceneModel
).
That's used to represent models loaded by the various loader plugins, from XKT, glTF, CityJSON, IFC etc.
The VBOSceneModel
's createGeometry
and createMesh
methods support the "solid" and "surface" primitive types; these are just aliases for "triangles", where "solid" indicates a triangle mesh that we know is closed, and "surface" indicates a triangle mesh that we know is open.
The Viewer will render "surface" geometries with backfaces visible, and "solid" and "triangles" geometries with backfaces hidden.
Maybe you could switch to using VBOSceneModel? As long as you don't need animated transform hierarchies (ie. as supported Node and Mesh components), it should have all the methods you need otherwise..
I'm loading all using XKT files instead of generating the geometry. is there a way to set the backfaces to be visible?
Currently, xeokit-convert
(XKTModel
, convert2xkt
etc) automatically checks if geometries are closed or open and generates "solid" vs "surface" primitives in the XKT accordingly. That allows the xeokit Viewer to decide whether to draw their backfaces or not when rendering them.
We can't override that currently - it does not currently expose an option to force all triangle mesh primitives to be "surface".
We'd be open to adding that as an option within xeokit-convert
, however, so a PR on this would be welcome if anybody want's to contribute.
For this feature, we'd want a PR on xeokit-convert
, with the new override option, and a PR on xeokit-sdk
, containing a live example that loads an XKT that was generated by convert2xkt
using the new option.
when I create a mesh with a geometry - as long as it is not sliced it looks ok, but when it is sliced - you can see that it is hollow, and if you look at it exactly from the top - you can't even see it.
I used buildCylinderGeometry. I tried playing with the properties - but nothing helped. also tried with phongMaterial , and emphasis material using xray , but all are hollow.
when not sliced:
when sliced:
when exactly top: