xeokit / xeokit-sdk

Open source JavaScript SDK for viewing high-detail, full-precision 3D BIM and AEC models in the Web browser.
https://xeokit.io
Other
715 stars 286 forks source link

SAO effect visible through backfaces #292

Closed xeolabs closed 4 years ago

xeolabs commented 4 years ago

Description

This is caused by inconsistent backface culling between the various render passes that comprise SAO.

Backfaces are culled for SAO depth, normal and blend render passes, but are enabled selectively for objects in the normal draw pass.

The screenshot below shows the issue, where our viewpoint is inside a wall, looking out. The SAO shadows for objects on the other side of the wall are rendered on the interior surface of the wall.

Screenshot from 2020-04-29 19-22-50

Solution

Solution is to make backface culling consistent between the various renderers involved in SAO.

At the same time, we'll make backfaces invisible by default on PerformanceModel, since that's desirable for performance anyway.

We'll be able to make backfaces visible on PerformanceModels if needed, however, eg.


const model = xktLoader.load({
    id: "myModel",
    src: "./models/xkt/duplex/duplex.xkt",
    backfaces: true // <<---- Show backfaces on this model
});
xeolabs commented 4 years ago

Fixed in npm @xeokit-sdk/xeokit 0.9.992