Continued from [SOLVED] Custom Shader (Fresnel) - #10 by twe
Hey! @twe
I’ve been attempting to get your solution to work on models that rotate, and am wondering: Did you get this working with world space normals?
The unity implementation linked in the shader ( Kyle Halladay - The Basics of Fresnel Shading ) calculates the world space normals,:
float3 normWorld = normalize(mul(float3x3(_Object2World), v.normal));
rather than pulling them straight from the mesh attribute:
vNormal = aNormal.xyz;
I’m guessing this will allow the object to rotate without the fresnel effect rotating with it, but my attempt to port that is definitely wrong:
vec3 N = normalize((matrix_model * (aNormal)).xyz);
Sorry to necro the thread, but it seems like a natural next step.