better refraction

Issue #1368 resolved
Alessandro Padovani created an issue

daz studio 4.21.0.5, blender 3.4.1, diffeomorphic 1.7.0.1400

This is related to #1306 where it is reported some difference with the iray refraction.

As for refraction we have an issue from some time now that we never noticed. That’s we use the fresnel for surfaces aka reflection, where the back sides are clipped. That doesn’t happen for volumes aka refraction, so in that case the fresnel gets dark.

To fix this I introduced a new output for the daz fresnel group, that doesn’t take into account backsides.

Then in the daz refraction group we can use the new output. Also in my tests a power of 3 seems to better mimic iray.

note. As an alternative we could just use the standard blender fresnel node for the daz refraction group, but that doesn’t take into account the roughness.

note. We may just call it “daz fresnel“ instead of “daz fresnel 2“. Since we don’t have multiple fresnels anymore but just one with multiple outputs.

note. important. The tests with refraction also revealed a better factor with volume, since the props in #1306 use volume to tint the glass instead of using the glossy color. We use 200 instead of 100 for the absorption factor. Note that this is only for the absorption density, in my tests the scatter density is good with 100.

# daz volume better factors
absorption density = 200 / iray transmitted measurement distance
scatter density = 100 / iray scattering measurement distance

Below there’s the result with the test scene bottle.duf, that’s using the asset below. I preferred using the daz store assets for testing since simple primitives are not enough to spot the complex behavior of refraction, and that’s probably why we didn’t notice it in the first place.

https://www.daz3d.com/magical-potions-and-bottles

Comments (19)

  1. Alessandro Padovani reporter

    note. In #1306 it is also asked if we can improve the glass for eevee. But given that the specific assets use volume to tint the glass in this case eevee can’t be any good. Will see if I can do something though but not now. The above is a good improvement for cycles.

  2. Joe Morris @ FAST Animation Studio Toolz

    Thank you so much for figuring this out … Maybe you guys can put a button on your interface that makes cycles look exactly like iray once you'd figure out all the things…. That's what I would like to see

  3. Alessandro Padovani reporter

    Usually Thomas will fix the code so you don’t have to fix it yourself by hand. There’s your “button“.

  4. Joe Morris @ FAST Animation Studio Toolz

    You guys rock…. That's why you should make a polished website because you guys deserve a parade… People look at the bit bucket interface and they don't realize that is a seriously badass add-on… It's so awesome it's not just an add on it's 2 major pieces of 3d software made one…you deserve a parade!

  5. Alessandro Padovani reporter

    update. FIX FOR THIN WALLED.

    daz studio 4.21.0.5, blender 3.4.1, diffeomorphic 1.7.0.1480

    It is reported in #1457 that the new fresnel doesn't work for G9 eyes. This is true and it is because the eyemoisture material is thin walled, so we have to use the dielectric fresnel in this case since there's no volume.

    To fix this it is convenient to split the "daz refraction" group into two groups "daz refraction" and "daz thinwalled", where thinwalled is used when thin walled is on in daz studio.

    # select refraction group
    if thin walled = on
        use daz thinwalled
    else
        use daz refraction
    

    Then the implementation of the two groups is as below, where essentially we use transparency and dielectric fresnel for thin walled.

    Then below the G9 eyes with the fix above.

    note. It is suggested in #1457 to use the camera rays to clip shadows, but this can't work in the general case, not even for thin walled. Below an example with a simple crystal balls scene. The blue is thin walled and the red is not.

    Please note that iray does better caustics, but I didn’t use the new caustics features in blender 3.1 to render the scene.

  6. Alessandro Padovani reporter

    As for commit 5a3c0dd.

    minor bug. The refraction roughness input is not used for thin walled since there’s no volume thus no refraction roughness. It doesn’t harm but would be correct to remove it. Let me know.

  7. Log in to comment