shift pbrconfig to ORM

This commit is contained in:
AzaezelX 2020-09-30 13:51:12 -05:00
parent 22b0785c73
commit 0c7811bd1a
54 changed files with 879 additions and 680 deletions

View file

@ -409,7 +409,7 @@ function AssetBrowser::importMaterialAsset(%this, %assetItem)
else if(%childAssetItem.imageType $= "AO")
%mapFieldName = "AOMap";
else if(%childAssetItem.imageType $= "Composite")
%mapFieldName = "PBRConfigMap";
%mapFieldName = "ORMConfigMap";
%path = fileName(%childAssetItem.filePath);
%file.writeline(" "@ %mapFieldName @ "[0] = \"" @ %path @"\";");

View file

@ -579,7 +579,7 @@
VertSizing = "bottom";
position = "9 4";
Extent = "72 16";
text = "Smoothness";
text = "Roughness";
Profile = "ToolsGuiTextProfile";
};
@ -599,7 +599,7 @@
new GuiSliderCtrl() {
canSaveDynamicFields = "0";
internalName = "SmoothnessSlider";
internalName = "RoughnessSlider";
Enabled = "1";
isContainer = "0";
Profile = "ToolsGuiSliderProfile";
@ -610,10 +610,10 @@
MinExtent = "8 2";
canSave = "1";
Visible = "1";
Command = "MaterialEditorGui.updateActiveMaterial(\"Smoothness[\" @ MaterialEditorGui.currentLayer @ \"]\", $ThisControl.getValue(), true, true);";
AltCommand = "$ThisControl.getParent().updateFromChild($ThisControl); MaterialEditorGui.updateActiveMaterial(\"Smoothness[\" @ MaterialEditorGui.currentLayer @ \"]\", $ThisControl.getValue(), true, false);";
Command = "MaterialEditorGui.updateActiveMaterial(\"Roughness[\" @ MaterialEditorGui.currentLayer @ \"]\", $ThisControl.getValue(), true, true);";
AltCommand = "$ThisControl.getParent().updateFromChild($ThisControl); MaterialEditorGui.updateActiveMaterial(\"Roughness[\" @ MaterialEditorGui.currentLayer @ \"]\", $ThisControl.getValue(), true, false);";
tooltipprofile = "ToolsGuiDefaultProfile";
ToolTip = "Sets Smoothness.";
ToolTip = "Sets Roughness.";
hovertime = "1000";
range = "0 1";
ticks = "0";
@ -621,7 +621,7 @@
};
new GuiTextEditCtrl() {
canSaveDynamicFields = "0";
internalName = "SmoothnessTextEdit";
internalName = "RoughnessTextEdit";
Enabled = "1";
isContainer = "0";
Profile = "ToolsGuiTextEditProfile";
@ -632,7 +632,7 @@
MinExtent = "8 2";
canSave = "1";
Visible = "1";
Command = "$ThisControl.getParent().updateFromChild($ThisControl); MaterialEditorGui.updateActiveMaterial(\"Smoothness[\" @ MaterialEditorGui.currentLayer @ \"]\", $ThisControl.getValue());";
Command = "$ThisControl.getParent().updateFromChild($ThisControl); MaterialEditorGui.updateActiveMaterial(\"Roughness[\" @ MaterialEditorGui.currentLayer @ \"]\", $ThisControl.getValue());";
hovertime = "1000";
AnchorTop = "1";
AnchorBottom = "0";
@ -724,7 +724,7 @@
};
new GuiCheckBoxCtrl() {
canSaveDynamicFields = "0";
internalName = "invertSmoothnessCheckbox";
internalName = "invertRoughnessCheckbox";
Enabled = "1";
isContainer = "0";
Profile = "ToolsGuiCheckBoxProfile";
@ -735,11 +735,11 @@
MinExtent = "8 2";
canSave = "1";
Visible = "1";
Command = "MaterialEditorGui.updateActiveMaterial(\"invertSmoothness[\" @ MaterialEditorGui.currentLayer @ \"]\", $ThisControl.getValue());";
Command = "MaterialEditorGui.updateActiveMaterial(\"invertRoughness[\" @ MaterialEditorGui.currentLayer @ \"]\", $ThisControl.getValue());";
tooltipprofile = "ToolsGuiDefaultProfile";
ToolTip = "Treat as Roughest = 1.0, not 0.0";
hovertime = "1000";
text = "Invert Smoothness";
text = "Invert Roughness";
groupNum = "-1";
buttonType = "ToggleButton";
useMouseEvents = "0";
@ -772,7 +772,7 @@
new GuiBitmapCtrl() {
canSaveDynamicFields = "0";
internalName = "PBRConfigMapDisplayBitmap";
internalName = "ORMConfigMapDisplayBitmap";
Enabled = "1";
isContainer = "0";
Profile = "ToolsGuiDefaultProfile";
@ -806,7 +806,7 @@
AnchorBottom = "0";
AnchorLeft = "1";
AnchorRight = "0";
text = "PBR Config Map";
text = "ORM(Config)Map";
maxLength = "1024";
};
new GuiBitmapButtonCtrl() {
@ -821,9 +821,9 @@
MinExtent = "8 2";
canSave = "1";
Visible = "1";
Command = "MaterialEditorGui.updatePBRConfigMap(1);";
Command = "MaterialEditorGui.updateORMConfigMap(1);";
tooltipprofile = "ToolsGuiDefaultProfile";
ToolTip = "Change the packed spec map for this layer. \n Smoothness (R), Ambient Occlusion (G), and Metalness(B))";
ToolTip = "Change the packed spec map for this layer. \n Roughness (R), Ambient Occlusion (G), and Metalness(B))";
hovertime = "1000";
groupNum = "-1";
buttonType = "PushButton";
@ -832,7 +832,7 @@
};
new GuiTextCtrl() {
canSaveDynamicFields = "0";
internalName = "PBRConfigMapNameText";
internalName = "ORMConfigMapNameText";
Enabled = "1";
isContainer = "0";
Profile = "ToolsGuiTextProfile";
@ -861,7 +861,7 @@
position = "134 34";
Extent = "40 16";
buttonType = "PushButton";
command="MaterialEditorGui.updatePBRConfigMap(1);";
command="MaterialEditorGui.updateORMConfigMap(1);";
};
new GuiBitmapButtonCtrl() {
canSaveDynamicFields = "0";
@ -875,7 +875,7 @@
MinExtent = "8 2";
canSave = "1";
Visible = "1";
Command = "MaterialEditorGui.updatePBRConfigMap(0);";
Command = "MaterialEditorGui.updateORMConfigMap(0);";
hovertime = "1000";
groupNum = "-1";
buttonType = "PushButton";
@ -1010,7 +1010,7 @@
canSaveDynamicFields = "0";
};
new GuiTextCtrl() {
text = "Smoothness";
text = "Roughness";
maxLength = "1024";
margin = "0 0 0 0";
padding = "0 0 0 0";
@ -1051,7 +1051,7 @@
active = "1";
command = "MaterialEditorGui.updateroughMap(1);";
tooltipProfile = "GuiToolTipProfile";
tooltip = "Change the Smoothness map for this layer.";
tooltip = "Change the Roughness map for this layer.";
hovertime = "1000";
isContainer = "0";
canSave = "1";

View file

@ -590,9 +590,9 @@ function MaterialEditorGui::convertTextureFields(%this)
for(%specI = 0; %specI < 4; %specI++)
{
%PBRConfigMap = MaterialEditorGui.currentMaterial.PBRConfigMap[%specI];
%PBRConfigMap = MaterialEditorGui.searchForTexture(MaterialEditorGui.currentMaterial, %PBRConfigMap);
MaterialEditorGui.currentMaterial.PBRConfigMap[%specI] = %PBRConfigMap;
%ORMConfigMap = MaterialEditorGui.currentMaterial.ORMConfigMap[%specI];
%ORMConfigMap = MaterialEditorGui.searchForTexture(MaterialEditorGui.currentMaterial, %ORMConfigMap);
MaterialEditorGui.currentMaterial.ORMConfigMap[%specI] = %ORMConfigMap;
}
for(%roughI = 0; %roughI < 4; %roughI++)
@ -914,17 +914,17 @@ function MaterialEditorGui::guiSync( %this, %material )
MaterialEditorPropertiesWindow-->toneMapDisplayBitmap.setBitmap( (%material).toneMap[%layer] );
}
MaterialEditorPropertiesWindow-->isSRGBCheckbox.setValue((%material).isSRGB[%layer]);
MaterialEditorPropertiesWindow-->invertSmoothnessCheckbox.setValue((%material).invertSmoothness[%layer]);
MaterialEditorPropertiesWindow-->invertRoughnessCheckbox.setValue((%material).invertRoughness[%layer]);
if((%material).PBRConfigMap[%layer] $= "")
if((%material).ORMConfigMap[%layer] $= "")
{
MaterialEditorPropertiesWindow-->PBRConfigMapNameText.setText( "None" );
MaterialEditorPropertiesWindow-->PBRConfigMapDisplayBitmap.setBitmap( "tools/materialEditor/gui/unknownImage" );
MaterialEditorPropertiesWindow-->ORMConfigMapNameText.setText( "None" );
MaterialEditorPropertiesWindow-->ORMConfigMapDisplayBitmap.setBitmap( "tools/materialEditor/gui/unknownImage" );
}
else
{
MaterialEditorPropertiesWindow-->PBRConfigMapNameText.setText( (%material).PBRConfigMap[%layer] );
MaterialEditorPropertiesWindow-->PBRConfigMapDisplayBitmap.setBitmap( (%material).PBRConfigMap[%layer] );
MaterialEditorPropertiesWindow-->ORMConfigMapNameText.setText( (%material).ORMConfigMap[%layer] );
MaterialEditorPropertiesWindow-->ORMConfigMapDisplayBitmap.setBitmap( (%material).ORMConfigMap[%layer] );
}
if((%material).roughMap[%layer] $= "")
@ -988,8 +988,8 @@ function MaterialEditorGui::guiSync( %this, %material )
MaterialEditorPropertiesWindow-->colorTintSwatch.color = (%material).diffuseColor[%layer];
MaterialEditorPropertiesWindow-->specularColorSwatch.color = (%material).specular[%layer];
MaterialEditorPropertiesWindow-->SmoothnessTextEdit.setText((%material).Smoothness[%layer]);
MaterialEditorPropertiesWindow-->SmoothnessSlider.setValue((%material).Smoothness[%layer]);
MaterialEditorPropertiesWindow-->RoughnessTextEdit.setText((%material).Roughness[%layer]);
MaterialEditorPropertiesWindow-->RoughnessSlider.setValue((%material).Roughness[%layer]);
MaterialEditorPropertiesWindow-->MetalnessTextEdit.setText((%material).Metalness[%layer]);
MaterialEditorPropertiesWindow-->MetalnessSlider.setValue((%material).Metalness[%layer]);
MaterialEditorPropertiesWindow-->glowMulTextEdit.setText((%material).glowMul[%layer]);
@ -1065,7 +1065,7 @@ function MaterialEditorGui::guiSync( %this, %material )
MaterialEditorPropertiesWindow-->accuCheckbox.setValue((%material).accuEnabled[%layer]);
%this.getRoughChan((%material).SmoothnessChan[%layer]);
%this.getRoughChan((%material).RoughnessChan[%layer]);
%this.getAOChan((%material).AOChan[%layer]);
%this.getMetalChan((%material).metalChan[%layer]);
%this.getGlowChan((%material).glowChan[%layer]);
@ -1276,7 +1276,7 @@ function MaterialEditorGui::updateDetailNormalStrength(%this,%newStrength)
MaterialEditorGui.updateActiveMaterial("detailNormalMapStrength[" @ %layer @ "]", %detailStrength);
}
function MaterialEditorGui::updatePBRConfigMap(%this,%action)
function MaterialEditorGui::updateORMConfigMap(%this,%action)
{
%layer = MaterialEditorGui.currentLayer;
@ -1287,20 +1287,20 @@ function MaterialEditorGui::updatePBRConfigMap(%this,%action)
{
MaterialEditorGui.updateActiveMaterial("pixelSpecular[" @ MaterialEditorGui.currentLayer @ "]", 0);
MaterialEditorPropertiesWindow-->PBRConfigMapDisplayBitmap.setBitmap(%texture);
MaterialEditorPropertiesWindow-->ORMConfigMapDisplayBitmap.setBitmap(%texture);
%bitmap = MaterialEditorPropertiesWindow-->PBRConfigMapDisplayBitmap.bitmap;
%bitmap = MaterialEditorPropertiesWindow-->ORMConfigMapDisplayBitmap.bitmap;
%bitmap = strreplace(%bitmap,"tools/materialEditor/scripts/","");
MaterialEditorPropertiesWindow-->PBRConfigMapDisplayBitmap.setBitmap(%bitmap);
MaterialEditorPropertiesWindow-->PBRConfigMapNameText.setText(%bitmap);
MaterialEditorGui.updateActiveMaterial("PBRConfigMap[" @ %layer @ "]","\"" @ %bitmap @ "\"");
MaterialEditorPropertiesWindow-->ORMConfigMapDisplayBitmap.setBitmap(%bitmap);
MaterialEditorPropertiesWindow-->ORMConfigMapNameText.setText(%bitmap);
MaterialEditorGui.updateActiveMaterial("ORMConfigMap[" @ %layer @ "]","\"" @ %bitmap @ "\"");
}
}
else
{
MaterialEditorPropertiesWindow-->PBRConfigMapNameText.setText("None");
MaterialEditorPropertiesWindow-->PBRConfigMapDisplayBitmap.setBitmap("tools/materialEditor/gui/unknownImage");
MaterialEditorGui.updateActiveMaterial("PBRConfigMap[" @ %layer @ "]","");
MaterialEditorPropertiesWindow-->ORMConfigMapNameText.setText("None");
MaterialEditorPropertiesWindow-->ORMConfigMapDisplayBitmap.setBitmap("tools/materialEditor/gui/unknownImage");
MaterialEditorGui.updateActiveMaterial("ORMConfigMap[" @ %layer @ "]","");
}
MaterialEditorGui.guiSync( materialEd_previewMaterial );
@ -2524,7 +2524,7 @@ function MaterialEditorGui::updateAccuCheckbox(%this, %value)
// channel in selectors
function MaterialEditorGui::setRoughChan(%this, %value)
{
MaterialEditorGui.updateActiveMaterial("SmoothnessChan[" @ MaterialEditorGui.currentLayer @ "]", %value);
MaterialEditorGui.updateActiveMaterial("RoughnessChan[" @ MaterialEditorGui.currentLayer @ "]", %value);
MaterialEditorGui.guiSync( materialEd_previewMaterial );
}
@ -2573,13 +2573,12 @@ function MaterialEditorGui::saveCompositeMap(%this)
%metalMap = %material.metalMap[%layer];
%glowMap = %material.glowMap[%layer];
%smooth = %material.SmoothnessChan[%layer];
%roughness = %material.RoughnessChan[%layer];
%ao = %material.AOChan[%layer];
%metal = %material.metalChan[%layer];
%glow = %material.glowChan[%layer];
%channelKey = %smooth SPC %ao SPC %metal SPC %glow;
%channelKey = %roughness SPC %ao SPC %metal SPC 0;
error("Storing: \"" @ %roughMap @"\" \""@ %aoMap @"\" \""@ %metalMap @"\" \""@ %channelKey @"\" \""@ %saveAs @"\"");
saveCompositeTexture(%roughMap,%aoMap,%metalMap,%glowMap,%channelKey, %saveAs);
saveCompositeTexture(%roughMap,%aoMap,%metalMap,"",%channelKey, %saveAs);
%dlg.delete();
}

