Search Unity

Question How would I create volumetric 'murkiness' in a transparent, glassy, crystal material?

Discussion in 'Shader Graph' started by TheBenOfficia, Dec 14, 2019.

  1. TheBenOfficia

    TheBenOfficia

    Joined:
    Feb 24, 2017
    Posts:
    2
    I am using using the HDRP in 2019.3. There is an effect that I am making that is centered around a glowing ice crystal. I have a really nice crystal material right now with refraction, iridescence, normal maps, and transparency. What I really need now to push this up another level is volumetric 'murkiness' inside the crystal. It should start murky and mostly opaque at the bottom and then clear itself out near the top of the crystal. I already have fading transparency...but that is only surface level.

    Can anyone point me to Shader Graph or even Visual Effects Graph tutorials that deals with this kind of volumetric fog that is inside of a material? I assume this should be feasible in Shader Graph with some noise and some masking, I just really don't know where to start...any leads would be greatly appreciated.

    Reference examples:
     
  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,343
    This is possible one of the most difficult effects to do in all of graphics. It's still ongoing research for offline rendering for how to get this effect right, let alone real time. How this usually gets handled in games is with a couple of layers of offset parallax textures to fake some sort of inner cracks or cloudiness.

    A more accurate simulation would be similar to volumetric fog or sub surface scattering, but both are currently only really feasible for real time use by rendering it at very low resolution and/or sample counts and blurring the results to hide the artifacts those produce. For something like the inside of crystal which has a lot of detail this falls down a bit. Hence the faked multi-layer approach mentioned above. Search online for Shader Graph Ice Cracks or similar and you'll find some examples, including people who have used the technique to simulate crystal like what you're going for, albeit very simple and stylized versions.
     
    TheBenOfficia likes this.
  3. TheBenOfficia

    TheBenOfficia

    Joined:
    Feb 24, 2017
    Posts:
    2
    Thanks for the response. I think you hit the nail on the head. I had a feeling I would end up layering a bunch of parallax planes inside the crystal (which don't play to well with the refraction). I guess I will also be manually placing little bubbles in it too.

    The closest 'real' solution I can see is possibly containing volumetric fog inside the mesh. There is some nice fog volumes in HDRP, if only I could plug a mesh into an input somewhere to dictate the bounds. Or, I wonder if I could create a fog volume and somehow mask it in screen space with that crystal mesh. Anyways, a very interesting problem. I should definitely just start hacking the effect. I was just curious how real I could get it.

    I appreciate the response and I have attached an image of the current state of the ice crystal. I went a little overboard with the emission and bloom, but that's kind'a my thing. I have the refraction, transmittance, and transparency all fading from top to bottom for the meanwhile to emulate the effect I'm looking for...but it definitely doesn't feel volumetric when you rotate around it.

     
    Last edited: Dec 21, 2019
    j-vollmer-halocline likes this.