Hi! I’m new on GLSL and I’ve been trying to adapt-translate this Aura Unity Shader HLSL Code here with a ShaderMaterial, this is my progress so far: Demo.
I have some progress on the fragment shader, but I have been stuck with vertex shader translation, not sure what calculations should I do to obtain viewDir
or normalDir
.
v2f vert(appdata v) {
v2f o;
o.pos = UnityObjectToClipPos(v.vertex);
float3 norm = normalize(mul((float3x3)UNITY_MATRIX_IT_MV, v.normal));// set v.normal to v.vertex if you have hard normals
float2 offset = TransformViewToProjection(norm.xy);
o.pos.xy += offset * _Outline * o.pos.z;
o.pos.z += _OutlineZ;// push away from camera
o.normalDir = normalize(mul(float4(v.normal, 0), unity_WorldToObject).xyz); // normal direction
o.viewDir = normalize(WorldSpaceViewDir(v.vertex)); // view direction
UNITY_TRANSFER_FOG(o, o.pos);
return o;
}
I’ve been helping myself with this resources too:
JsFiddle Fresnel Example
Godot Shaders Aura Translation
Do you have any suggestions or recommendations? Thanks .