So I have put together a shader for some magic glowing crystals. I wanted some specific things from it. I wanted it to have transmission and translucency, it had to be transparent with distortions on what's behind it, and finally I wanted it to be more transparent at the edges as well as a lighter color and allowing more light to pass through depending on the depth of the model.
I've gotten everything here working EXCEPT the depth-based transparency. In the meantime I slapped a fresnel effect onto it for almost the effect I wanted but I wanted true depth. So, is there a way to calculate the distance between the back face and the next front face behind it in Amplify?
naitoookami wrote:So I have put together a shader for some magic glowing crystals. I wanted some specific things from it. I wanted it to have transmission and translucency, it had to be transparent with distortions on what's behind it, and finally I wanted it to be more transparent at the edges as well as a lighter color and allowing more light to pass through depending on the depth of the model.
I've gotten everything here working EXCEPT the depth-based transparency. In the meantime I slapped a fresnel effect onto it for almost the effect I wanted but I wanted true depth. So, is there a way to calculate the distance between the back face and the next front face behind it in Amplify?
Greetings,
Thank you for getting in touch, we would be happy to help!
It really depends on how you have it set up; you could build it based on our Translucency sample using a specific texture to control the effect, the Transmission sample, or using your own setup using with a custom implementation aided by the Surface Depth node, the Depth Fade, Screen Depth, or Camera Depth Fade node.
Pulling my hair out over this one. I knew I could use a texture for depth as this shader from the translucency example but this shader is for VRchat so I'd rather not have to create depth maps for each of the models I want to put this on. A method of finding the true depth of the model and using that is preferred. So I tried to follow your advice and tried to use any of those depth nodes. Experimenting with it I was able to kinda sorta get the effect I wanted but that made the crystal get more or less transparent with camera distance. So I thought of trying this...
Attempted to multiply out front faces and back faces then find the distance between them but that solution here just resulted in the same camera distance fading that I didn't want. I'm pretty noob when it comes to shader stuff tbh I just can't wrap my head around how to get the numbers I need.
naitoookami wrote:Pulling my hair out over this one. I knew I could use a texture for depth as this shader from the translucency example but this shader is for VRchat so I'd rather not have to create depth maps for each of the models I want to put this on. A method of finding the true depth of the model and using that is preferred. So I tried to follow your advice and tried to use any of those depth nodes. Experimenting with it I was able to kinda sorta get the effect I wanted but that made the crystal get more or less transparent with camera distance. So I thought of trying this...
Attempted to multiply out front faces and back faces then find the distance between them but that solution here just resulted in the same camera distance fading that I didn't want. I'm pretty noob when it comes to shader stuff tbh I just can't wrap my head around how to get the numbers I need.
Why not simply use the Depth Fade node?
Can you elaborate on the effect you're looking to create?
That seems to be out of my skill range for now, sadly. In fact found the same post before coming here hoping that perhaps there was a shader function for it or another similar solution. Thank you so much for the quick responses and all of the help, you guys are the best.
naitoookami wrote:That seems to be out of my skill range for now, sadly. In fact found the same post before coming here hoping that perhaps there was a shader function for it or another similar solution. Thank you so much for the quick responses and all of the help, you guys are the best.
It's a bit tricky. I'm afraid that since it requires additional scripts beyond the scope of our editor, it's not something that we can add. I would still recommend looking into the other depth nodes, you might be able to build a similar effect.