diff --git a/Assets/BuiltIn/Shader/SpecularGlossiness/Deferred/Diffuse.xml b/Assets/BuiltIn/Shader/SpecularGlossiness/Deferred/Diffuse.xml index 70f5965db..d3a31990a 100644 --- a/Assets/BuiltIn/Shader/SpecularGlossiness/Deferred/Diffuse.xml +++ b/Assets/BuiltIn/Shader/SpecularGlossiness/Deferred/Diffuse.xml @@ -4,7 +4,7 @@ - + @@ -20,6 +20,7 @@ + diff --git a/Assets/BuiltIn/Shader/SpecularGlossiness/Deferred/DiffuseNormal.xml b/Assets/BuiltIn/Shader/SpecularGlossiness/Deferred/DiffuseNormal.xml index 5cdd05d97..93456e942 100644 --- a/Assets/BuiltIn/Shader/SpecularGlossiness/Deferred/DiffuseNormal.xml +++ b/Assets/BuiltIn/Shader/SpecularGlossiness/Deferred/DiffuseNormal.xml @@ -4,7 +4,7 @@ - + @@ -22,6 +22,7 @@ + diff --git a/Assets/BuiltIn/Shader/SpecularGlossiness/Deferred/Specular.xml b/Assets/BuiltIn/Shader/SpecularGlossiness/Deferred/Specular.xml index ca56420a1..08c46fa6a 100644 --- a/Assets/BuiltIn/Shader/SpecularGlossiness/Deferred/Specular.xml +++ b/Assets/BuiltIn/Shader/SpecularGlossiness/Deferred/Specular.xml @@ -4,7 +4,7 @@ - + @@ -24,6 +24,7 @@ + diff --git a/Assets/BuiltIn/Shader/SpecularGlossiness/Deferred/SpecularGlossiness.xml b/Assets/BuiltIn/Shader/SpecularGlossiness/Deferred/SpecularGlossiness.xml index dabff1cc0..344cc0561 100644 --- a/Assets/BuiltIn/Shader/SpecularGlossiness/Deferred/SpecularGlossiness.xml +++ b/Assets/BuiltIn/Shader/SpecularGlossiness/Deferred/SpecularGlossiness.xml @@ -4,7 +4,7 @@ - + @@ -23,6 +23,7 @@ + diff --git a/Assets/BuiltIn/Shader/SpecularGlossiness/Deferred/SpecularGlossinessMask.xml b/Assets/BuiltIn/Shader/SpecularGlossiness/Deferred/SpecularGlossinessMask.xml index d685096e4..1ee4f0d4e 100644 --- a/Assets/BuiltIn/Shader/SpecularGlossiness/Deferred/SpecularGlossinessMask.xml +++ b/Assets/BuiltIn/Shader/SpecularGlossiness/Deferred/SpecularGlossinessMask.xml @@ -4,7 +4,7 @@ - + @@ -26,6 +26,7 @@ + diff --git a/Assets/BuiltIn/Shader/SpecularGlossiness/Forward/GLSL/SGLitFS.d.glsl b/Assets/BuiltIn/Shader/SpecularGlossiness/Forward/GLSL/SGLitFS.d.glsl index 1dfc3cc11..e0ce7bee1 100644 --- a/Assets/BuiltIn/Shader/SpecularGlossiness/Forward/GLSL/SGLitFS.d.glsl +++ b/Assets/BuiltIn/Shader/SpecularGlossiness/Forward/GLSL/SGLitFS.d.glsl @@ -6,6 +6,7 @@ uniform sampler2D uTexSpecular; uniform samplerCube uTexReflect; uniform vec4 uLightColor; +unfform vec4 uColor; uniform vec4 uSHConst[4]; in vec2 vTexCoord0; @@ -46,7 +47,7 @@ float solveMetallic(vec3 diffuse, vec3 specular, float oneMinusSpecularStrength) void main(void) { - vec4 diffuseMap = texture(uTexDiffuse, vTexCoord0.xy); + vec4 diffuseMap = texture(uTexDiffuse, vTexCoord0.xy) * uColor; vec3 normalMap = texture(uTexNormal, vTexCoord0.xy).xyz; vec3 specMap = texture(uTexSpecular, vTexCoord0.xy).xyz; diff --git a/Assets/BuiltIn/Shader/SpecularGlossiness/Forward/GLSL/SGLitFS.glsl b/Assets/BuiltIn/Shader/SpecularGlossiness/Forward/GLSL/SGLitFS.glsl index 02dd5e9e0..e814e6a6f 100644 --- a/Assets/BuiltIn/Shader/SpecularGlossiness/Forward/GLSL/SGLitFS.glsl +++ b/Assets/BuiltIn/Shader/SpecularGlossiness/Forward/GLSL/SGLitFS.glsl @@ -5,6 +5,7 @@ uniform sampler2D uTexNormal; uniform sampler2D uTexSpecular; uniform samplerCube uTexReflect; uniform vec4 uLightColor; +unfform vec4 uColor; uniform vec4 uSHConst[4]; in vec2 vTexCoord0; in vec3 vWorldNormal; @@ -44,7 +45,7 @@ float solveMetallic(vec3 diffuse, vec3 specular, float oneMinusSpecularStrength) } void main(void) { - vec4 diffuseMap = texture(uTexDiffuse, vTexCoord0.xy); + vec4 diffuseMap = texture(uTexDiffuse, vTexCoord0.xy) * uColor; vec3 normalMap = texture(uTexNormal, vTexCoord0.xy).xyz; vec3 specMap = texture(uTexSpecular, vTexCoord0.xy).xyz; mat3 rotation = mat3(vWorldTangent, vWorldBinormal, vWorldNormal); diff --git a/Assets/BuiltIn/Shader/SpecularGlossiness/Forward/GLSL/SGSkinVS.glsl b/Assets/BuiltIn/Shader/SpecularGlossiness/Forward/GLSL/SGSkinVS.glsl index 79ecd1233..10db0b54a 100644 --- a/Assets/BuiltIn/Shader/SpecularGlossiness/Forward/GLSL/SGSkinVS.glsl +++ b/Assets/BuiltIn/Shader/SpecularGlossiness/Forward/GLSL/SGSkinVS.glsl @@ -12,6 +12,7 @@ uniform mat4 uMvpMatrix; uniform mat4 uWorldMatrix; uniform vec4 uCameraPosition; uniform vec4 uLightDirection; +uniform vec4 uUVScale; uniform mat4 uBoneMatrix[64]; out vec2 vTexCoord0; @@ -47,7 +48,7 @@ void main(void) skinNormal = (skinMatrix * vec4(inNormal, 0.0)).xyz; skinTangent = (skinMatrix * vec4(inTangent, 0.0)).xyz; - vTexCoord0 = inTexCoord0; + vTexCoord0 = inTexCoord0 * uUVScale.xy + uUVScale.zw; vTangentW = inTangentW.x; vec4 worldPos = uWorldMatrix * skinPosition; diff --git a/Assets/BuiltIn/Shader/SpecularGlossiness/Forward/GLSL/SGVS.glsl b/Assets/BuiltIn/Shader/SpecularGlossiness/Forward/GLSL/SGVS.glsl index caf132eb5..198f0d215 100644 --- a/Assets/BuiltIn/Shader/SpecularGlossiness/Forward/GLSL/SGVS.glsl +++ b/Assets/BuiltIn/Shader/SpecularGlossiness/Forward/GLSL/SGVS.glsl @@ -10,6 +10,7 @@ uniform mat4 uMvpMatrix; uniform mat4 uWorldMatrix; uniform vec4 uCameraPosition; uniform vec4 uLightDirection; +uniform vec4 uUVScale; out vec2 vTexCoord0; out vec3 vWorldNormal; @@ -23,7 +24,7 @@ out vec3 vWorldPosition; void main(void) { - vTexCoord0 = inTexCoord0; + vTexCoord0 = inTexCoord0 * uUVScale.xy + uUVScale.zw; vTangentW = inTangentW.x; vec4 worldPos = uWorldMatrix * inPosition; diff --git a/Assets/BuiltIn/Shader/SpecularGlossiness/Forward/HLSL/SGLitFS.d.hlsl b/Assets/BuiltIn/Shader/SpecularGlossiness/Forward/HLSL/SGLitFS.d.hlsl index 5612c2e84..0cd3d7c72 100644 --- a/Assets/BuiltIn/Shader/SpecularGlossiness/Forward/HLSL/SGLitFS.d.hlsl +++ b/Assets/BuiltIn/Shader/SpecularGlossiness/Forward/HLSL/SGLitFS.d.hlsl @@ -26,6 +26,7 @@ struct PS_INPUT cbuffer cbPerFrame { float4 uLightColor; + float4 uColor; float4 uSHConst[4]; }; @@ -54,7 +55,7 @@ float solveMetallic(float3 diffuse, float3 specular, float oneMinusSpecularStren float4 main(PS_INPUT input) : SV_TARGET { - float4 diffuseMap = uTexDiffuse.Sample(uTexDiffuseSampler, input.tex0); + float4 diffuseMap = uTexDiffuse.Sample(uTexDiffuseSampler, input.tex0) * uColor; float3 normalMap = uTexNormalMap.Sample(uTexNormalMapSampler, input.tex0).xyz; float3 specMap = uTexSpecularMap.Sample(uTexSpecularMapSampler, input.tex0).xyz; diff --git a/Assets/BuiltIn/Shader/SpecularGlossiness/Forward/HLSL/SGLitFS.hlsl b/Assets/BuiltIn/Shader/SpecularGlossiness/Forward/HLSL/SGLitFS.hlsl index f85b740fc..5bb12c71c 100644 --- a/Assets/BuiltIn/Shader/SpecularGlossiness/Forward/HLSL/SGLitFS.hlsl +++ b/Assets/BuiltIn/Shader/SpecularGlossiness/Forward/HLSL/SGLitFS.hlsl @@ -22,6 +22,7 @@ struct PS_INPUT cbuffer cbPerFrame { float4 uLightColor; + float4 uColor; float4 uSHConst[4]; }; static const float gamma = 2.2; @@ -52,7 +53,7 @@ float solveMetallic(float3 diffuse, float3 specular, float oneMinusSpecularStren } float4 main(PS_INPUT input) : SV_TARGET { - float4 diffuseMap = uTexDiffuse.Sample(uTexDiffuseSampler, input.tex0); + float4 diffuseMap = uTexDiffuse.Sample(uTexDiffuseSampler, input.tex0) * uColor; float3 normalMap = uTexNormalMap.Sample(uTexNormalMapSampler, input.tex0).xyz; float3 specMap = uTexSpecularMap.Sample(uTexSpecularMapSampler, input.tex0).xyz; float3x3 rotation = float3x3(input.worldTangent, input.worldBinormal, input.worldNormal); diff --git a/Assets/BuiltIn/Shader/SpecularGlossiness/Forward/HLSL/SGSkinVS.hlsl b/Assets/BuiltIn/Shader/SpecularGlossiness/Forward/HLSL/SGSkinVS.hlsl index 0d597655c..d17415969 100644 --- a/Assets/BuiltIn/Shader/SpecularGlossiness/Forward/HLSL/SGSkinVS.hlsl +++ b/Assets/BuiltIn/Shader/SpecularGlossiness/Forward/HLSL/SGSkinVS.hlsl @@ -31,6 +31,7 @@ cbuffer cbPerObject float4x4 uWorldMatrix; float4 uCameraPosition; float4 uLightDirection; + float4 uUVScale; float4x4 uBoneMatrix[64]; }; @@ -66,7 +67,7 @@ VS_OUTPUT main(VS_INPUT input) output.pos = mul(skinPosition, uMvpMatrix); - output.tex0 = input.tex0; + output.tex0 = input.tex0 * uUVScale.xy + uUVScale.zw; output.tangentw = input.tangentw.x; float4 worldPos = mul(skinPosition, uWorldMatrix); diff --git a/Assets/BuiltIn/Shader/SpecularGlossiness/Forward/HLSL/SGVS.hlsl b/Assets/BuiltIn/Shader/SpecularGlossiness/Forward/HLSL/SGVS.hlsl index 9dfc90e3e..0ae996e0e 100644 --- a/Assets/BuiltIn/Shader/SpecularGlossiness/Forward/HLSL/SGVS.hlsl +++ b/Assets/BuiltIn/Shader/SpecularGlossiness/Forward/HLSL/SGVS.hlsl @@ -29,6 +29,7 @@ cbuffer cbPerObject float4x4 uWorldMatrix; float4 uCameraPosition; float4 uLightDirection; + float4 uUVScale; }; VS_OUTPUT main(VS_INPUT input) @@ -37,7 +38,7 @@ VS_OUTPUT main(VS_INPUT input) output.pos = mul(input.pos, uMvpMatrix); - output.tex0 = input.tex0; + output.tex0 = input.tex0 * uUVScale.xy + uUVScale.zw; output.tangentw = input.tangentw.x; float4 worldPos = mul(input.pos, uWorldMatrix); diff --git a/Assets/BuiltIn/Shader/SpecularGlossiness/Forward/SG.xml b/Assets/BuiltIn/Shader/SpecularGlossiness/Forward/SG.xml index 779900771..abf575973 100644 --- a/Assets/BuiltIn/Shader/SpecularGlossiness/Forward/SG.xml +++ b/Assets/BuiltIn/Shader/SpecularGlossiness/Forward/SG.xml @@ -5,14 +5,15 @@ + - + @@ -25,6 +26,10 @@ + + + + diff --git a/Assets/BuiltIn/Shader/SpecularGlossiness/Forward/SGSkin.xml b/Assets/BuiltIn/Shader/SpecularGlossiness/Forward/SGSkin.xml index 18e2e8cab..8debeb36f 100644 --- a/Assets/BuiltIn/Shader/SpecularGlossiness/Forward/SGSkin.xml +++ b/Assets/BuiltIn/Shader/SpecularGlossiness/Forward/SGSkin.xml @@ -5,6 +5,7 @@ + @@ -14,6 +15,7 @@ + @@ -26,6 +28,10 @@ + + + + diff --git a/Assets/BuiltIn/Shader/SpecularGlossiness/Forward/SGSkinAlpha.xml b/Assets/BuiltIn/Shader/SpecularGlossiness/Forward/SGSkinAlpha.xml index e43405e1e..b96e35469 100644 --- a/Assets/BuiltIn/Shader/SpecularGlossiness/Forward/SGSkinAlpha.xml +++ b/Assets/BuiltIn/Shader/SpecularGlossiness/Forward/SGSkinAlpha.xml @@ -5,6 +5,7 @@ + @@ -14,6 +15,7 @@ + @@ -26,6 +28,10 @@ + + + + diff --git a/Assets/SampleModels/MixamoCharacter/Ch17_nonPBR.mat b/Assets/SampleModels/MixamoCharacter/Ch17_nonPBR.mat index 128b38a04..b9bc281f4 100644 --- a/Assets/SampleModels/MixamoCharacter/Ch17_nonPBR.mat +++ b/Assets/SampleModels/MixamoCharacter/Ch17_nonPBR.mat @@ -1,3 +1,4 @@ + @@ -5,6 +6,10 @@ + + + + @@ -25,6 +30,10 @@ + + + + diff --git a/Assets/TankScene/TankScene.mat b/Assets/TankScene/TankScene.mat index 77da20ebe..50a8b51b0 100644 --- a/Assets/TankScene/TankScene.mat +++ b/Assets/TankScene/TankScene.mat @@ -6,8 +6,8 @@ - + @@ -22,8 +22,8 @@ - + @@ -38,8 +38,8 @@ - + @@ -54,8 +54,8 @@ - + @@ -70,8 +70,8 @@ - + diff --git a/Projects/Editor/Source/Editor/AssetEditor/CMatEditor.cpp b/Projects/Editor/Source/Editor/AssetEditor/CMatEditor.cpp index c0ffd4bc6..ce954c53e 100644 --- a/Projects/Editor/Source/Editor/AssetEditor/CMatEditor.cpp +++ b/Projects/Editor/Source/Editor/AssetEditor/CMatEditor.cpp @@ -483,7 +483,6 @@ namespace Skylicht value[0] = x->get(); value[1] = y->get(); - // on change color material->setUniform2(uniformUI->Name.c_str(), value); material->applyMaterial(); }; @@ -593,8 +592,7 @@ namespace Skylicht value[2] = z->get(); value[3] = w->get(); - // on change color - material->setUniform2(uniformUI->Name.c_str(), value); + material->setUniform4(uniformUI->Name.c_str(), value); material->applyMaterial(); };