I believe I nailed V8 (aka true iray skins)

Issue #24 resolved
Alessandro Padovani created an issue

tested with daz studio 4.12.0.86, blender 2.82, plugin commit 044dc16

First let me tell it was a lot of fun to play with this and I also learned a lot about iray and cycles in the process. Then I have to thank engetudouiti for his posts on sss that also helped me. Well now let's get to it.

The issue with iray skins, and why we couldn't get it, is iray doesn't use sss. Yes you read it right. What is called sss in the uber shader is really a true volumetric solution. This is also why iray is so slow rendering skins. It is also not physically correct since skins are not volumes, but since it's the iray way we have to follow.

So below there's an implementation of the iray sss. It uses translucency as we already do, together with volume absorption and scatter to mimic what iray does. Please note that the uber shader gets transmitted and scattering distances, while cycles gets volume densities. This may seem conflicting at first, but the uber distance is really a distance from the surface where the transmission or scattering effect is at 100%, so it really defines a density and it is possible to convert to cycles.

# if there's transmission then use volume absorption
if transmitted color <> black/white
    use volume absorption
    color = transmitted color
    density = 200 / transmitted distance

# if there's sss then use volume scatter
if chromatic sss color <> black/white
    use volume scatter
    color = invert(sss color)
    density = 100 / scattering distance
    anisotropy = sss direction
# please note that sss amount can also be > 1 in some characters
# this is fine since color slots accept values > 1
if mono sss amount > 0
    use volume scatter
    color = sss amount
    density = 100 / scattering distance
    anisotropy = sss direction

Please note that for this implementation to work we have to setup a good light path solution in cycles. Because both translucency and true volumes are used. So it is especially important to have good values in the transmission and volume max bounces.

Please also note that this solution will not work with eevee, since eevee doesn't get true volumetric features. Then I'm not an eevee expert so this is it afaik. For this reason I'd propose to let the old sss solution as an alternative for eevee, or for anyone who prefers to get sss rather than volumes for performance reasons.

If I may I'd also suggest to add a third option for skins, that is, to use only translucency ignoring the iray volume properties. This will de facto work as if thin walled is on. The reason for this third option is that for many characters, especially those converted to iray from G1-G3, it seems using the translucency alone works quite fine. Much better than the actual sss implementation that never matches iray anyway. One example if the G8F.

skin options:
- volumetric (iray)
- translucency only
- sss

Actually I'm working on translucency and sss and I feel I may get something better than the actual implementation. Though it will not match iray but hopefully will be closer. I'll open a new issue for this when I'll have some results.

Finally below there are some examples of skin conversions by using the volumetric implementation. First iray then cycles. I only fixed the torso materials in cycles, so you can see the new volumetric skin vs the old sss one. Please note that though the volumetric skin is always much better, in some cases there's a little difference with iray. I believe this is due mainly to tone mapping and tranlucency, for which I'm working to may be get better factors.

EDIT. G1-G3 characters were converted to the uber shader before exporting. This is because iray anyway does it in the background when you render 3DL shaders. To do this just select all the materials in daz studio and apply the uber shader, it's really a couple clicks.

G1F and V5

G2F and V6

G3F and V7

G8F and V8

Some G8 characters: Emiyo, Gia, Kala, Lali, Mei Lin, Penny, Vivian

