Created
June 10, 2024 10:07
-
-
Save cecilemuller/0c681b6e7048548d3474be941536587f to your computer and use it in GitHub Desktop.
Albedo Alpha from Rim for Marmoset Toolbag 4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "data/shader/mat/state.frag" | |
uniform float uOpacity; //name "Opacity" default 1.0 min 0.0 max 2.0 | |
uniform float uExponent; //name "Exponent" default 1.0 min 0.0 max 4.0 | |
void RimOpacity( inout FragmentState s ) | |
{ | |
#ifdef Emissive | |
Emissive(s); | |
#endif | |
float rim = dot(s.vertexEye, s.normal); | |
rim = pow(rim, uExponent); | |
s.albedo.a = saturate(1.0 - rim) * uOpacity; | |
} | |
#ifdef Emissive | |
#undef Emissive | |
#endif | |
#define Emissive RimOpacity |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment