unity3d - Up-Down, Left-Right facing ratio shader -
a little basic question can't head around. need create shader works facing ratio shader containing up-down , left-right (in screen space).
just this:
i want work without having original geometry, having normals, point position , camera position. how should approach this?
here's shader:
#pragma vertex vert #pragma fragment frag #pragma fragmentoption arb_precision_hint_fastest #include "unitycg.cginc" struct app2vert { float4 position: position; float3 normal: normal; }; struct vert2frag { float4 position: position; float3 normal: texcoord0; }; vert2frag vert(app2vert input) { vert2frag output; output.position = mul(unity_matrix_mvp, input.position); output.normal = mul((float3x3)unity_matrix_it_mv, input.normal); return output; } float4 frag(vert2frag input) : color { float3 normal = normalize(input.normal); float4 output = fixed4(normal.x, normal.y, normal.z, 1.0f); return output; }
Comments
Post a Comment