Home 3D Art Showcase & Critiques

Unity3D Natural Bloom and Dirty Lens Live Demo

Hey, everyone! I've put together a visualization of an image effect I've recently created for Unity3D that provides high quality bloom (done the right way) and a dirty lens effect. The effects are energy-conserving and highly optimized. The effect costs roughly twice as much as rendering Unity's optimized bloom effect (1.0 + 0.5 + 0.25 + 0.125 + 0.0625 + 0.03125) and produces very large and perfectly smooth highlights. To try to achieve the same effect with built-in image effects, you would have to stack at least 6 bloom effects, and even then Unity's bloom does not allow for large or smooth enough kernels. I've tried, which is why I decided to write this image effect. Unity's Profiler reports that the effect is rendered on my gpu (GTX 560 TI) at ~0.8 ms rendering at 1440 x 900.

Please let me know what you think! http://sonicether.com/unitydemos/se_natural_bloom_01/

bloomDemoScreenshot.jpg

Replies

  • Jesse Meyer
    Options
    Offline / Send Message
    Looks great!

    What does 'energy conserving' mean when the light is emissive, and not reflective?
  • ewHurtado
    Options
    Offline / Send Message
    Gotta say, Pretty impressive! Enjoyed the demo! Nice touch with the dirty lens.
  • Shadownami92
    Options
    Offline / Send Message
    Shadownami92 polycounter lvl 7
    Looks fantastic on my end and runs really well and that is without having anything other than integrated graphics!
  • Sonic Ether
    Options
    Offline / Send Message
    Thanks, guys! Good to hear that things are running smoothly on integrated graphics, too :)

    @Jesse Meyer: The bloom and dirty lens effects themselves are energy-conserving, meaning, they are not blended additively like most would suspect. Basically, the lens dirt effectively 'scatters' light without actually adding light that wasn't originally there. This ensures that there are no false highlights on areas where there is constant color. For example, if the dirty lens effect were not energy-conserving, you may see the lens dirt texture on the background even when bright objects are not nearby.
  • darkmag07
    Options
    Offline / Send Message
    darkmag07 polycounter lvl 12
    Yeah, as others have said this looks pretty great!

    Running on a 4 year old laptop I'm getting 20-40 FPS in the web player. Seems to actually lag more due to the animation than to the effects. I'm only really noticing a 5-10 frame difference when using reasonable values and having them off completely.
  • Docm30
    Options
    Offline / Send Message
    Docm30 polycounter lvl 10
    Nice work, it looks great. I also got a steady 60 FPS on my 4 year old laptop, so it certainly runs well.
  • System
    Options
    Offline / Send Message
    System admin
    Really nice stuff, I'd like to see it working in an environment too :)
  • Shrike
    Options
    Offline / Send Message
    Shrike interpolator
    Looking good, will definitely consider it for our project when it goes live

    But how do you control the strength of the emission ? I mean does it glow like that
    if the surface is pure white, or did you use values going over 1 for those emissive objects ?

    It would not be as nice if you had normal stuff with crazy strong bloom just to have the emissive ones work with that power

    I hope you understand what I mean
  • commador
    Options
    Offline / Send Message
    commador polycounter lvl 14
    I got a smooth 50fps with Intel HD4000 on my laptop. Really nice work. Will this be available in the asset store?
  • Sonic Ether
    Options
    Offline / Send Message
    Shrike wrote: »
    Looking good, will definitely consider it for our project when it goes live

    But how do you control the strength of the emission ? I mean does it glow like that
    if the surface is pure white, or did you use values going over 1 for those emissive objects ?

    It would not be as nice if you had normal stuff with crazy strong bloom just to have the emissive ones work with that power

    I hope you understand what I mean

    Good question, Shrike. Since Unity's HDR pipeline allows for shaders to output colors greater than 1, I have written a shader that outputs emissive colors of much greater than 1. Since this post effect is bloom done the right way--no threshold and energy-conserving--only objects that are significantly brighter than surrounding objects will emit a visible glow. Unity's standard workflow is very ill-suited for high dynamic range images, which proper bloom really requires. That's why I have written an emissive shader that outputs very bright values.

    So, to address your concern, bloom will only be visible when there are colors/objects in the scene that are significantly brighter than surrounding objects. In the case of this demo, you can see in the screenshot I posted in the OP, the glossy and un-illuminated icosahedrons themselves are not very bright, so they don't really emit a glow. The center cube is emitting light up to around 2,000 times brighter than "white", which is why it glows so intensely. The intense emission shader I've written can output colors at around 22,000 times brighter than "white" without color clipping.

    This is the key to good looking bloom. Many graphics artists think they need to rely on a threshold bloom, because the moment they crank up their bloom enough for their "bright" objects to glow enough, pretty much everything else is glowing. The key is to apply bloom uniformly to everything, with no threshold, but at a very very subtle value so that only very bright objects "trigger" the effect.

    Here's another screenshot to demonstrate what I've been talking about (forgive the ugly test scene). You can see that the "normal" objects in the scene really have no noticeable glow on them at all. I've placed a very bright sphere in the scene that is the only thing that triggers the effect.
    normaltest.jpg
  • Jesse Meyer
    Options
    Offline / Send Message
    Thanks, guys! Good to hear that things are running smoothly on integrated graphics, too :)

    @Jesse Meyer: The bloom and dirty lens effects themselves are energy-conserving, meaning, they are not blended additively like most would suspect. Basically, the lens dirt effectively 'scatters' light without actually adding light that wasn't originally there. This ensures that there are no false highlights on areas where there is constant color. For example, if the dirty lens effect were not energy-conserving, you may see the lens dirt texture on the background even when bright objects are not nearby.

    Thanks for the explanation!

    You work on the kick ass Minecraft shaders right?
  • Sonic Ether
    Options
    Offline / Send Message
    Thanks for the explanation!

    You work on the kick ass Minecraft shaders right?

    Yep, that's me :)
  • Jesse Meyer
    Options
    Offline / Send Message
    You're inspirational. Nice to see you around these parts!
  • limesimme
    Options
    Offline / Send Message
    limesimme polycounter lvl 11
    Just a quick question, why, even with 0 amount of bloom does the effect show once the Lens Dirt is added?
    With 0 Bloom 0 Lens dirt nothing is illuminated, but once you add the lens dirt it blooms up.
    Intentional or have I misunderstood?
  • Sonic Ether
    Options
    Offline / Send Message
    limesimme wrote: »
    Just a quick question, why, even with 0 amount of bloom does the effect show once the Lens Dirt is added?
    With 0 Bloom 0 Lens dirt nothing is illuminated, but once you add the lens dirt it blooms up.
    Intentional or have I misunderstood?

    Dirt on lens generally scatters light anisotropically. This means that as the angle from the incoming light increases, the general amount of scattered light decreases. This basically creates a "glow" effect that is very similar to bloom. The lens dirt texture serves as a per-channel coefficient that determines how much light is scattered.

    The bloom and the dirty lens effects are separate from each other, but are simulated in similar ways. I may consider a more advanced simulation in the future, but to keep things nice and speedy, I've decided that this was the best way to go.


    I would also like to let you guys know that, after some thought and processing input from a friend's advice, I've decided to submit this to the Asset Store. I've been busy getting documentation, GUI, and workflow all polished up for submission. I'll probably submit within the next few days, and I will keep everyone here updated as things develop.

    The only thing I'm unsure about is how much to ask for this asset. This asset will include the image effect, 16 high-quality dirty lens textures (IMHO better than the one I used for the live demo), thorough documentation, the demo scene I posted in the OP, and a custom emissive shader that can output very bright values (used in the demo in the OP). The documentation will also include a tutorial for non-programmers on how to edit any surface shader to output brighter light to make HDR workflow easier in Unity.

    So I ask, what do you think is a fair price for this asset? Thank you for your input :)
  • xvampire
    Options
    Offline / Send Message
    xvampire polycounter lvl 14
    whoa you really THAT (minecraft) Sonic Ether
    im one of big fan of your work!

    as for the bloom :
    runs well on my browser, it looks great

    sorry if i miss some explanation
    but is it reacted phisically when the object reflects a very bright light from the light source( like using specular or reflection) like in UE4?
    or is it emmisive based effect?
  • Sonic Ether
    Options
    Offline / Send Message
    xvampire wrote: »
    whoa you really THAT (minecraft) Sonic Ether
    im one of big fan of your work!

    as for the bloom :
    runs well on my browser, it looks great

    sorry if i miss some explanation
    but is it reacted phisically when the object reflects a very bright light from the light source( like using specular or reflection) like in UE4?
    or is it emmisive based effect?

    Yep, that's me! Well, thank you! I'm flattered :)

    This image effect reacts to any significantly bright pixels in the scene, whether that's coming from particles, bright lights, specular highlights, or emissive materials. Any significantly bright pixel in the scene will contribute to the effect.

    That's not to say that this effect uses a threshold, however. In real-life, light does not scatter differently based on how bright it is. Your camera doesn't care how bright light is, it'll scatter all of it the same way. This image effect is similar. All light in the scene is being scattered to create bloom and dirty lens, it is simply undetectable when there isn't enough contrast in the scene to make the effect visible. All this effect needs is enough contrast in a scene.
  • lashman
    Options
    Offline / Send Message
    lashman polycounter lvl 6
    Dirt on lens generally scatters light anisotropically. This means that as the angle from the incoming light increases, the general amount of scattered light decreases. This basically creates a "glow" effect that is very similar to bloom. The lens dirt texture serves as a per-channel coefficient that determines how much light is scattered.

    The bloom and the dirty lens effects are separate from each other, but are simulated in similar ways. I may consider a more advanced simulation in the future, but to keep things nice and speedy, I've decided that this was the best way to go.


    I would also like to let you guys know that, after some thought and processing input from a friend's advice, I've decided to submit this to the Asset Store. I've been busy getting documentation, GUI, and workflow all polished up for submission. I'll probably submit within the next few days, and I will keep everyone here updated as things develop.

    The only thing I'm unsure about is how much to ask for this asset. This asset will include the image effect, 16 high-quality dirty lens textures (IMHO better than the one I used for the live demo), thorough documentation, the demo scene I posted in the OP, and a custom emissive shader that can output very bright values (used in the demo in the OP). The documentation will also include a tutorial for non-programmers on how to edit any surface shader to output brighter light to make HDR workflow easier in Unity.

    So I ask, what do you think is a fair price for this asset? Thank you for your input :)

    I think $30 would be a fair price if the documentation is good and the post-sale support is awesome :)
  • Sonic Ether
    Options
    Offline / Send Message
    I just wanted to let everyone know here that I have submitted the asset and it was just published on the Asset Store today! The price I decided on was $20.

    Go check it out! https://www.assetstore.unity3d.com/#/content/17324
  • killnpc
    Options
    Offline / Send Message
    killnpc polycounter
    shiny!

    you should put the link to your demo at the top of your store item details in bold so people are more likely to click it. rather than reading a block of text and scrolling down to even see it. the store should consider adding a demo / preview button.
  • lashman
    Options
    Offline / Send Message
    lashman polycounter lvl 6
    holy crap ... it's today's staff pick!! :D well - that was fast :) guess the guys at Unity HQ really like it too :D nice
  • Teessider
    Options
    Offline / Send Message
    Teessider polycounter lvl 11
    Sonic Ether, your work is great! Will be definitely recommending this at work :D
  • Jeremy Mitchell
    Options
    Offline / Send Message
    Jeremy Mitchell polycounter lvl 6
    I'm going to shoot myself in the foot by saying this, but you could probably sell this for $100 easily. You're too humble.
  • lashman
    Options
    Offline / Send Message
    lashman polycounter lvl 6
    I'm going to shoot myself in the foot by saying this, but you could probably sell this for $100 easily. You're too humble.

    I'm sure he'll keep that in mind for his next asset :D haha
  • KassEscoe
    Options
    Offline / Send Message
    KassEscoe polycounter lvl 3
    yea so im totally making the first image my new phone background, its stunning!
Sign In or Register to comment.