Exemplo n.º 1
0
            public static SubShaderDescriptor UnlitDOTS(UniversalTarget target, string renderType, string renderQueue)
            {
                var result = new SubShaderDescriptor()
                {
                    pipelineTag      = UniversalTarget.kPipelineTag,
                    customTags       = UniversalTarget.kUnlitMaterialTypeTag,
                    renderType       = renderType,
                    renderQueue      = renderQueue,
                    generatesPreview = true,
                    passes           = new PassCollection()
                };

                result.passes.Add(PassVariant(UnlitPasses.Forward(target), CorePragmas.DOTSForward));

                if (target.mayWriteDepth)
                {
                    result.passes.Add(PassVariant(CorePasses.DepthOnly(target), CorePragmas.DOTSInstanced));
                }

                result.passes.Add(PassVariant(CorePasses.DepthNormalOnly(target), CorePragmas.DOTSInstanced));

                if (target.castShadows || target.allowMaterialOverride)
                {
                    result.passes.Add(PassVariant(CorePasses.ShadowCaster(target), CorePragmas.DOTSInstanced));
                }

                result.passes.Add(UnlitPasses.DepthNormalOnly(target));
                result.passes.Add(CorePasses.SceneSelection(target));
                result.passes.Add(CorePasses.ScenePicking(target));

                return(result);
            }
Exemplo n.º 2
0
            public static SubShaderDescriptor UnlitDOTS(UniversalTarget target, string renderType, string renderQueue)
            {
                var result = new SubShaderDescriptor()
                {
                    pipelineTag      = UniversalTarget.kPipelineTag,
                    customTags       = UniversalTarget.kUnlitMaterialTypeTag,
                    renderType       = renderType,
                    renderQueue      = renderQueue,
                    generatesPreview = true,
                    passes           = new PassCollection()
                };

                result.passes.Add(PassVariant(UnlitPasses.Forward(target), CorePragmas.DOTSForward));

                if (target.mayWriteDepth)
                {
                    result.passes.Add(PassVariant(CorePasses.DepthOnly(target), CorePragmas.DOTSInstanced));
                }

                result.passes.Add(PassVariant(CorePasses.DepthNormalOnly(target), CorePragmas.DOTSInstanced));

                if (target.castShadows || target.allowMaterialOverride)
                {
                    result.passes.Add(PassVariant(CorePasses.ShadowCaster(target), CorePragmas.DOTSInstanced));
                }

                // Currently neither of these passes (selection/picking) can be last for the game view for
                // UI shaders to render correctly. Verify [1352225] before changing this order.
                result.passes.Add(CorePasses.SceneSelection(target));
                result.passes.Add(CorePasses.ScenePicking(target));

                result.passes.Add(UnlitPasses.DepthNormalOnly(target));

                return(result);
            }
Exemplo n.º 3
0
            public static PassDescriptor Forward(UniversalTarget target)
            {
                var result = new PassDescriptor
                {
                    // Definition
                    displayName   = "Universal Forward",
                    referenceName = "SHADERPASS_UNLIT",
                    useInPreview  = true,

                    // Template
                    passTemplatePath          = UniversalTarget.kUberTemplatePath,
                    sharedTemplateDirectories = UniversalTarget.kSharedTemplateDirectories,

                    // Port Mask
                    validVertexBlocks = CoreBlockMasks.Vertex,
                    validPixelBlocks  = CoreBlockMasks.FragmentColorAlpha,

                    // Fields
                    structs           = CoreStructCollections.Default,
                    requiredFields    = UnlitRequiredFields.Unlit,
                    fieldDependencies = CoreFieldDependencies.Default,

                    // Conditional State
                    renderStates = CoreRenderStates.UberSwitchedRenderState(target),
                    pragmas      = CorePragmas.Forward,
                    defines      = new DefineCollection()
                    {
                        CoreDefines.UseFragmentFog
                    },
                    keywords = new KeywordCollection()
                    {
                        UnlitKeywords.UnlitBaseKeywords
                    },
                    includes = UnlitIncludes.Unlit,

                    // Custom Interpolator Support
                    customInterpolators = CoreCustomInterpDescriptors.Common
                };

                CorePasses.AddTargetSurfaceControlsToPass(ref result, target);

                return(result);
            }
Exemplo n.º 4
0
            public static SubShaderDescriptor SpriteUnlit(UniversalTarget target)
            {
                SubShaderDescriptor result = new SubShaderDescriptor()
                {
                    pipelineTag      = UniversalTarget.kPipelineTag,
                    customTags       = UniversalTarget.kUnlitMaterialTypeTag,
                    renderType       = $"{RenderType.Transparent}",
                    renderQueue      = $"{UnityEditor.ShaderGraph.RenderQueue.Transparent}",
                    generatesPreview = true,
                    passes           = new PassCollection
                    {
                        { SpriteUnlitPasses.Unlit },
                        { SpriteUnlitPasses.Forward },
                        { CorePasses._2DSceneSelection(target) },
                        { CorePasses._2DScenePicking(target) },
                    },
                };

                return(result);
            }
Exemplo n.º 5
0
            public static SubShaderDescriptor SpriteUnlit(UniversalTarget target)
            {
                SubShaderDescriptor result = new SubShaderDescriptor()
                {
                    pipelineTag      = UniversalTarget.kPipelineTag,
                    customTags       = UniversalTarget.kUnlitMaterialTypeTag,
                    renderType       = $"{RenderType.Transparent}",
                    renderQueue      = $"{UnityEditor.ShaderGraph.RenderQueue.Transparent}",
                    generatesPreview = true,
                    passes           = new PassCollection
                    {
                        { SpriteUnlitPasses.Unlit },
                        // Currently neither of these passes (selection/picking) can be last for the game view for
                        // UI shaders to render correctly. Verify [1352225] before changing this order.
                        { CorePasses._2DSceneSelection(target) },
                        { CorePasses._2DScenePicking(target) },
                        { SpriteUnlitPasses.Forward },
                    },
                };

                return(result);
            }
Exemplo n.º 6
0
            public static PassDescriptor DepthNormalOnly(UniversalTarget target)
            {
                var result = new PassDescriptor
                {
                    // Definition
                    displayName   = "DepthNormals",
                    referenceName = "SHADERPASS_DEPTHNORMALSONLY",
                    lightMode     = "DepthNormalsOnly",
                    useInPreview  = false,

                    // Template
                    passTemplatePath          = UniversalTarget.kUberTemplatePath,
                    sharedTemplateDirectories = UniversalTarget.kSharedTemplateDirectories,

                    // Port Mask
                    validVertexBlocks = CoreBlockMasks.Vertex,
                    validPixelBlocks  = UnlitBlockMasks.FragmentDepthNormals,

                    // Fields
                    structs           = CoreStructCollections.Default,
                    requiredFields    = UnlitRequiredFields.DepthNormalsOnly,
                    fieldDependencies = CoreFieldDependencies.Default,

                    // Conditional State
                    renderStates = CoreRenderStates.DepthNormalsOnly(target),
                    pragmas      = CorePragmas.Forward,
                    defines      = new DefineCollection(),
                    keywords     = new KeywordCollection(),
                    includes     = CoreIncludes.DepthNormalsOnly,

                    // Custom Interpolator Support
                    customInterpolators = CoreCustomInterpDescriptors.Common
                };

                CorePasses.AddTargetSurfaceControlsToPass(ref result, target);

                return(result);
            }