From 701f50f29866d9a3bb4973f7713c29eb7b08c970 Mon Sep 17 00:00:00 2001 From: zhuxudong Date: Fri, 10 Jan 2025 17:10:19 +0800 Subject: [PATCH 1/4] refactor: sync 1.4 editor props --- packages/shader-shaderlab/src/shaders/PBR.gs | 32 +++++++++++++------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/packages/shader-shaderlab/src/shaders/PBR.gs b/packages/shader-shaderlab/src/shaders/PBR.gs index ad3881cec9..60a21dbb1f 100644 --- a/packages/shader-shaderlab/src/shaders/PBR.gs +++ b/packages/shader-shaderlab/src/shaders/PBR.gs @@ -1,5 +1,6 @@ Shader "PBR.gs" { - EditorProperties { + Editor { + Properties{ Header("Base"){ material_IOR("IOR", Range(0, 5, 0.01)) = 1.5; material_BaseColor("BaseColor", Color) = (1, 1, 1, 1); @@ -13,8 +14,9 @@ Shader "PBR.gs" { } Header("Anisotropy") { - material_AnisotropyInfo("AnisotropyInfo", Vector3) = (1, 0, 0); - material_AnisotropyTexture("AnisotropyTexture", Texture2D); + anisotropy("Intensity", Range(0, 1, 0.01)) = 0; + anisotropyRotation("Rotation", Range(0, 360, 1)) = 0; + material_AnisotropyTexture("Texture", Texture2D); } Header("Normal") { @@ -42,33 +44,41 @@ Shader "PBR.gs" { } Header("Thin Film Iridescence"){ - material_IridescenceInfo("IridescenceInfo", Vector4) = (0, 1.3, 100, 400); - material_IridescenceThicknessTexture("IridescenceThicknessTexture", Texture2D); + material_Iridescence("Iridescence", Range(0, 1, 0.01)) = 0; + material_IridescenceIOR("IOR", Range(1, 5, 0.01)) = 1.3; + material_IridescenceRange("ThicknessRange", Vector2) = (100,400); + material_IridescenceThicknessTexture("ThicknessTexture", Texture2D); material_IridescenceTexture("IridescenceTexture", Texture2D); } Header("Sheen"){ - ui_SheenIntensity("Intensity", Range(0, 1, 0.01)) = 0; - ui_SheenColor("Color", Color ) = (0, 0, 0, 0); + sheenColor("Color", Color ) = (0, 0, 0, 1); + sheenIntensity("Intensity", Range(0, 1, 0.01)) = 1; material_SheenRoughness("Roughness", Range(0, 1, 0.01)) = 0; material_SheenTexture("ColorTexture", Texture2D); material_SheenRoughnessTexture("RoughnessTexture", Texture2D); } - - Header("Transmission"){ + + Header("Transmission") { material_Transmission("Transmission", Range(0, 1, 0.01)) = 0; material_TransmissionTexture("TransmissionTexture", Texture2D); - material_AttenuationColor("AttenuationColor", Color ) = (1, 1, 1, 1); - material_AttenuationDistance("AttenuationDistance", Range(0, 1, 0.01)) = 0; material_Thickness("Thickness", Range(0, 5, 0.01)) = 0; material_ThicknessTexture("ThicknessTexture", Texture2D); + refractionMode("refractionMode", Enum(Sphere:0, Planar:1)) = 1; + material_AttenuationColor("AttenuationColor", Color ) = (1, 1, 1, 1); + material_AttenuationDistance("AttenuationDistance", Range(0, 1, 0.01)) = 0; } Header("Common") { + isTransparent("Transparent", Boolean) = false; + renderFace("Render Face", Enum(Front:0, Back:1, Double:2)) = 0; + blendMode("Blend Mode", Enum(Normal:0, Additive:1)) = 0; material_AlphaCutoff( "AlphaCutoff", Range(0, 1, 0.01) ) = 0; material_TilingOffset("TilingOffset", Vector4) = (1, 1, 0, 0); } } + + } SubShader "Default" { UsePass "pbr/Default/ShadowCaster" From a9aae8bb018aa7b5840defe631047abf1e2383c4 Mon Sep 17 00:00:00 2001 From: zhuxudong Date: Tue, 14 Jan 2025 14:36:41 +0800 Subject: [PATCH 2/4] chore: sync editor props --- packages/shader-shaderlab/src/index.ts | 13 ++---------- packages/shader-shaderlab/src/shaders/PBR.gs | 21 +++++++++++++++++++- 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/packages/shader-shaderlab/src/index.ts b/packages/shader-shaderlab/src/index.ts index d144ddf44b..5d788c160c 100644 --- a/packages/shader-shaderlab/src/index.ts +++ b/packages/shader-shaderlab/src/index.ts @@ -1,8 +1,7 @@ -import { Shader, ShaderFactory } from "@galacean/engine"; -import { PBRSource, fragmentList } from "./shaders"; +import { ShaderFactory } from "@galacean/engine"; +import { fragmentList } from "./shaders"; let includeRegistered = false; -let shaderRegistered = false; export function registerIncludes() { if (includeRegistered) return; @@ -14,14 +13,6 @@ export function registerIncludes() { includeRegistered = true; } -export function registerShader() { - if (shaderRegistered) return; - - Shader.create(PBRSource); - - shaderRegistered = true; -} - /** * @internal */ diff --git a/packages/shader-shaderlab/src/shaders/PBR.gs b/packages/shader-shaderlab/src/shaders/PBR.gs index 60a21dbb1f..47fe6c46f5 100644 --- a/packages/shader-shaderlab/src/shaders/PBR.gs +++ b/packages/shader-shaderlab/src/shaders/PBR.gs @@ -64,7 +64,7 @@ Shader "PBR.gs" { material_TransmissionTexture("TransmissionTexture", Texture2D); material_Thickness("Thickness", Range(0, 5, 0.01)) = 0; material_ThicknessTexture("ThicknessTexture", Texture2D); - refractionMode("refractionMode", Enum(Sphere:0, Planar:1)) = 1; + refractionMode("RefractionMode", Enum(Sphere:0, Planar:1)) = 1; material_AttenuationColor("AttenuationColor", Color ) = (1, 1, 1, 1); material_AttenuationDistance("AttenuationDistance", Range(0, 1, 0.01)) = 0; } @@ -78,6 +78,7 @@ Shader "PBR.gs" { } } + UIScript "uiScriptPath"; } SubShader "Default" { @@ -86,6 +87,24 @@ Shader "PBR.gs" { Pass "Forward Pass" { Tags { pipelineStage = "Forward"} + DepthState { + WriteEnabled = depthWriteEnabled; + } + + BlendState { + Enabled = blendEnabled; + SourceColorBlendFactor = sourceColorBlendFactor; + DestinationColorBlendFactor = destinationColorBlendFactor; + SourceAlphaBlendFactor = sourceAlphaBlendFactor; + DestinationAlphaBlendFactor = destinationAlphaBlendFactor; + } + + RasterState{ + CullMode = rasterStateCullMode; + } + + RenderQueueType = renderQueueType; + #define IS_METALLIC_WORKFLOW VertexShader = PBRVertex; From b6bb3ac9035578f83e89ad531c437a68dfb3d925 Mon Sep 17 00:00:00 2001 From: zhuxudong Date: Tue, 14 Jan 2025 14:52:43 +0800 Subject: [PATCH 3/4] chore: rename --- packages/shader-shaderlab/src/index.ts | 7 ++----- packages/shader-shaderlab/src/shaders/PBR.gs | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/packages/shader-shaderlab/src/index.ts b/packages/shader-shaderlab/src/index.ts index 5d788c160c..52e67499c6 100644 --- a/packages/shader-shaderlab/src/index.ts +++ b/packages/shader-shaderlab/src/index.ts @@ -1,5 +1,5 @@ import { ShaderFactory } from "@galacean/engine"; -import { fragmentList } from "./shaders"; +import { PBRSource, fragmentList } from "./shaders"; let includeRegistered = false; @@ -13,7 +13,4 @@ export function registerIncludes() { includeRegistered = true; } -/** - * @internal - */ -export { fragmentList }; +export { PBRSource, fragmentList }; diff --git a/packages/shader-shaderlab/src/shaders/PBR.gs b/packages/shader-shaderlab/src/shaders/PBR.gs index 47fe6c46f5..3c486ee0f6 100644 --- a/packages/shader-shaderlab/src/shaders/PBR.gs +++ b/packages/shader-shaderlab/src/shaders/PBR.gs @@ -78,7 +78,7 @@ Shader "PBR.gs" { } } - UIScript "uiScriptPath"; + UIScript "UIScriptPath"; } SubShader "Default" { From 18e35ac97e7f3f76ad3193161eed50c5dcfc5e33 Mon Sep 17 00:00:00 2001 From: zhuxudong Date: Tue, 14 Jan 2025 15:33:45 +0800 Subject: [PATCH 4/4] chore: rename --- packages/shader-shaderlab/src/shaders/PBR.gs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/shader-shaderlab/src/shaders/PBR.gs b/packages/shader-shaderlab/src/shaders/PBR.gs index 3c486ee0f6..f531d39c67 100644 --- a/packages/shader-shaderlab/src/shaders/PBR.gs +++ b/packages/shader-shaderlab/src/shaders/PBR.gs @@ -1,4 +1,4 @@ -Shader "PBR.gs" { +Shader "PBRShaderName" { Editor { Properties{ Header("Base"){