当前位置:   article > 正文

Unity3d URP管线下渲染法线颜色_unity urp 模型颜色异常

unity urp 模型颜色异常

 

  1. Shader "Unlit/ObjNORMAL"
  2. {
  3. Properties
  4. {
  5. }
  6. SubShader
  7. {
  8. Tags { "RenderPipeline"="UniversalPipeline" "RenderType"="Opaque" }
  9. Pass
  10. {
  11. HLSLPROGRAM
  12. #pragma vertex vert
  13. #pragma fragment frag
  14. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
  15. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
  16. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
  17. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl"
  18. struct appdata
  19. {
  20. float4 vertex : POSITION;
  21. half3 normalOS:NORMAL;
  22. };
  23. struct v2f
  24. {
  25. float4 vertex : SV_POSITION;
  26. half3 normalWS:TEXCOORD;
  27. };
  28. v2f vert (appdata v)
  29. {
  30. v2f o;
  31. o.vertex = TransformObjectToHClip(v.vertex);
  32. o.normalWS = TransformObjectToWorldNormal(v.normalOS);
  33. return o;
  34. }
  35. half4 frag (v2f i) : SV_Target
  36. {
  37. half3 N=i.normalWS;
  38. return half4(N,1);
  39. }
  40. ENDHLSL
  41. }
  42. }
  43. }

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/我家小花儿/article/detail/101769
推荐阅读
相关标签
  

闽ICP备14008679号