Depth Of field PMNDRS post processing

I am looking at using the PMNDRS Post processing depth of field effect.

I have it working fine, however, I want to be able to dynamically set the focal point. I thought it was just a case of setting the target (e.g. = vector) but that doesn’t seem to do anything. Are there any examples of dynamically changing the focal point? I want to do a code pen for y’all but couldn’t figure out how to get the post-processing in there sorry!

here’s one arraybuffer dof - CodeSandbox

it’s not more than = new THREE.Vector3(0, 0, 0)

function onPointerMove(e) {

Thanks! I assume it’s the same approach in the vanilla PP library which means I must have mine set up wrong as it doesn’t work, but at least I know it’s possible/should.

yes, it is using vanilla pp underneath. setting the target up is all happening at baselevel. target by default is null, once you give it a vector it should pick it up.

great thanks for the info, and brilliant example you did.

I’ll have to try it completely separate to my code as I can’t get mine to work - but then again it also is messing up the scene’s background, making it black when it should be transparent so clearly I’ve messed up somewhere

Hi I came across this the other day and it looks like the transparent background is an issue in the latest release


1 Like