Author Topic: HDRI/Environment sampling causing Shadow artefacts  (Read 6728 times)

2022-02-28, 16:19:45

Phasma

  • Active Users
  • **
  • Posts: 112
    • View Profile
Hello.

I made a little test regarding HDRI Sampling and shadow casting as a collegue of mine always reports some issues in this regard. If Corona Sun/Sky is rendered, you get blurry 'bokeh' looking shadows casted. with an HDRI however the shadows appear pixelated. I tried different environment sampling options and it seems that nothing is changing this. I guess it is some kind of bug but I hope I'm wrong here. so If anyone could help/fix, it would be nice.

here is a comparison:

https://cloud.morietbrro.com/f/e3f83fea69b4421c820b/


2022-02-28, 16:31:17
Reply #1

hurrycat

  • Active Users
  • **
  • Posts: 111
    • View Profile
Do you get the same result with different HDRI Maps? Poly Haven is a good source.

2022-02-28, 16:40:12
Reply #2

Phasma

  • Active Users
  • **
  • Posts: 112
    • View Profile
yes. it is a general HDRI sampling thing. It is of course much more pronounced if there is a high contrast/sunny situation with real dynamic range (unclipped full dynamic range) and not just some ldr hdri.

2022-02-28, 17:45:25
Reply #3

pokoy

  • Active Users
  • **
  • Posts: 1850
    • View Profile
I guess the cause is a low-res HDR and what you see there is the effect of a pixel (or a rectangular area) being the main light source. Similar to how a camera works, the window acts as a lens and the shadows produce the blurry effect based on the shape of the light source, which is a circle. Similar to how shadow highlights get a crescent shape during a sun eclipse. So probably not a bug but rather the effect of accurate light simulation, and a low res HDR.

2022-02-28, 18:03:09
Reply #4

Phasma

  • Active Users
  • **
  • Posts: 112
    • View Profile
I now testet multiple HDRI's. our own 20k ones, but also 16k polyheaven hdri's. the effect with the polyheaven is still there, however they are a lot less intense and far away from beeing realistic reg. exposure range/colors. so all hdri's do this and the effect also gets more intense as resolution increases. in lowres the effect is more blurry and gets less 'edgy'

https://cloud.morietbrro.com/f/0e19aa371f8748e0bf3f/

left is sun/sky, right is an unrealistic polyheaven hdri
« Last Edit: 2022-02-28, 18:08:19 by Phasma »

2022-02-28, 19:35:33
Reply #5

pokoy

  • Active Users
  • **
  • Posts: 1850
    • View Profile
Things you could try is to disable adaptive enviro sampler, or check whether different filter setting in the bitmap/HDR map help.

2022-02-28, 19:35:53
Reply #6

romullus

  • Global Moderator
  • Active Users
  • ****
  • Posts: 8779
  • Let's move this topic, shall we?
    • View Profile
    • My Models
I don't see what's wrong in your last comparison, it looks normal to me. Of course, it's not realistic to expect same fidelity from limited resolution HDRI than you get from matematically perfect Corona sun. That's why you need filterring - to blur out those jagged pixels. My guess is that you turned down filterring blurring to absolute minimum, or even completely disabled it in the first example and that what's give you that unwanted result. Or it could be that that particular HDRI is flawed, or non-standard - there were cases when Corona bitmap couldn't handle some HDRIs properly, but usually after you provide such HDRI example to the team, they are able to fix something in the code and the issue would be gone.
I'm not Corona Team member. Everything i say, is my personal opinion only.
My Models | My Videos | My Pictures

2022-03-01, 10:42:50
Reply #7

Phasma

  • Active Users
  • **
  • Posts: 112
    • View Profile
Hi. thanks for all the input.

I tried all bitmap filtering options as well as all environment sampling options together now in a test scene. also testing out coronabitmaps and standard bitmap textures. nothing works.

this time I try to give you better insights of the test setup:

This test scene has a perforated part with some holes in it. the shadow on the inside wall is recorded by one camera, the sun is recorded also directly.