View file

@ -2,7 +2,7 @@ singleton Material(ReflectProbePreviewMat)
{
mapTo = "ReflectProbePreviewMat";
diffuseColor[0] = "1 1 1 1";
smoothness[0] = "1";
roughness[0] = "0";
metalness[0] = "1";
translucentBlendOp = "None";
};

View file

@ -767,12 +767,12 @@
tooltipProfile = "ToolsGuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
internalName = "pbrConfigTexCtrl";
internalName = "ormConfigTexCtrl";
canSave = "1";
canSaveDynamicFields = "0";
};
new GuiTextCtrl() {
text = "PBR Config";
text = "ORM Config";
maxLength = "1024";
margin = "0 0 0 0";
padding = "0 0 0 0";
@ -812,9 +812,9 @@
profile = "ToolsGuiDefaultProfile";
visible = "1";
active = "1";
command = "TerrainMaterialDlg.changePBRConfig();";
command = "TerrainMaterialDlg.changeormConfig();";
tooltipProfile = "ToolsGuiDefaultProfile";
tooltip = "Change the active PBR Config Map for this layer.";
tooltip = "Change the active ORM Config Map for this layer.";
hovertime = "1000";
isContainer = "0";
canSave = "1";
@ -856,7 +856,7 @@
profile = "ToolsGuiButtonProfile";
visible = "1";
active = "1";
command = "TerrainMaterialDlg.changePBRConfig();";
command = "TerrainMaterialDlg.changeormConfig();";
tooltipProfile = "ToolsGuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
@ -881,7 +881,7 @@
profile = "ToolsGuiDefaultProfile";
visible = "1";
active = "1";
command = "TerrainMaterialDlg-->pbrConfigTexCtrl.setBitmap(\"tools/materialEditor/gui/unknownImage\");";
command = "TerrainMaterialDlg-->ormConfigTexCtrl.setBitmap(\"tools/materialEditor/gui/unknownImage\");";
tooltipProfile = "ToolsGuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
@ -909,7 +909,7 @@
canSaveDynamicFields = "0";
};
new GuiCheckBoxCtrl() {
text = " Invert Smoothness";
text = " Invert Roughness";
groupNum = "-1";
buttonType = "ToggleButton";
useMouseEvents = "0";
@ -924,7 +924,7 @@
tooltipProfile = "ToolsGuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
internalName = "invertSmoothness";
internalName = "invertRoughness";
canSave = "1";
canSaveDynamicFields = "0";
};

