HDRI Explorations 1

Heya floofs!!

This week I've been studying how to light a scene and improve render times. This is important for animations since I want to do complex characters and environments, but just have my desktop PC video card to handle all the rendering.

In Blender or Daz 3d, one approach to lighting a scene is to carefully place lights of different sizes and shapes and set the brightness levels one by one. It takes a long time to set up a satisfactory scene since most environments have a bunch of small light sources that all need to be well located and meticulously balanced.

In fact, the more lights I add, the longer the scenes take to render, as well! :O This is particularly true in Blender, especially when using Cycles (the highest quality renderer) with a lot of lights.

Why?

In a real world environment, light bounces around a lot, and most materials don't absorb all the light. Surfaces that reflect light act just like dimmer colored lights all on their own! The bounced light then re-bounces off additional surfaces, rinse-repeat until the last of the light is absorbed.

3d software tries to model that phenomenon using "physically based rendering" (PBR), letting artists create materials that describe visual properties of a surface: like diffusion, glossiness, specular, and refraction. During rendering, the software simulates light bouncing around the scene by "raycasting" a bunch of light rays from each light source, doing the bounce math at each contacted surface so we can enjoy physically-realistic and believable renders.



To quickly set up lighting and get faster render times, artists can use something called High-Dynamic Range Images (HDRIs). An HDRI is a flat image - often a real world photograph taken in panorama by spinning a camera with a wide angle lens in 360 degrees - combined in layers at different exposures.

This image is from https://www.willgibbons.com/hdri-vs-physical-lights-in-keyshot/ which is also some great further reading.




In 3d software, the HDRI is then projected onto the inside of a sphere, providing lighting information for all the objects in the scene. It's kind of like a "skybox" in video games - it's both a background image, and it also emits its own light.

Imagine visiting a location on Google Street View, placing 3d models there, and having them all lit with the lights and colors you see in the Street View photo. Pretty slick!

This scene rendered in 15 seconds in Daz 3d with NVidia Iray. The HDRI is from somewhere in Italy.



The results of using HDRIs aren't perfect, since light is approximated using exposure levels, and all lights are the same distance away from each object. You can't have a candle flame nearby and a sun far away, for example. It's also pretty hard to do background motion like animated water. But it's FAST to set up and render, and can produce some mostly-photoreal, stylized, or abstract results, especially during animation when things are moving around and distracting the audience from analyzing the lighting accuracy. >w>



OKAY enough technical background! I was curious what I could do with HDRIs, and whether I could make my own. I loaded up a stylized low poly Unity scene using 3rd party art assets and rendered out a wraparound image using a 3rd party screencap script. There's some glitching in a few places but parts of it are smooth enough to be useable. I've still gotta figure out how to make it perfectly blended.



In Blender, I set up the HDRI sky to light my scene and serve as the background. Then I grabbed a freebie aircraft from CGTrader and set up a very shiny, reflective material so we can see how the sky interacts with the material. Finally, I did a quick flyby animation with camera movement and touched up the frames in photoshop.

You can grab this in 1080p on Discord! (I can't attach mp4's here.)



It only took 1 minute 28 seconds to render a set of 250 animation frames in 1080p! Frames were actually rendering in .09 seconds each, so most of the time was saving out the PNGs to my slow hard drive. That's SUPER FAST.

The bonus is that this HDRI was created in Unity and looks just like the source scene. There are a zillion tools for prop scattering, level generating, terrain sculpting, art stylization, and more that make Unity a fast place to create interesting environments. I'll definitely be exploring this workflow further. ^.^

If you dabble in 3d and are interested in exploring HDRIs yourself, you can get free ones here!
https://polyhaven.com/hdris