Exemple #1
0
        public string GetSubshader(IMasterNode masterNode, GenerationMode mode, List <string> sourceAssetDependencyPaths = null)
        {
            if (sourceAssetDependencyPaths != null)
            {
                // LightWeightPBRSubShader.cs
                sourceAssetDependencyPaths.Add(AssetDatabase.GUIDToAssetPath("3ef30c5c1d5fc412f88511ef5818b654"));
            }

            // Master Node data
            var unlitMasterNode = masterNode as UnlitMasterNode;
            var tags            = ShaderGenerator.BuildMaterialTags(unlitMasterNode.surfaceType);
            var options         = ShaderGenerator.GetMaterialOptions(unlitMasterNode.surfaceType, unlitMasterNode.alphaMode, unlitMasterNode.twoSided.isOn);

            // Passes
            var passes = new Pass[] { m_UnlitPass, m_DepthShadowPass };

            return(UniversalSubShaderUtilities.GetSubShader <UnlitMasterNode>(unlitMasterNode, tags, options,
                                                                              passes, mode, sourceAssetDependencyPaths: sourceAssetDependencyPaths));
        }
        public string GetSubshader(IMasterNode masterNode, GenerationMode mode, List <string> sourceAssetDependencyPaths = null)
        {
            if (sourceAssetDependencyPaths != null)
            {
                // UniversalPBRSubShader.cs
                sourceAssetDependencyPaths.Add(AssetDatabase.GUIDToAssetPath("ca91dbeb78daa054c9bbe15fef76361c"));
            }

            // Master Node data
            var pbrMasterNode = masterNode as PBRMasterNode;
            var tags          = ShaderGenerator.BuildMaterialTags(pbrMasterNode.surfaceType);
            var options       = ShaderGenerator.GetMaterialOptions(pbrMasterNode.surfaceType, pbrMasterNode.alphaMode, pbrMasterNode.twoSided.isOn);

            // Passes
            var forwardPass   = pbrMasterNode.model == PBRMasterNode.Model.Metallic ? m_ForwardPassMetallic : m_ForwardPassSpecular;
            var forward2DPass = pbrMasterNode.model == PBRMasterNode.Model.Metallic ? m_ForwardPassMetallic2D : m_ForwardPassSpecular2D;
            var passes        = new Pass[] { forwardPass, m_DepthShadowPass, forward2DPass };

            return(UniversalSubShaderUtilities.GetSubShader <PBRMasterNode>(pbrMasterNode, tags, options,
                                                                            passes, mode, "UnityEditor.ShaderGraph.PBRMasterGUI", sourceAssetDependencyPaths));
        }