Search Unity

Daz3d's HDRP shader is broken

Discussion in 'Shaders' started by Nodice, Dec 31, 2020.

  1. Nodice

    Nodice

    Joined:
    Apr 14, 2020
    Posts:
    6
    Daz3d has a free DazToUnity system that works, but their skin shader is broken. It was working about 2 months ago and I'm not sure if it was a change to unity or Daz's scripts that broke it.

    The error is: Shader error in 'Daz3D/IrayUberSkin': maximum ps_5_0 sampler register index (16) exceeded at line 5939 (on d3d11) on compile.

    Anyone with more Shader Knowledge than me (Everyone), chime in to what is needed to fix it?

    I've attached the Shaders as they are available free from Daz3d.
     

    Attached Files:

  2. Invertex

    Invertex

    Joined:
    Nov 7, 2013
    Posts:
    1,550
    There are 16 Texture Sample nodes in that graph. The limit as the error mentions is 16 samplers for shader model 5.0.

    Unity uses a few of its own samplers when shaders compile that support lightmapping (and maybe some other stuff now in HDRP), so usually the limit for your own shaders is around 13 samplers in Unity when making a standard fully lit shader.

    To get around this you instead want to define your own Samplers to use for multiple Sample Texture 2D nodes, instead of letting each Sample Texture node use its own Sampler that is generated using the (Wrap/Filter Mode) options on the Texture's import settings.

    Create a Sampler State and plug it into a bunch of the Sample Texture 2D nodes' Sample(SS) slots.
     
    x1alphaz1 likes this.
  3. Nodice

    Nodice

    Joined:
    Apr 14, 2020
    Posts:
    6
    Since this is my first time working with shaders or the shader graph i will have to reread what you wrote a few times and learn each part. I greatly appreciate your help. At least I have an action plan.
     
    x1alphaz1 likes this.
  4. Nodice

    Nodice

    Joined:
    Apr 14, 2020
    Posts:
    6
    That worked! Well at least after adding the same sampler state to 4 sample texture 2d nodes the shader compiled.

    You are truely awesome Invertex
     
    x1alphaz1 and Invertex like this.
  5. Nodice

    Nodice

    Joined:
    Apr 14, 2020
    Posts:
    6
    Here is my fixed version.
     

    Attached Files:

    x1alphaz1 and tree_arb like this.
  6. tree_arb

    tree_arb

    Joined:
    Dec 30, 2019
    Posts:
    323
    Quality post!

    Is daz a good resource? Good characters and work with unity? Years ago i remember they had some nice stuff but I thought the license was weird or something, limited, couldn't use in games? Did/do they also own poser?

    I might be wrong about all that I wasn't working with unity at the time but I recall there were some kind of strings attached with daz
     
  7. Nodice

    Nodice

    Joined:
    Apr 14, 2020
    Posts:
    6
    Daz3d I think about a year ago they added the interactive license. It's a different fee depending on the asset. Majority of the time it's $50, but other times they put it on sale. Check for Bundled deals like this one. Only $9 for the interactive. https://www.daz3d.com/tara-8-world-adventurer-mega-bundle.

    In my opinion their human and humanoid models you can't beat for the price.

    The shader I mention in this post is part of their Daz To Blender plugin for Daz Studio. Using it, it will export Humanoid Rigged Characters to Unity HDRP. It has a collection of scripts for Unity that converts the Daz based Materials into high quality SSS materials.

    If you are targeting another rendering pipline, I would probably start a Utility project in HDRP, export from Daz into that project and then export the asset to import into another project and then fix the shaders and materials.
     
    tree_arb likes this.