Skip to content

Commit

Permalink
Merge pull request #447 from KhronosGroup/fix/filter_transmissive_geo…
Browse files Browse the repository at this point in the history
…metry

Filter drawables behind camera each frame
  • Loading branch information
UX3D-kanzler authored Dec 16, 2022
2 parents 017988f + 8c125d7 commit 98fc22c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
5 changes: 3 additions & 2 deletions source/Renderer/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -331,15 +331,16 @@ class gltfRenderer

// filter materials with transmission extension
this.transmissionDrawables = currentCamera.sortPrimitivesByDepth(state.gltf, this.transmissionDrawables);
for (const drawable of this.transmissionDrawables)
for (const drawable of this.transmissionDrawables.filter((a) => a.depth <= 0))
{
let renderpassConfiguration = {};
renderpassConfiguration.linearOutput = false;
this.drawPrimitive(state, renderpassConfiguration, drawable.primitive, drawable.node, this.viewProjectionMatrix, this.opaqueRenderTexture);
}


this.transparentDrawables = currentCamera.sortPrimitivesByDepth(state.gltf, this.transparentDrawables);
for (const drawable of this.transparentDrawables)
for (const drawable of this.transparentDrawables.filter((a) => a.depth <= 0))
{
let renderpassConfiguration = {};
renderpassConfiguration.linearOutput = false;
Expand Down
1 change: 0 additions & 1 deletion source/gltf/camera.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ class gltfCamera extends GltfObject
// 2. Sort primitives so that the furthest nodes are rendered first.
// This is required for correct transparency rendering.
return drawables
.filter((a) => a.depth <= 0)
.sort((a, b) => a.depth - b.depth);
}

Expand Down

0 comments on commit 98fc22c

Please sign in to comment.