RealityKit: Creating sharp shadows with lighting

123 Views Asked by At

I am trying to create a scene with gorgeous looking lighting and shadows. I created and loaded a single model (USDZ) from my modeling software (Cinema 4D) into RealityKit.

Here's what it looked like in Cinema 4D after a quick render:

A screenshot of a coastal scene in Cinema 4D, with sharp shadows and lighting.

As you might notice, the lighting is even, with great highlights. There are sharp (but not too sharp) shadows from the rocks.

This looks really great, and I am trying to replicate this (or even better) in my RealityKit app. This lighting in this first image was created with a physical sky object, which is basically an HDR (image based lighting) applied in the modeling software.

However, after doing a lot of research on the topic of lighting and shadows in RealityKit, I can't figure out how to get my scene to look like this. I used a DirectionalLight and placed its anchor at [0, 0, 0] for the world, which is around the center of the square in the middle of the view. I set that light to look at [0, 0, 0] from many different points, but right now it's looking from [0, 0, 25]. So, the light should be basically on the horizon, 25m out over the ocean from the flat plane in the middle. Kind of like a sunset.

I end up with this:

A screenshot on an Xcode iPad simulator of a coastal scene without sharp shadows and overexposed lighting/highlights.

Of course, the first image looks WAY better than the second. I can't figure out how to get the right intensity and distance to make it look better.

This model is one asset, and so it's all loaded in at once.

I drew some shadows to get the idea across of what I want. Basically, it needs to look like my render in the first image.

I know how to adjust color of the lighting, etc. but I cannot figure out these shadows or how to make it look evenly exposed and highlighted properly, like in the first image.

I thought about using an HDR directly from my modeling software, but I want to animate this light later on, to show the timing at different times of the year/day/night/etc.

Am I using the correct lighting setup? What am I doing wrong? How can I do this? My own shadow component?

0

There are 0 best solutions below