tentone / nunuStudio

Web powered cross-platform 3D, WebXR game engine.
https://nunustudio.org
MIT License
2.13k stars 319 forks source link

Bokeh / Focus control? #442

Open petepolyakov opened 4 years ago

petepolyakov commented 4 years ago

I made a camera in the scene, in the camera settings I turned on Bokeh (now everything just blurry). Then I added a script with an attempt to control the focus but it didn't work, tried to research but so far unsuccessful. Btw, Controlling focus/aperture/maxblur is such "standard" feature, it definitely deserve to be in the camera settings in the future.

my current broken code

var camera, BokehPass;

function initialize()
{
    camera = scene.getObjectByName("dofcam");               
var BokehPass =
    {
    uniforms:
        {
            "focus":   { number: 1.0 }
        }
}
}
function update()
{
}
tentone commented 4 years ago

I may have to add an automatic focus point option to this post processing pass.

It is quite tricky to get the focus parameters correct for a specific scene.

petepolyakov commented 4 years ago

I may have to add an automatic focus point option to this post processing pass.

If it would be too complicated, I would suggest to keep as a float range and give an ability to Animate that parameter. Most of the users who use such tools usually know how to use them. It definitely would benefit cinematic sequences.