Material - enbale/disable metallic scale according to texture selection
Remark: resolves GitHub issue https://github.com/o3de/o3de/issues/2647 - ATOM-15614 Signed-off-by: Adi Bar-Lev <82479970+Adi-Amazon@users.noreply.github.com>
This commit is contained in:
@@ -1574,15 +1574,6 @@
|
||||
"shaderOption": "o_baseColor_useTexture"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "UseTexture",
|
||||
"args": {
|
||||
"textureProperty": "metallic.textureMap",
|
||||
"useTextureProperty": "metallic.useTexture",
|
||||
"dependentProperties": ["metallic.textureMapUv"],
|
||||
"shaderOption": "o_metallic_useTexture"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "UseTexture",
|
||||
"args": {
|
||||
@@ -1649,6 +1640,12 @@
|
||||
"file": "StandardPBR_Roughness.lua"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Lua",
|
||||
"args": {
|
||||
"file": "StandardPBR_Metallic.lua"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Lua",
|
||||
"args": {
|
||||
|
||||
+17
-29
@@ -2698,16 +2698,12 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "UseTexture",
|
||||
"type": "Lua",
|
||||
"args": {
|
||||
"textureProperty": "layer1_metallic.textureMap",
|
||||
"useTextureProperty": "layer1_metallic.useTexture",
|
||||
"dependentProperties": ["layer1_metallic.textureMapUv"],
|
||||
"shaderTags": [
|
||||
"ForwardPass",
|
||||
"ForwardPass_EDS"
|
||||
],
|
||||
"shaderOption": "o_layer1_o_metallic_useTexture"
|
||||
"file": "StandardPBR_Metallic.lua",
|
||||
"propertyNamePrefix": "layer1_",
|
||||
"srgNamePrefix": "m_layer1_",
|
||||
"optionsNamePrefix": "o_layer1_"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -2835,16 +2831,12 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "UseTexture",
|
||||
"type": "Lua",
|
||||
"args": {
|
||||
"textureProperty": "layer2_metallic.textureMap",
|
||||
"useTextureProperty": "layer2_metallic.useTexture",
|
||||
"dependentProperties": ["layer2_metallic.textureMapUv"],
|
||||
"shaderTags": [
|
||||
"ForwardPass",
|
||||
"ForwardPass_EDS"
|
||||
],
|
||||
"shaderOption": "o_layer2_o_metallic_useTexture"
|
||||
"file": "StandardPBR_Metallic.lua",
|
||||
"propertyNamePrefix": "layer2_",
|
||||
"srgNamePrefix": "m_layer2_",
|
||||
"optionsNamePrefix": "o_layer2_"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -2963,8 +2955,8 @@
|
||||
"args": {
|
||||
"textureProperty": "layer3_baseColor.textureMap",
|
||||
"useTextureProperty": "layer3_baseColor.useTexture",
|
||||
"dependentProperties": ["layer3_baseColor.textureMapUv", "layer3_baseColor.textureBlendMode"],
|
||||
"shaderTags": [
|
||||
"dependentProperties": [ "layer3_baseColor.textureMapUv", "layer3_baseColor.textureBlendMode" ],
|
||||
"shaderTags": [
|
||||
"ForwardPass",
|
||||
"ForwardPass_EDS"
|
||||
],
|
||||
@@ -2972,16 +2964,12 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "UseTexture",
|
||||
"type": "Lua",
|
||||
"args": {
|
||||
"textureProperty": "layer3_metallic.textureMap",
|
||||
"useTextureProperty": "layer3_metallic.useTexture",
|
||||
"dependentProperties": ["layer3_metallic.textureMapUv"],
|
||||
"shaderTags": [
|
||||
"ForwardPass",
|
||||
"ForwardPass_EDS"
|
||||
],
|
||||
"shaderOption": "o_layer3_o_metallic_useTexture"
|
||||
"file": "StandardPBR_Metallic.lua",
|
||||
"propertyNamePrefix": "layer3_",
|
||||
"srgNamePrefix": "m_layer3_",
|
||||
"optionsNamePrefix": "o_layer3_"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
@@ -1104,15 +1104,6 @@
|
||||
"shaderOption": "o_baseColor_useTexture"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "UseTexture",
|
||||
"args": {
|
||||
"textureProperty": "metallic.textureMap",
|
||||
"useTextureProperty": "metallic.useTexture",
|
||||
"dependentProperties": ["metallic.textureMapUv"],
|
||||
"shaderOption": "o_metallic_useTexture"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "UseTexture",
|
||||
"args": {
|
||||
@@ -1179,6 +1170,12 @@
|
||||
"file": "StandardPBR_Roughness.lua"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Lua",
|
||||
"args": {
|
||||
"file": "StandardPBR_Metallic.lua"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Lua",
|
||||
"args": {
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
--------------------------------------------------------------------------------------
|
||||
--
|
||||
-- Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
-- For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
--
|
||||
-- SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
--
|
||||
--
|
||||
--
|
||||
----------------------------------------------------------------------------------------------------
|
||||
|
||||
function GetMaterialPropertyDependencies()
|
||||
return {"metallic.textureMap", "metallic.useTexture"}
|
||||
end
|
||||
|
||||
function GetShaderOptionDependencies()
|
||||
return {"o_metallic_useTexture"}
|
||||
end
|
||||
|
||||
function Process(context)
|
||||
local textureMap = context:GetMaterialPropertyValue_Image("metallic.textureMap")
|
||||
local useTexture = context:GetMaterialPropertyValue_bool("metallic.useTexture")
|
||||
context:SetShaderOptionValue_bool("o_metallic_useTexture", useTexture and textureMap ~= nil)
|
||||
end
|
||||
|
||||
function ProcessEditor(context)
|
||||
local textureMap = context:GetMaterialPropertyValue_Image("metallic.textureMap")
|
||||
local useTexture = context:GetMaterialPropertyValue_bool("metallic.useTexture")
|
||||
|
||||
if(nil == textureMap) then
|
||||
context:SetMaterialPropertyVisibility("metallic.useTexture", MaterialPropertyVisibility_Hidden)
|
||||
context:SetMaterialPropertyVisibility("metallic.textureMapUv", MaterialPropertyVisibility_Hidden)
|
||||
context:SetMaterialPropertyVisibility("metallic.factor", MaterialPropertyVisibility_Enabled)
|
||||
elseif(not useTexture) then
|
||||
context:SetMaterialPropertyVisibility("metallic.useTexture", MaterialPropertyVisibility_Enabled)
|
||||
context:SetMaterialPropertyVisibility("metallic.textureMapUv", MaterialPropertyVisibility_Disabled)
|
||||
context:SetMaterialPropertyVisibility("metallic.factor", MaterialPropertyVisibility_Enabled)
|
||||
else
|
||||
context:SetMaterialPropertyVisibility("metallic.useTexture", MaterialPropertyVisibility_Enabled)
|
||||
context:SetMaterialPropertyVisibility("metallic.textureMapUv", MaterialPropertyVisibility_Enabled)
|
||||
context:SetMaterialPropertyVisibility("metallic.factor", MaterialPropertyVisibility_Hidden)
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user