Jump to content

Using depth-of-field and other lens effects


Dad72
 Share

Recommended Posts

Wow, Dad72, you and I were doing discussions about the same PG scene... in different threads... at the same time.  (the "check my scene" thread)

 

Weird.  I arrived late to the party, it seems.  :) 

 

Thanks for checking our PG scenes.  Good find.

Link to comment
Share on other sites

We just talked about the same playground, but not about the same subject.  You had shader problems, I had slow-loading problems that I thought was crashes.  Did you discover what causes/caused the shader error?

 

Google Chrome only?  (thx)

Link to comment
Share on other sites

This might be a bug in Google Chrome, right?  All in all, thanks for trying to beat this, Jahow!  I would be more than glad to help with something, if you need me for anything.  Also, can we hand this off to Google Chrome support staff?  Maybe they are looking for a bug to work-on.  :)

 

Fellow forum users... let's help Jahow with this, in any way we can.  Depth-of-Field/LensEffects is an awesome system, and we all need to stand behind it and try to get 100% browser compat if we can.  So, put me to work, Jahow.  Want me to fly-in to Google HQ and have a little talk with the Chrome dev team?  I'm on it.  :)

Link to comment
Share on other sites

  • 4 weeks later...

I really love your DOF lens effect jahow !! :wub:

 

But to produce a good tilt shift or simulate macro photography, the "far" blur should be a lot more blurry. I don't see any param to increase the blur power, is there a way to change it ?

 

(maybe a second blur pass is required to obtain a really nice blur, that's why you didn't put a blur factor value ?)

Link to comment
Share on other sites

Thanks!!

 

You're right about the tilt shift. In my effect, the far blur is actually 'capped', the radius reaches a maximum limit and stops. I did that because since objects are getting further anyway, even with the same blur radius, they will still be more and more blurred. Also, in my shader the blur is computed in one pass, so to make it look nice I had to do a lot of samples. The maximum number of samples is 30 (for things very far away), which is already a lot. I didn't want to go further than that, so increasing the blur radius was not possible.

 

You can try to play with the 'depth bias' parameter, which determines how quickly the blur increases with depth, if you haven't already.

 

Also, recently I've looked closely at how Cities: Skyline does the tilt shift effect (screenshot) and it's actually very simple. It's just a blur on the whole screen that is stronger on the upper and lower part, and non existent in the middle. I'm pretty sure they do not need any depth calculation, and they can do this with a multi pass blur hich would be much more efficient. It's the same technique used here: you can see that the part of the screen staying sharp is always an horizontal line at around a third of the screen's height.

 

Anyway, I'm glad you liked it :)

Link to comment
Share on other sites

By 'depth bias' you means your aperture param I presume, yes I've already played with it (and that's just a very great param, congrats!!).

But the scene is still not enough blurred in my taste.

 

You're right, many tilt shifts are made like that : an simple horizontal line with sharp focus and the rest of the screen blurry (even on my real Canon camera the tilt shift mode is based on that simple principle), but that not always produces a really convincing effect.

 

With 3D we can achieve a far more efficient tilt shift since we can have real depth taken in account. But for that we need 1. the ability to choose the quickness of the blur to appear (your magical aperture param, tragically lacks on the screenshot of Cities: Skyline you provided, resulting in a "fisher price" tilt shift) and the ability to define the averall strongness of the blur (I'd say 3 times stronger than actual one would be good). All other parameters you provided are just perfect!

 

And for macro photo DOF simulation, we would even need more strongness if we want to simulate that kind of pic. And I'm not even talkin about the background (we can put a map already blurred as wanted), but simply the blurred foreground showed here would be a great start :lol:

Link to comment
Share on other sites

Then maybe a good solution would be an additional blur pass on the already blurred parts of the screen, that can be enabled or disabled. This way it should be possible to achieve what you want without taking hundreds of samples per pixel :)

 

Also I found a very nice webGL lens blur with bokeh here: http://evanw.github.io/glfx.js/demo/#lensBlur

 

I'd be curious to see how the author did that!

Link to comment
Share on other sites

What a link!!!!! Oh man, thanks jahow it's the best image effects js library I've ever seen!!!

Don't know if I'll need it one day, but just to know it exists made my day.

(but it applies to pictures, I don't get why and how WebGL is involved in this lib... :blink:)

 

Do you think it's a big work to add this additional blur pass in your lens effect ?

Link to comment
Share on other sites

I saw also that in some macro photos, a technique to enhance the effect is to darken the out focus parts (the more out focus, the darker, same as the blur). Do you think it's possible to have an additionnal effect of this kind in your post process, with a param defining the amount (exactly like your chromatic aberration, or distortion params) ?

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...