Adjusting LensRenderingPipeline dof_focus_distance at runtime


I have a large scene that allows for panning, rotating and zooming around a construction site. As a user zooms in and out, I want to be able to modify the dof_focus_distance of the lens effect so that the target of the camera always stays in focus.

I have tried modifying this via:

camera.onViewMatrixChangedObservable.add(function(c) {

I’ve added these lines into the example provided in the Babylon docs to demonstrate the lack of change to the focus distance.


To answer my own post, ended up getting ina muddle with the different parameters available. Should have been using:

1 Like