Comments (11)

  1. Alessandro Padovani reporter

    Unfortunately commit 2475f9a doesn't seem to work. May be I wasn't clear enough. We can't use sss to translate the iray skins, because iray doesn't use sss. We have to use translucency instead, together with volume absorption and scattering. Commit 2475f9a uses sss together with volume that doesn't work, and doesn't make sense either because volume needs translucency to work, you cannot see volume trough sss. Below an example.

    Please Thomas feel free to ask if something is not clear. I’ll try to help as best as I can. Also it's not clear to me how do you wish to handle the user choice for skin translation. I mean there has to be a way for the user to choose between sss or volumetric skin. Also I'd strongly recommend the third translucency option described above because it really works fine for many characters.

    if thin walled is on
        use translucency
    
    if thin walled is off
        for volumetric skin
            use translucency plus volume
        for translucency only skin
            use translucency the same as thin walled on
        for sss skin
            use sss (without volume beacuse volume needs translucency to work)
    

  2. Thomas Larsson repo owner

    It’s not yet perfect, but definitely an improvement. Although V8 skin seems too dark imo.

    Is it really necessary to add another user option? It seems to me that the material knows if it is volumetric or uses translucency or sss.

    Btw, is there a tutorial how to convert older assets to iray? I’m not so good at actually using DS, and didn’t find how to apply the uber shader.

    The V8 result for Eevee is horrible, especially when rendered in Eevee, but that may be because the scene is too heavy for my graphics card. In Eevee, volumetrics is ignored. Perhaps translucency should be ignored to.

  3. Alessandro Padovani reporter

    Commit 2f000a1 works almost fine. There are just a couple issues.

    ISSUE 1. The diffuse overlay needs to be overlayed after the translucency pass, that's at the end of the diffuse chain in iray. That is, the diffuse overlay doesn't mean to be an overlay to the base color, it does mean to be an overlay to the whole diffuse chain.

    Below an example with the V8 eye, first iray then cycles before and after the fix.

    ISSUE 2. I guess this is related to #19. It seems the sss reflectance tint indeed doesn't translate right. I'm not able to understand why. All the other colors seems to be good. Below an example where I have a (0.22,1.0,0.22) tint that gets translated into (0.502,1.0,0.502) in cycles. I know the base color gets multiplied by the reflectance tint but in this case the base color is white. The duf file is included it's just a simple sphere.

    Please Thomas may you look at it and tell me why the tint gets changed ? May be it's not a bug and I'm just forgetting something simple but I can't figure it out. Thank you.

  4. Alessandro Padovani reporter

    END BUG REPORT AND START Q&A

    Q1. As for the V8 skin I don't know what you mean by "too dark", it works fine for me. That is, I get the same result in iray and cycles depending on the light conditions. Below a couple examples, first iray then cycles. The first uses the default hdri, while the second uses only a sphere light.

    Tone mapping is also important. I used a filmic view that's good enough to match the middle tones with iray.

    Q2. As for the user options for skins, that would be the same as the user options for opaque and refractive materials that we already have. The advantage of choosing the skin type is because the volumetric skin can be very slow and doesn't fit animation very well. Also afaik it doesn't work with eevee. So some users may want to opt for the sss or translucency options instead, even if the volumetric option is more accurate.

    Q3. As for applying the uber shader it's really a couple steps.

    1. Select all the items in the scene then rmb > select children. This way you have everything selected, even outfits and hair that are usually parented items.

    2. Select all the materials in the surfaces panel.

    3. In the shader presets select and apply the uber base. After that you can see that all your shaders are iray uber.

    Q4. As for eevee I fear I can't help much at this time since I'm focusing on cycles. I'm quite sure the volumetric option will not work but there's people at the daz forum that pointed out some volumetric capabilities in eevee. As for sss and translucency they should work in eevee, though translucency doesn't seem to get the same result as cycles.

    Below an example with the G8F where I turned on thin walled in the iray skin surfaces. Thus only translucency remains. First iray then cycles then eevee.

  5. Thomas Larsson repo owner

    Issue 1: When I put the overlay after translucency (but before dual lobe), I get these weird artifacts around the brows. I have nevertheless committed the change so you can look at it.

    Issue 2: If you click on the greenish color and open a color selector, the color is indeed (128, 255, 128), which corresponds to [ 0.5019608, 1, 0.5019608 ] which we have in Blender and in the duf file. Weird.

  6. Alessandro Padovani reporter

    issue 1. I don’t get those artifacts in cycles. May it be that you resized the textures ? If so the alpha channel may be affected. I’ll check the commit as I get home.

    issue 2. Yes the color in the duf file is (0.502,1.0,0.502) but it is gamma corrected and it needs to be powered by 2.2 to get into blender (see #19), thus giving (0.22,0.1,0.22) that’s the correct color.

    Is there any reason why the sss reflectance tint is not powered the same as the other colors ? I feel this may be the bug.

  7. Alessandro Padovani reporter

    As for commit 5283b71 I can confirm I have no artifacts for the eyebrows. I also tried resizing textures both with cycles and eevee. They work fine.

    But I can get those artifacts if I use very low values for the path tracer. This is not a bug though it is normal because this way cycles doesn’t have enough information to process the scene correctly.

    I’ll wait for issue 2 that needs to be powered by 2.2.

  8. Alessandro Padovani reporter

    Commit 2c7b503 seems to work fine. Please Thomas consider making the new volumetric skin as an option to the old sss, so the user can choose freely. This is also requested in the daz forum bacause the new volumetric skin is slow compared to sss so doesn't fit animation too well.

    Please let me know what's your final decision so I'll mark as resolved anyway.

    https://www.daz3d.com/forums/discussion/389931/true-iray-skins-for-blender-are-on-the-way

  9. Alessandro Padovani reporter

    Commit 48c42e7 seems to work fine, marking as resolved.

    Thank you Thomas for the volumetric options. I guess that makes everyone fine, both the photographer who wants high quality skins for rendering, and the animator who wants fast skins though he will need to fix them himself.

    edit. See #27 #117 #898 for more fixes.

  10. Log in to comment