note that the hdri is 20k in size. the sun disk is perfectly round and has lots of pixel to be drawn round. the corona sun is obviously sharper but that does not explain why the shadows are square. suns are round, holes are round so shadows need to be as well for the hdri. examples below are all with default filtering and blur 1.0 - if I blur more, see the last image of still rectangular shadows - something here is really strange.

« Last Edit: 2022-03-01, 11:17:43 by Phasma »

2022-03-01, 11:30:58
Reply #8

pokoy

  • Active Users
  • **
  • Posts: 1850
    • View Profile
By environment sampler I meant the 'Adaptive Light solver', sorry for the confusion.

I tested this here, too, with a Corona Sun, an HDR (8Kx4K, Bitmap and CBitmap with both spherical and dome mode) and even a crescent shape with a Light Mtl, all aligned to produce the shadow in the same exact spot. Two holes in a box, one round, the other square shaped, same size... it works correctly, even the crescent shape producing (almost) same result for both holes, correctly picking up the light source shape.

I wonder if this has to do with units (mine are set to meters) but why should it matter.
Also, as this has helped others in similar weird cases, maybe reset Corona settings.

Other than that, I have no idea, a dev might have some more insight here.

I could imagine having your repro scene that produces wrong results would be good to have for others to test.

2022-03-01, 11:45:58
Reply #9

Phasma

  • Active Users
  • **
  • Posts: 112
    • View Profile
Hello

I also tried disabeling the Adaptive Light solver, no change

When it comes to the test scene: make sure the shadow casting is far away from the holes (and make the holes small). This is all about blurry shadows not beeing rendered correctly (such as outside trees casting nice fluffy shadows on interior walls) - in general the shadow casting works as expected. the blurrier the shadows get however, the more square they get as well. this is not happening with a corona sun that produces nice, almost - background out of focus 'bokeh' - like shadows. I would really like to see this with HDRI's as well

2022-03-01, 12:25:44
Reply #10

pokoy

  • Active Users
  • **
  • Posts: 1850
    • View Profile
That's why I said you should provide your repro scene so people/devs have the right setup.

I can confirm it - with tiny holes I'm seeing it, too. Sun and Crescent shape with LightMtl still work fine, but the HDR produces a rectangular light spot.

A workaround you probably thought about yourself already would be to clamp the HDR (so the HDR only produces ambient light but not sunlight) and place a Corona Sun in the same spot. I guess probably wanted to avoid that, it's making it all more cumbersome.

2022-03-01, 12:58:26
Reply #11

Phasma

  • Active Users
  • **
  • Posts: 112
    • View Profile
That's why I said you should provide your repro scene so people/devs have the right setup.

sorry - the scene itself would not be an issue. but the hdri itself and the creation of it is something bigger that i can not just give away atm. so i might only upload the scene then...

good that you can confirm it now. I also tested the HDRI mapped on a sphere now and this seems to work fine - however it renders a loooot longer and therefore is no excaptable workaround.

So I guess this is some kind of bug/limitation and I would kindly ask to fix it please :-) - We are planning to make a whole hdri/light/camera system commercially avalible and the hdris that we scan ourselves should be spot on in corona as well (yes, the cromatic aberations will be removed for the sun :-) )

2022-03-02, 13:49:54
Reply #12

Phasma

  • Active Users
  • **
  • Posts: 112
    • View Profile
Works in fStorm...


2022-03-03, 12:00:13
Reply #13

silverprop

  • Users
  • *
  • Posts: 1
    • View Profile
UP!
I want to see some dev. involvement. I have had this exact same issue before, specially noticeable in interior images when using image base lighting only. It would be nice not having to resort to cumbersome workarounds (Im already cutting holes into my backplates to let the sun pass in order to avoid shader artifacts on reflective objects...).

2022-03-09, 17:45:02
Reply #14

Phasma

  • Active Users
  • **
  • Posts: 112
    • View Profile
Still no reaction from the devs? I kinda think it is sad, that such an everyday thing like area shadows do not work properly in Corona....