Search Unity

Thought Id give DOF a try :)

Discussion in 'Made With Unity' started by reveriejake, Jul 26, 2008.

  1. reveriejake

    reveriejake

    Joined:
    Jul 8, 2007
    Posts:
    819
    So I was so excited about the release I thought id go ahead and throw a quick scene together... Here are some screenshots! Enjoy
     

    Attached Files:

  2. Alpha-Loup

    Alpha-Loup

    Joined:
    Jun 23, 2006
    Posts:
    797
    *shiver* I need to get pro... I need to get pro...

    Looks great! A bit too blurry in the far off for my opinion, but the depth effect is really stunning.

    Frank
     
  3. Alec

    Alec

    Joined:
    Mar 11, 2008
    Posts:
    1,330
    so does this work in real time? Because Unity seems to be becoming more cooler than CryEngine2. I'm serious.
     
  4. dock

    dock

    Joined:
    Jan 2, 2008
    Posts:
    604
    Wow!

    Do you have a web-player for this? It would be nice to see how this holds up in realtime.
     
  5. yangmeng

    yangmeng

    Joined:
    Dec 5, 2006
    Posts:
    573
    I am curious where people are seeing that DOF is a pro-only feature. On the release notes page (http://unity3d.com/unity/whats-new/unity-2.1), it lists three as pro-only:

    Scripted Asset Processing is a Unity Pro-only feature.
    Real-time shadows on terrains are a Unity Pro-only feature.
    Streaming asset bundles are a Unity Pro-only feature.

    But the Rendering with Shader Replacement section does not say this. But I couldn't get the shader replacement project to work with my Unity Indie so I am not sure what to believe!
     
  6. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Shader replacement is not Pro-only, and actually doesn't do anything that wasn't possible before (with manually swapping materials in OnPreRender etc.); it's just a lot more convenient now. The thing is, most of what you'd want to use shader replacement for requires render textures also, which are Pro-only of course. Like rendering the depth of the scene into a texture so you can blur it for DoF.

    --Eric
     
  7. Alec

    Alec

    Joined:
    Mar 11, 2008
    Posts:
    1,330
  8. reveriejake

    reveriejake

    Joined:
    Jul 8, 2007
    Posts:
    819
    Webplayer download :) of the scene..
     

    Attached Files:

  9. reveriejake

    reveriejake

    Joined:
    Jul 8, 2007
    Posts:
    819
    Everything is real-time even the cubemap on the ball is real-time!
     
  10. yangmeng

    yangmeng

    Joined:
    Dec 5, 2006
    Posts:
    573
    Now I get it. Thanks.
     
  11. Alec

    Alec

    Joined:
    Mar 11, 2008
    Posts:
    1,330
    Wow! This is really good for fps's with iron sights etc
     
  12. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,664
    Fas-kin-atin...

    After a very quick squiz of the demo...

    This is a great implementation of the idea of using Depth of Field in a game.

    The reflections in the ball are great.

    Coming from a photographic background I had some tho'ts.

    The blur seems just too blurry all over.

    The blur seemed to get too blurry too fast.

    Depth of field is related to depth of focus and focus - so when the object if very close to the camera, the depth of field is smaller/shorter. This seems pretty good in the demo. When the ball is very close to camera it works well. However, as the object moves away from the camera, and the camera should be focusing farther away from itself to keep the ball in focus, so the depth of field should grow as well. There were times when the ball moved very far away from the camera and became substantially smaller than a single field in frame, yet the depth of focus around the ball was the same size. This felt odd to me. The math for this is well established if you can implement it to work on the fly.

    Also - depth of field is a factor of the distance from the camera to the point of focus, not the distance from the object in focus, so the focus would be a band of all objects at the same distance from the camera - not the distance from the object in focus. This may be an optical illusion from the demo, but it seemed that the focus was being calculated as distance from the ball, rather than the camera. (But I easily could be wrong about what I was seeing...)

    Visually, the first thing that you are going to be fighting is the eye is used to an optical "out of focus" effect that is different from a straight forward digital "blur". There are algorithms that do this as well, but they may be too complicated for on the fly rendering.

    Looks great, and I look forward to seeing where this is going.
     
  13. Colin Holgate

    Colin Holgate

    Joined:
    Jan 15, 2007
    Posts:
    263
    One bad thing about the scene is that there's too much grass. I don't mean visually really, but for performance reasons there's too much. My poor fans are in overdrive, and I'm sure I'm not getting the intended frame rate.
     
  14. reveriejake

    reveriejake

    Joined:
    Jul 8, 2007
    Posts:
    819
    Well like I said at the top, it was a quick scene i put together... I seriously put it together in a couple hours! I have the same scene optimized, got rid of the real-time cubemap, decreased the amount of grass and rendering distance, shortened the clipping plane, and all around cleaned it up... Im almost sure the real-time cubemap is the cause of your computer working so hard though :)
     
  15. reveriejake

    reveriejake

    Joined:
    Jul 8, 2007
    Posts:
    819
    Hey, I posted a cleaner faster version of the DOF demo up above where the old one was... Hopefully this one is a little better!

    Jake
     
  16. Alec

    Alec

    Joined:
    Mar 11, 2008
    Posts:
    1,330
    how'd you get the ball so detailed??
     
  17. reveriejake

    reveriejake

    Joined:
    Jul 8, 2007
    Posts:
    819
    The ball is using a reflective bumpmapped shader with a cube map I attached to it... You can find the script for rendering the Cubmap somewhere on the script reference but im not sure off hand where that is... Hope that helps?

    I added you to my MSN so if you have anymore questions go ahead and ask...

    Laterz, Jake
     
  18. Alec

    Alec

    Joined:
    Mar 11, 2008
    Posts:
    1,330
    Oh cool, will be sure to ask for a step by step process ;)
     
  19. Red Ocktober

    Red Ocktober

    Joined:
    Oct 28, 2005
    Posts:
    84
    most excellent demo...

    --Mike