How to use RSM Global Illumination?

I was very excited to try out @Evgeni_Popov’s RSM GI, but I couldn’t get it to work.

After adding all the meshes I did:

// At the end of _createEnvironment()

const rsm = new BABYLON.ReflectiveShadowMap(this.scene, skySun);

const giRsmManager = new BABYLON.GIRSMManager(this.scene, { width: this.canvas.clientWidth, height: this.canvas.clientHeight });
giRsmManager.addGIRSM(new BABYLON.GIRSM(rsm));
giRsmManager.enable = true;
// giRsmManager.showOnlyGI = true; // This shows a blank screen

But it doesn’t seem to be doing anything (except reduce the FPS a bit).

1 Like

We didn’t communicate on this feature yet, because we still need to write a demo and some documentation about it. Also, keep in mind it’s not a full GI solution, as you could find in some games, for eg (more details in the doc to come)!

Regarding your PG:

  • you must call giRsmManager.addMaterial(); to enable all materials of the scene for GI rendering
  • you must call rsm.updateLightParameters() to make sure light parameters are calculated (I will make a PR to do it automatically when rsm.addMesh is called).
  • you should remove “skybox” and “groundbox” from the render list of the RSM, because these meshes are very big and will create a very big bounding box for the light, meaning the whole scene will be rendered only in a small part of the RSM the render targets
  • GIRSM is not compatible with the pre-pass renderer, so I updated SSAO/SSR to use the geometry buffer renderer instead

Here’s the updated PG (it shows the GI contribution by default - comment line 174 to show the true rendering):

Note however that you won’t see a big difference in your scene. Here’s another PG that should demonstrate the effect a little better:


Awesome work, thanks!