Screen space reflection

I am getting this error while trying to use Screen surface reflection postprocess (scene.enablePrePassRender is not a function)
I can reproduce in a playground because im using tree shaking, so Im thinking maybe something is missing that i need to import

here’s what my current code looks like

import { ScreenSpaceReflectionPostProcess } from “@babylonjs/core/PostProcesses/screenSpaceReflectionPostProcess”;

const ssr = new ScreenSpaceReflectionPostProcess(“ssr”, global.scene, 1.0, global.scene.activeCamera)

1 Like

The function is defined in prePassRendererSceneComponent Babylon.js/prePassRendererSceneComponent.ts at 3d16adca43e1a5af649943244e7d455013fd9621 · BabylonJS/Babylon.js · GitHub , but I feel this should have been included on the core package :thinking: I’ll tag @Deltakosh who might have some idea of what’s going on


awesome thanks @carolhmj

More a question for @RaananW our module master (Please be patient though as raanan is oof on vacations :))

1 Like

A scene component is needed in order to enable this feature. This is because of the way we currently implement tree shaking, and how we are dealing with internal dependencies.

This should have been documented here - Babylon.js ES6 support with Tree Shaking | Babylon.js Documentation , but it seems like we missed this one. I’ll make sure to add it to the docs.




i actually tried importing the scenecomponent, still got the same error so i tried to import all the files it was referencing. still the same issue, it was a total mess lol.

// import { GeometryBufferRenderer } from "@babylonjs/core/Rendering/geometryBufferRenderer";
// import "@babylonjs/core/Rendering/prePassRendererSceneComponent";
// import "@babylonjs/core/sceneComponent";

would be great to see a reproduction of this. can you share the project? or a minimal project that fails?

yes im going to make a repro


here’s the repro playground

code: Glitch :・゚✧

You were missing those 2 imports:

import "@babylonjs/core/Rendering/geometryBufferRendererSceneComponent";
import "@babylonjs/core/Rendering/prePassRendererSceneComponent";
1 Like

oh yeah i already tried those imports, i was getting a different error

Uncaught TypeError: this._scene.disableGeometryBufferRenderer is not a function

This is solved with the first import.

the import is working fine now.

except i get this shader fragment error, any idea why this might be?

it’ss very hard to help without a reproduction. Can you reproduce this on our playground?