Added Forward Material debug viz for HLSL(so far) and integrated it back into editor flagging.

Re-added logic to track existing probe shader consts instead of constantly recreating it
Added logic for pre multiplied translucency mode
This commit is contained in:
Areloch 2019-11-21 00:48:55 -06:00
parent c74b669f5e
commit 72ceede272
16 changed files with 424 additions and 30 deletions

View file

@ -79,6 +79,7 @@ function MaterialEditorGui::open(%this)
MaterialEditorPropertiesWindow-->blendingTypePopUp.add(AddAlpha,3);
MaterialEditorPropertiesWindow-->blendingTypePopUp.add(Sub,4);
MaterialEditorPropertiesWindow-->blendingTypePopUp.add(LerpAlpha,5);
MaterialEditorPropertiesWindow-->blendingTypePopUp.add(PreMult,6);
MaterialEditorPropertiesWindow-->blendingTypePopUp.setSelected( 0, false );
//Reflection Types
@ -786,6 +787,7 @@ function MaterialEditorGui::guiSync( %this, %material )
case "AddAlpha": %selectedNum = 3;
case "Sub": %selectedNum = 4;
case "LerpAlpha": %selectedNum = 5;
case "PreMult": %selectedNum = 6;
}
MaterialEditorPropertiesWindow-->blendingTypePopUp.setSelected(%selectedNum);

View file

@ -110,8 +110,47 @@ singleton PostEffect( Viz_SurfacePropertiesPFX )
target = "$backBuffer";
renderPriority = 9999;
renderTime = "PFXBeforeBin";
renderBin = "ObjTranslucentBin";
};
function toggleDebugVizMode( %mode )
{
switch$ ( %mode )
{
case "All Materials":
$Viz_DisplayMode = "0";
case "Forward Materials Only":
$Viz_DisplayMode = "1";
case "Deferred Materials Only":
$Viz_DisplayMode = "2";
default:
$Viz_DisplayMode = "0";
}
if($Viz_DisplayMode == 1)
{
Viz_SurfacePropertiesPFX.disable();
}
else
{
if($Viz_SurfacePropertiesModeVar != "" && $Viz_SurfacePropertiesModeVar != -1)
Viz_SurfacePropertiesPFX.enable();
}
for(%i=0; %i < 3; %i++)
{
if(%i == $Viz_DisplayMode)
EBufferVizModeOptions.checkItem(%i, true);
else
EBufferVizModeOptions.checkItem(%i, false);
}
//forces the forward materials to get dis viz properly
reInitMaterials();
}
/// Toggles the visualization of the AL lighting specular power buffer.
function toggleSurfacePropertiesViz( %mode )
{
@ -153,17 +192,24 @@ function toggleSurfacePropertiesViz( %mode )
$Viz_SurfacePropertiesModeVar = "-1";
}
//If the visualizer isn't enabled, we just flip it on
if(!Viz_SurfacePropertiesPFX.isEnabled())
if($Viz_DisplayMode == 1)
{
Viz_SurfacePropertiesPFX.enable();
Viz_SurfacePropertiesPFX.disable();
}
else //if it's currently enabled, check if we clicked the same mode again. If so, disable. If not, just swap modes to the new one
else
{
if(%previousMode == $Viz_SurfacePropertiesModeVar)
//If the visualizer isn't enabled, we just flip it on
if(!Viz_SurfacePropertiesPFX.isEnabled())
{
$Viz_SurfacePropertiesModeVar = -1;
Viz_SurfacePropertiesPFX.disable();
Viz_SurfacePropertiesPFX.enable();
}
else //if it's currently enabled, check if we clicked the same mode again. If so, disable. If not, just swap modes to the new one
{
if(%previousMode == $Viz_SurfacePropertiesModeVar)
{
$Viz_SurfacePropertiesModeVar = -1;
Viz_SurfacePropertiesPFX.disable();
}
}
}
@ -174,6 +220,9 @@ function toggleSurfacePropertiesViz( %mode )
else
EVisibilityBufferVizOptions.checkItem(%i, false);
}
//forces the forward materials to get dis viz properly
reInitMaterials();
}
function Viz_SurfacePropertiesPFX::setShaderConsts(%this)

View file