View file

@ -307,9 +307,9 @@ function TerrainMaterialDlg::changeNormal( %this )
}
//-----------------------------------------------------------------------------
function TerrainMaterialDlg::changePBRConfig( %this )
function TerrainMaterialDlg::changeormConfig( %this )
{
%ctrl = %this-->pbrConfigTexCtrl;
%ctrl = %this-->ormConfigTexCtrl;
%file = %ctrl.bitmap;
if( getSubStr( %file, 0 , 6 ) $= "tools/" )
%file = "";
@ -417,10 +417,10 @@ function TerrainMaterialDlg::setActiveMaterial( %this, %mat )
}else{
%this-->baseTexCtrl.setBitmap( %mat.diffuseMap );
}
if (%mat.pbrConfigMap $= ""){
%this-->pbrConfigTexCtrl.setBitmap( "tools/materialEditor/gui/unknownImage" );
if (%mat.ormConfigMap $= ""){
%this-->ormConfigTexCtrl.setBitmap( "tools/materialEditor/gui/unknownImage" );
}else{
%this-->pbrConfigTexCtrl.setBitmap( %mat.pbrConfigMap );
%this-->ormConfigTexCtrl.setBitmap( %mat.ormConfigMap );
}
if (%mat.detailMap $= ""){
%this-->detailTexCtrl.setBitmap( "tools/materialEditor/gui/unknownImage" );
@ -449,7 +449,7 @@ function TerrainMaterialDlg::setActiveMaterial( %this, %mat )
%this-->macroDistanceCtrl.setText( %mat.macroDistance );
%this-->isSRGB.setValue( %mat.isSRGB );
%this-->invertSmoothness.setValue( %mat.invertSmoothness );
%this-->invertRoughness.setValue( %mat.invertRoughness );
%this.activateMaterialCtrls( true );
}
@ -483,10 +483,10 @@ function TerrainMaterialDlg::saveDirtyMaterial( %this, %mat )
}else{
%newNormal = %this-->normTexCtrl.bitmap;
}
if (%this-->pbrConfigTexCtrl.bitmap $= "tools/materialEditor/gui/unknownImage"){
%newPBRConfig = "";
if (%this-->ormConfigTexCtrl.bitmap $= "tools/materialEditor/gui/unknownImage"){
%newormConfig = "";
}else{
%newPBRConfig = %this-->pbrConfigTexCtrl.bitmap;
%newormConfig = %this-->ormConfigTexCtrl.bitmap;
}
if (%this-->detailTexCtrl.bitmap $= "tools/materialEditor/gui/unknownImage"){
%newDetail = "";
@ -510,7 +510,7 @@ function TerrainMaterialDlg::saveDirtyMaterial( %this, %mat )
%macroDistance = %this-->macroDistanceCtrl.getText();
%isSRGB = %this-->isSRGB.getValue();
%invertSmoothness = %this-->invertSmoothness.getValue();
%invertRoughness = %this-->invertRoughness.getValue();
// If no properties of this materials have changed,
// return.
@ -519,7 +519,7 @@ function TerrainMaterialDlg::saveDirtyMaterial( %this, %mat )
%mat.diffuseMap $= %newDiffuse &&
%mat.normalMap $= %newNormal &&
%mat.detailMap $= %newDetail &&
%mat.pbrConfigMap $= %newPBRConfig &&
%mat.ormConfigMap $= %newormConfig &&
%mat.macroMap $= %newMacro &&
%mat.detailSize == %detailSize &&
%mat.diffuseSize == %diffuseSize &&
@ -531,7 +531,7 @@ function TerrainMaterialDlg::saveDirtyMaterial( %this, %mat )
%mat.macroDistance == %macroDistance &&
%mat.parallaxScale == %parallaxScale &&
%mat.isSRGB == %isSRGB &&
%mat.invertSmoothness == %invertSmoothness)
%mat.invertRoughness == %invertRoughness)
return;
// Make sure the material name is unique.
@ -555,7 +555,7 @@ function TerrainMaterialDlg::saveDirtyMaterial( %this, %mat )
%mat.diffuseMap = %newDiffuse;
%mat.diffuseMapAsset = "";
%mat.normalMap = %newNormal;
%mat.pbrConfigMap = %newPBRConfig;
%mat.ormConfigMap = %newormConfig;
%mat.detailMap = %newDetail;
%mat.macroMap = %newMacro;
%mat.detailSize = %detailSize;
@ -568,7 +568,7 @@ function TerrainMaterialDlg::saveDirtyMaterial( %this, %mat )
%mat.useSideProjection = %useSideProjection;
%mat.parallaxScale = %parallaxScale;
%mat.isSRGB = %isSRGB;
%mat.invertSmoothness = %invertSmoothness;
%mat.invertRoughness = %invertRoughness;
// Mark the material as dirty and needing saving.
@ -607,7 +607,7 @@ function TerrainMaterialDlg::snapshotMaterials( %this )
internalName = %mat.internalName;
diffuseMap = %mat.diffuseMap;
normalMap = %mat.normalMap;
pbrConfigMap = %mat.pbrConfigMap;
ormConfigMap = %mat.ormConfigMap;
detailMap = %mat.detailMap;
macroMap = %mat.macroMap;
detailSize = %mat.detailSize;
@ -620,7 +620,7 @@ function TerrainMaterialDlg::snapshotMaterials( %this )
useSideProjection = %mat.useSideProjection;
parallaxScale = %mat.parallaxScale;
isSRGB = %mat.isSRGB;
invertSmoothness = %mat.invertSmoothness;
invertRoughness = %mat.invertRoughness;
};
}
}
@ -644,7 +644,7 @@ function TerrainMaterialDlg::restoreMaterials( %this )
%mat.setInternalName( %obj.internalName );
%mat.diffuseMap = %obj.diffuseMap;
%mat.normalMap = %obj.normalMap;
%mat.pbrConfigMap = %obj.pbrConfigMap;
%mat.ormConfigMap = %obj.ormConfigMap;
%mat.detailMap = %obj.detailMap;
%mat.macroMap = %obj.macroMap;
%mat.detailSize = %obj.detailSize;
@ -657,7 +657,7 @@ function TerrainMaterialDlg::restoreMaterials( %this )
%mat.useSideProjection = %obj.useSideProjection;
%mat.parallaxScale = %obj.parallaxScale;
%mat.isSRGB = %obj.isSRGB;
%mat.invertSmoothness = %obj.invertSmoothness;
%mat.invertRoughness = %obj.invertRoughness;
}
}