Shader"Custom/WorldPosCalclate"{Properties{}SubShader{Tags{"RenderType"="Transparent""Queue"="Transparent"}LOD200CGPROGRAM// Physically based Standard lighting model, and enable shadows on all light types#pragmasurfacesurfStandardfullforwardshadows// Use shader model 3.0 target, to get nicer looking lighting#pragmatarget3.0#include"UnityCG.cginc"#include"UnityShaderVariables.cginc"structInput{float3worldPos;float4screenPos;};UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture);// Add instancing support for this shader. You need to check 'Enable Instancing' on materials that use the shader.// See https://docs.unity3d.com/Manual/GPUInstancing.html for more information about instancing.// #pragma instancing_options assumeuniformscalingUNITY_INSTANCING_BUFFER_START(Props)// put more per-instance properties hereUNITY_INSTANCING_BUFFER_END(Props)voidsurf(InputIN,inoutSurfaceOutputStandardo){float4screenPos=float4(IN.screenPos.xyz,IN.screenPos.w+0.00000000001);float4screenPosNorm=screenPos/screenPos.w;screenPosNorm.z=(UNITY_NEAR_CLIP_VALUE>=0)?screenPosNorm.z:screenPosNorm.z*0.5+0.5;floateyeDepth=LinearEyeDepth(SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture,screenPosNorm.xy));float3cameraViewDir=-UNITY_MATRIX_V._m20_m21_m22;float3worldViewDir=normalize(UnityWorldSpaceViewDir(IN.worldPos));float3wpos=((eyeDepth*worldViewDir*(1.0/dot(cameraViewDir,worldViewDir)))+_WorldSpaceCameraPos);// グリッド表示{wpos*=0.5f;o.Emission=pow(abs(cos(wpos.xyz*UNITY_PI*4)),20);}// Metallic and smoothness come from slider variableso.Metallic=0;o.Smoothness=0;o.Alpha=1;}ENDCG}FallBack"Diffuse"}