Untitled
unknown
plain_text
2 months ago
7.3 kB
3
Indexable
Shader "Shader Graphs/URP Sample Buffer" { Properties { _OutlineThickness("_OutlineThickness", Float) = 1 [NoScaleOffset]_MainTex("MainTex", 2D) = "white" {} _Color("Color", Color) = (0, 1, 0.2233989, 0) } SubShader { Tags { // RenderPipeline: <None> "RenderType"="Opaque" "Queue"="Geometry" // DisableBatching: <None> "ShaderGraphShader"="true" } Pass { // Name: <None> Tags { // LightMode: <None> } // Render State // RenderState: <None> // Debug // <None> // -------------------------------------------------- // Pass HLSLPROGRAM // Pragmas #pragma vertex vert #pragma fragment frag // Keywords // PassKeywords: <None> // GraphKeywords: <None> // Defines #define VARYINGS_NEED_POSITION_WS /* WARNING: $splice Could not find named fragment 'PassInstancing' */ #define SHADERPASS SHADERPASS_PREVIEW #define SHADERGRAPH_PREVIEW 1 // Includes /* WARNING: $splice Could not find named fragment 'CustomInterpolatorPreInclude' */ #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Packing.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/NormalSurfaceGradient.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/UnityInstancing.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/EntityLighting.hlsl" #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/ShaderVariables.hlsl" #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/ShaderVariablesFunctions.hlsl" #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" // -------------------------------------------------- // Structs and Packing /* WARNING: $splice Could not find named fragment 'CustomInterpolatorPrePacking' */ struct Attributes { float3 positionOS : POSITION; #if UNITY_ANY_INSTANCING_ENABLED uint instanceID : INSTANCEID_SEMANTIC; #endif }; struct Varyings { float4 positionCS : SV_POSITION; float3 positionWS; #if UNITY_ANY_INSTANCING_ENABLED uint instanceID : CUSTOM_INSTANCE_ID; #endif #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; #endif }; struct SurfaceDescriptionInputs { float3 WorldSpacePosition; float4 ScreenPosition; float2 NDCPosition; float2 PixelPosition; }; struct VertexDescriptionInputs { }; struct PackedVaryings { float4 positionCS : SV_POSITION; float3 positionWS : INTERP0; #if UNITY_ANY_INSTANCING_ENABLED uint instanceID : CUSTOM_INSTANCE_ID; #endif #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; #endif }; PackedVaryings PackVaryings (Varyings input) { PackedVaryings output; ZERO_INITIALIZE(PackedVaryings, output); output.positionCS = input.positionCS; output.positionWS.xyz = input.positionWS; #if UNITY_ANY_INSTANCING_ENABLED output.instanceID = input.instanceID; #endif #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) output.cullFace = input.cullFace; #endif return output; } Varyings UnpackVaryings (PackedVaryings input) { Varyings output; output.positionCS = input.positionCS; output.positionWS = input.positionWS.xyz; #if UNITY_ANY_INSTANCING_ENABLED output.instanceID = input.instanceID; #endif #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) output.cullFace = input.cullFace; #endif return output; } // -------------------------------------------------- // Graph // Graph Properties CBUFFER_START(UnityPerMaterial) float _OutlineThickness; float4 _MainTex_TexelSize; float4 _Color; CBUFFER_END // Object and Global properties TEXTURE2D(_MainTex); SAMPLER(sampler_MainTex); // Graph Includes // GraphIncludes: <None> // -- Property used by ScenePickingPass #ifdef SCENEPICKINGPASS float4 _SelectionID; #endif // -- Properties used by SceneSelectionPass #ifdef SCENESELECTIONPASS int _ObjectId; int _PassValue; #endif // Graph Functions TEXTURE2D_X(_BlitTexture); float4 Unity_Universal_SampleBuffer_BlitSource_float(float2 uv) { uint2 pixelCoords = uint2(uv * _ScreenSize.xy); return LOAD_TEXTURE2D_X_LOD(_BlitTexture, pixelCoords, 0); } /* WARNING: $splice Could not find named fragment 'CustomInterpolatorPreVertex' */ // Graph Vertex // GraphVertex: <None> /* WARNING: $splice Could not find named fragment 'CustomInterpolatorPreSurface' */ // Graph Pixel struct SurfaceDescription { float4 Out; }; SurfaceDescription SurfaceDescriptionFunction(SurfaceDescriptionInputs IN) { SurfaceDescription surface = (SurfaceDescription)0; float4 _URPSampleBuffer_e9737d6f4c404cef9b86f5d3a7f80df0_Output_2_Vector4 = Unity_Universal_SampleBuffer_BlitSource_float(float4(IN.NDCPosition.xy, 0, 0).xy); surface.Out = all(isfinite(_URPSampleBuffer_e9737d6f4c404cef9b86f5d3a7f80df0_Output_2_Vector4)) ? half4(_URPSampleBuffer_e9737d6f4c404cef9b86f5d3a7f80df0_Output_2_Vector4.x, _URPSampleBuffer_e9737d6f4c404cef9b86f5d3a7f80df0_Output_2_Vector4.y, _URPSampleBuffer_e9737d6f4c404cef9b86f5d3a7f80df0_Output_2_Vector4.z, 1.0) : float4(1.0f, 0.0f, 1.0f, 1.0f); return surface; } // -------------------------------------------------- // Build Graph Inputs SurfaceDescriptionInputs BuildSurfaceDescriptionInputs(Varyings input) { SurfaceDescriptionInputs output; ZERO_INITIALIZE(SurfaceDescriptionInputs, output); /* WARNING: $splice Could not find named fragment 'CustomInterpolatorCopyToSDI' */ output.WorldSpacePosition = input.positionWS; output.ScreenPosition = ComputeScreenPos(TransformWorldToHClip(input.positionWS), _ProjectionParams.x); #if UNITY_UV_STARTS_AT_TOP output.PixelPosition = float2(input.positionCS.x, (_ProjectionParams.x < 0) ? (_ScreenParams.y - input.positionCS.y) : input.positionCS.y); #else output.PixelPosition = float2(input.positionCS.x, (_ProjectionParams.x > 0) ? (_ScreenParams.y - input.positionCS.y) : input.positionCS.y); #endif output.NDCPosition = output.PixelPosition.xy / _ScreenParams.xy; output.NDCPosition.y = 1.0f - output.NDCPosition.y; #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) #define BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN output.FaceSign = IS_FRONT_VFACE(input.cullFace, true, false); #else #define BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN #endif #undef BUILD_SURFACE_DESCRIPTION_INPUTS_OUTPUT_FACESIGN return output; } // -------------------------------------------------- // Main #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/PreviewVaryings.hlsl" #include "Packages/com.unity.shadergraph/ShaderGraphLibrary/PreviewPass.hlsl" ENDHLSL } } CustomEditor "UnityEditor.ShaderGraph.GenericShaderGraphMaterialGUI" FallBack "Hidden/Shader Graph/FallbackError" }
Editor is loading...
Leave a Comment