Jump to content

How to change distortion (lensEffect) dinamically?


hit2501
 Share

Recommended Posts

Hi,

I'm playing with lens effects through this example:

var lensEffect = new BABYLON.LensRenderingPipeline('lens', {
                        edge_blur: 1.0,
                        chromatic_aberration: 1.0,
                        distortion: 0.5,
                        dof_focus_distance: 100,
                        dof_aperture: 1.0,      
                        grain_amount: 1.0,
                        dof_pentagon: false,
                        dof_gain: 1.0,
                        dof_threshold: 1.0,
                        dof_darken: 0
                    }, scene, 1.0, camera);

And now I want to change only distortion with a slider that calls a function like this:

function adjust_distortion(value){
                console.log(value);
                lensEffect = new BABYLON.LensRenderingPipeline('lens', {
                    distortion:value
                }, scene, 1.0, camera);
            }

But the distortion increases even if I change the slider to a zero value. Can anybody show me a sample to achieve it with the dynamic "value"?

Thanks

Link to comment
Share on other sites

Thanks Delta, I saw in 75 line: camera.radius = 400 + (-150 + 150 * Math.sin(time / 10));

Which works to move the camera near and far according to a math formula but I must keep the camera with a static radius from object, Or am I missing something?

Please help

btw, beautiful playground.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...