@ -155,6 +155,18 @@ function setupEditorVisibilityMenu()
%probespopup.enableItem(4, false);
%bufferVizpopup = new PopupMenu(EBufferVizModeOptions)
{
superClass = "MenuBuilder";
class = "EditorWorldMenu";
item[ 0 ] = "All Materials" TAB "" TAB "toggleDebugVizMode(\"All Materials\");";
item[ 1 ] = "Forward Materials Only" TAB "" TAB "toggleDebugVizMode(\"Forward Materials Only\");";
item[ 2 ] = "Deferred Materials Only" TAB "" TAB "toggleDebugVizMode(\"Deferred Materials Only\");";
};
toggleDebugVizMode("All Materials");
//
//Buffer Viz
%bufferVizpopup = new PopupMenu(EVisibilityBufferVizOptions)
@ -162,26 +174,28 @@ function setupEditorVisibilityMenu()
superClass = "MenuBuilder";
class = "EditorWorldMenu";
item[ 0 ] = "Base Color" TAB "" TAB "toggleSurfacePropertiesViz(\"BaseColor\");";
item[ 1 ] = "Normals" TAB "" TAB "toggleSurfacePropertiesViz(\"Normal\");";
item[ 2 ] = "Material Ambient Occlusion" TAB "" TAB "toggleSurfacePropertiesViz(\"AO\");";
item[ 3 ] = "Roughness" TAB "" TAB "toggleSurfacePropertiesViz(\"Roughness\");";
item[ 4 ] = "Metalness" TAB "" TAB "toggleSurfacePropertiesViz(\"Metalness\");";
item[ 5 ] = "Depth" TAB "" TAB "toggleSurfacePropertiesViz(\"Depth\");";
item[ 0 ] = "Display Mode" TAB EBufferVizModeOptions;
item[ 6 ] = "Diffuse Color" TAB "" TAB "toggleSurfacePropertiesViz(\"DiffuseColor\");";
item[ 7 ] = "Specular Color" TAB "" TAB "toggleSurfacePropertiesViz(\"SpecularColor\");";
item[ 8 ] = "Material Flags" TAB "" TAB "toggleSurfacePropertiesViz(\"MatFlag\");";
item[ 1 ] = "Base Color" TAB "" TAB "toggleSurfacePropertiesViz(\"BaseColor\");";
item[ 2 ] = "Normals" TAB "" TAB "toggleSurfacePropertiesViz(\"Normal\");";
item[ 3 ] = "Material Ambient Occlusion" TAB "" TAB "toggleSurfacePropertiesViz(\"AO\");";
item[ 4 ] = "Roughness" TAB "" TAB "toggleSurfacePropertiesViz(\"Roughness\");";
item[ 5 ] = "Metalness" TAB "" TAB "toggleSurfacePropertiesViz(\"Metalness\");";
item[ 6 ] = "Depth" TAB "" TAB "toggleSurfacePropertiesViz(\"Depth\");";
item[ 9 ] = "World Position" TAB "" TAB "toggleSurfacePropertiesViz(\"WorldPos\");";
item[ 10 ] = "Reflection Vector" TAB "" TAB "toggleSurfacePropertiesViz(\"ReflectionVector\");";
item[ 7 ] = "Diffuse Color" TAB "" TAB "toggleSurfacePropertiesViz(\"DiffuseColor\");";
item[ 8 ] = "Specular Color" TAB "" TAB "toggleSurfacePropertiesViz(\"SpecularColor\");";
item[ 9 ] = "Material Flags" TAB "" TAB "toggleSurfacePropertiesViz(\"MatFlag\");";
item[ 11 ] = "Fresnel" TAB "" TAB "toggleSurfacePropertiesViz(\"Fresnel\");";
item[ 10 ] = "World Position" TAB "" TAB "toggleSurfacePropertiesViz(\"WorldPos\");";
item[ 11 ] = "Reflection Vector" TAB "" TAB "toggleSurfacePropertiesViz(\"ReflectionVector\");";
item[ 12 ] = "Ambient Occlusion" TAB "" TAB "toggleSurfacePropertiesViz(\"SSAO\");";
item[ 12 ] = "Fresnel" TAB "" TAB "toggleSurfacePropertiesViz(\"Fresnel\");";
item[ 13 ] = "Backbuffer" TAB "" TAB "toggleSurfacePropertiesViz(\"Backbuffer\");";
item[ 14 ] = "Glow" TAB "" TAB "toggleSurfacePropertiesViz(\"Glow\");";
item[ 13 ] = "Ambient Occlusion" TAB "" TAB "toggleSurfacePropertiesViz(\"SSAO\");";
item[ 14 ] = "Backbuffer" TAB "" TAB "toggleSurfacePropertiesViz(\"Backbuffer\");";
item[ 15 ] = "Glow" TAB "" TAB "toggleSurfacePropertiesViz(\"Glow\");";
};
//