Animate DOF in DefaultRenderingPipeline

Dear BJSforum,

i have a scene, where i have an invisible player, being followed by a followcam to different positions. I want to animate the DOF values (fStop, LensSize and focallength), but i couldn’t figure out, how…?

I set up my DOF via this.pipe = new BABYLON.DefaultRenderingPipeline and then setting depthOfFieldEnabled to true.

when logging this.pipe or this.pipe.depthOfField i couldn’t find the values either…

DefaultRenderingPipeline has an animations property, so i guess it’s (somehow:) possible, i just couldn’t find any expanation on how in the forum or the documentation.

when trying to animate fstop on this.pipe or this.pipe.depthOfField ( new BABYLON.Animation(“animDof”, ‘fstop’, 30, BABYLON.Animation.ANIMATIONTYPE_FLOAT, BABYLON.Animation.ANIMATIONLOOPMODE_CONSTANT); )

i get the error: “Uncaught Error: Invalid property (fstop) in property path (fstop)”

So: what are the valid properties to animate this values? can someone please help me or send me in the right direction?

Thanks! :slight_smile:

You can see how this works in this PG:

2 Likes

Hey Evgeni,

thanks for your reply! :slight_smile: I think you misunderstood me though. I have no problem setting the DOF values, this works fine! I want to animate them, and I don’t know how? :slight_smile:

I thought about setting the DOF values via scene.registerBeforeRender, while animating the cameraposition, but there has to be a more elegant way?!

figured it out. for anybody coming here in the future: fstop != fStop :wink:

2 Likes