Guest User

Untitled

a guest
Apr 30th, 2021
88
130 days
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. CBuffer(camera) {
  2.     float4x4 view;
  3.     float4x4 proj;
  4.     float4x4 viewproj;
  5.     float4x4 view_inv;
  6.     float4x4 proj_inv;
  7.     float4x4 view_proj_inv;
  8.     float2 z_near_far;
  9.     float2 dummy;
  10. };
  11.  
  12. struct VS_In {
  13.     float3 S_(crd);
  14.     float3 S_(norm);
  15.     float2 S_(uv);
  16. };
  17.  
  18. struct VS_Out {
  19.     float4 S_Position(Pos);
  20.     float3 S_(vNorm);
  21.     float2 S_(uv);
  22. };
  23.  
  24. VS_Out VS(VS_In In) {
  25.     VS_Out Out;
  26.     Out.Pos = mul(viewproj, float4(In.crd, 1.0));
  27.     Out.vNorm = mul((float3x3)view, In.norm);
  28.     Out.uv = In.uv;
  29.     return Out;
  30. }
  31.  
  32. //////////////////////////////////
  33.  
  34. struct PS_Out {
  35.     float4 S_Target0(Color);
  36. };
  37.  
  38. float render_uv;
  39.  
  40. PS_Out PS(VS_Out In) {
  41.     PS_Out Out;
  42.     In.vNorm = normalize(In.vNorm);
  43.     Out.Color.xyz = render_uv ? float3(In.uv, 0.0) : 1.0;
  44.     Out.Color.xyz *= abs(In.vNorm.z);
  45.     Out.Color.w = 1.0;
  46.     return Out;
  47. }
RAW Paste Data