public bool FindMaterialTemplate(Shader shader, GRenderPipelineType pipeline, out GWizardMaterialTemplate template) { template = default; List <GWizardMaterialTemplate> templateList = pipeline == GRenderPipelineType.Builtin ? BuiltinRPMaterials : pipeline == GRenderPipelineType.Universal ? UniversalRPMaterials : null; if (templateList == null) { return(false); } int index = templateList.FindIndex((t) => { return(t.Material != null && t.Material.shader == shader); }); if (index >= 0) { template = templateList[index]; } return(index >= 0); }
public Material GetClonedMaterial(GRenderPipelineType pipeline, GLightingModel light, GTexturingModel texturing, GSplatsModel splats = GSplatsModel.Splats4) { GWizardMaterialTemplate matTemplate; List <GWizardMaterialTemplate> collection = pipeline == GRenderPipelineType.Universal ? UniversalRPMaterials : BuiltinRPMaterials; if (texturing != GTexturingModel.Splat) { matTemplate = collection.Find(m => { return(m.LightingModel == light && m.TexturingModel == texturing); }); } else { matTemplate = collection.Find(m => { return(m.LightingModel == light && m.TexturingModel == texturing && m.SplatsModel == splats); }); } Material mat = null; if (matTemplate.Material != null) { mat = UnityEngine.Object.Instantiate(matTemplate.Material); } return(mat); }
private static void DrawRenderPipelineSettingGUI() { GRenderPipelineType pipeline = GCommon.CurrentRenderPipeline; string label = string.Format("0. {0} Render Pipeline Setup", pipeline.ToString()); string id = "wizard-rp-setup"; GEditorCommon.Foldout(label, true, id, () => { string instruction = string.Format( "Install additional package for {0} Render Pipeline.\n" + "Status: {1}.", pipeline, GPackageInitializer.isUrpSupportInstalled ? "INSTALLED" : "NOT INSTALLED"); EditorGUILayout.LabelField(instruction, GEditorCommon.WordWrapLeftLabel); if (pipeline == GRenderPipelineType.Universal) { if (GUILayout.Button("Install")) { GUrpPackageImporter.Import(); #if GRIFFIN_URP Griffin.URP.GGriffinUrpInstaller.Install(); #endif } } }); }
private static Material GetNonInteractiveBillboardGrassMaterial() { GRenderPipelineType pipeline = GCommon.CurrentRenderPipeline; if (pipeline == GRenderPipelineType.Builtin) { return(GRuntimeSettings.Instance.foliageRendering.grassBillboardMaterial); } else if (pipeline == GRenderPipelineType.Universal) { return(GRuntimeSettings.Instance.foliageRendering.urpGrassBillboardMaterial); } else { return(null); } }
public void OnProcessShader(Shader shader, ShaderSnippetData snippet, IList <ShaderCompilerData> data) { string shaderName = shader.name; bool isPolarisShader = shaderName.StartsWith("Polaris"); GRenderPipelineType shaderPipeline = shaderName.StartsWith("Polaris/BuiltinRP/") ? GRenderPipelineType.Builtin : shaderName.StartsWith("Polaris/URP/") ? GRenderPipelineType.Universal : GRenderPipelineType.Unsupported; GRenderPipelineType currentPipeline = GCommon.CurrentRenderPipeline; if (isPolarisShader) { if (shaderPipeline != currentPipeline) { data.Clear(); } } }