mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-12 15:14:35 +00:00
Blinn-Phong Specular Changes
Based on the work done here: http://www.garagegames.com/community/blogs/view/21032
This commit is contained in:
parent
f5246bb809
commit
17113d3ba5
25 changed files with 167 additions and 26 deletions
|
|
@ -221,7 +221,7 @@ void main()
|
|||
normal,
|
||||
normalize( -eyeRay ),
|
||||
constantSpecularPower,
|
||||
lightColor.a * lightBrightness );
|
||||
shadowed * atten * lightBrightness );
|
||||
|
||||
// N.L * Attenuation
|
||||
float Sat_NL_Att = clamp( nDotL * atten * shadowed, 0.0, 1.0 );
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ void main()
|
|||
normal,
|
||||
normalize( -eyeRay ),
|
||||
constantSpecularPower,
|
||||
lightColor.a * lightBrightness );
|
||||
shadowed * atten * lightBrightness );
|
||||
|
||||
// N.L * Attenuation
|
||||
float Sat_NL_Att = clamp( nDotL * atten * shadowed, 0.0, 1.0 );
|
||||
|
|
|
|||
|
|
@ -196,7 +196,7 @@ void main()
|
|||
normal,
|
||||
normalize(-wsEyeRay),
|
||||
constantSpecularPower,
|
||||
lightColor.a * lightBrightness );
|
||||
shadowed * lightBrightness );
|
||||
|
||||
float Sat_NL_Att = clamp(dotNL, 0.0, 1.0) * shadowed;
|
||||
|
||||
|
|
|
|||
|
|
@ -213,7 +213,7 @@ float4 main( ConvexConnectP IN,
|
|||
// Specular term
|
||||
float specular = AL_CalcSpecular( lightVec,
|
||||
normal,
|
||||
normalize( -eyeRay ) ) * lightColor.a;
|
||||
normalize( -eyeRay ) ) * lightBrightness * atten * shadowed;
|
||||
|
||||
float Sat_NL_Att = saturate( nDotL * atten * shadowed ) * lightBrightness;
|
||||
float3 lightColorOut = lightMapParams.rgb * lightColor.rgb;
|
||||
|
|
|
|||
|
|
@ -141,7 +141,7 @@ float4 main( ConvexConnectP IN,
|
|||
// Specular term
|
||||
float specular = AL_CalcSpecular( -lightToPxlVec,
|
||||
normal,
|
||||
normalize( -eyeRay ) ) * lightColor.a;
|
||||
normalize( -eyeRay ) ) * lightBrightness * atten * shadowed;
|
||||
|
||||
float Sat_NL_Att = saturate( nDotL * atten * shadowed ) * lightBrightness;
|
||||
float3 lightColorOut = lightMapParams.rgb * lightColor.rgb;
|
||||
|
|
|
|||
|
|
@ -198,7 +198,7 @@ float4 main( FarFrustumQuadConnectP IN,
|
|||
// Specular term
|
||||
float specular = AL_CalcSpecular( -lightDirection,
|
||||
normal,
|
||||
normalize(-IN.vsEyeRay) ) * lightColor.a;
|
||||
normalize(-IN.vsEyeRay) ) * lightBrightness * shadowed;
|
||||
|
||||
float Sat_NL_Att = saturate( dotNL * shadowed ) * lightBrightness;
|
||||
float3 lightColorOut = lightMapParams.rgb * lightColor.rgb;
|
||||
|
|
|
|||
|
|
@ -1522,7 +1522,7 @@
|
|||
profile = "ToolsGuiTransparentProfile";
|
||||
isContainer = "1";
|
||||
position = "0 0";
|
||||
Extent = "185 22";
|
||||
Extent = "185 44";
|
||||
HorizSizing = "width";
|
||||
|
||||
new GuiCheckBoxCtrl() {
|
||||
|
|
@ -1568,6 +1568,14 @@
|
|||
useMouseEvents = "0";
|
||||
};
|
||||
|
||||
new GuiTextCtrl() {
|
||||
HorizSizing = "right";
|
||||
VertSizing = "bottom";
|
||||
position = "9 26";
|
||||
Extent = "72 16";
|
||||
text = "Spec strength";
|
||||
};
|
||||
|
||||
new GuiControl() {
|
||||
class = "AggregateControl";
|
||||
position = "91 4";
|
||||
|
|
@ -1589,7 +1597,7 @@
|
|||
Command = "MaterialEditorGui.updateActiveMaterial(\"specularPower[\" @ MaterialEditorGui.currentLayer @ \"]\", mCeil($ThisControl.getValue()), true, true);";
|
||||
AltCommand = "$ThisControl.getParent().updateFromChild($ThisControl); MaterialEditorGui.updateActiveMaterial(\"specularPower[\" @ MaterialEditorGui.currentLayer @ \"]\", mCeil($ThisControl.getValue()), true, false);";
|
||||
tooltipprofile = "ToolsGuiDefaultProfile";
|
||||
ToolTip = "Sets the strength of the Pixel Specular value.";
|
||||
ToolTip = "Sets the hardness of the Pixel Specular value.";
|
||||
hovertime = "1000";
|
||||
range = "1 128";
|
||||
ticks = "0";
|
||||
|
|
@ -1618,6 +1626,57 @@
|
|||
maxLength = "3";
|
||||
};
|
||||
};
|
||||
|
||||
new GuiControl() {
|
||||
class = "AggregateControl";
|
||||
position = "91 26";
|
||||
Extent = "96 20";
|
||||
|
||||
new GuiSliderCtrl() {
|
||||
canSaveDynamicFields = "0";
|
||||
internalName = "specularStrengthSlider";
|
||||
Enabled = "1";
|
||||
isContainer = "0";
|
||||
Profile = "ToolsGuiSliderProfile";
|
||||
HorizSizing = "right";
|
||||
VertSizing = "bottom";
|
||||
position = "0 1";
|
||||
Extent = "61 14";
|
||||
MinExtent = "8 2";
|
||||
canSave = "1";
|
||||
Visible = "1";
|
||||
Command = "MaterialEditorGui.updateActiveMaterial(\"specularStrength[\" @ MaterialEditorGui.currentLayer @ \"]\", $ThisControl.getValue(), true, true);";
|
||||
AltCommand = "$ThisControl.getParent().updateFromChild($ThisControl); MaterialEditorGui.updateActiveMaterial(\"specularStrength[\" @ MaterialEditorGui.currentLayer @ \"]\", $ThisControl.getValue(), true, false);";
|
||||
tooltipprofile = "ToolsGuiDefaultProfile";
|
||||
ToolTip = "Sets the strength of the Pixel Specular value.";
|
||||
hovertime = "1000";
|
||||
range = "0 5";
|
||||
ticks = "0";
|
||||
value = "1";
|
||||
};
|
||||
new GuiTextEditCtrl() {
|
||||
canSaveDynamicFields = "0";
|
||||
internalName = "specularStrengthTextEdit";
|
||||
Enabled = "1";
|
||||
isContainer = "0";
|
||||
Profile = "ToolsGuiTextEditProfile";
|
||||
HorizSizing = "right";
|
||||
VertSizing = "bottom";
|
||||
position = "64 0";
|
||||
Extent = "29 18";
|
||||
MinExtent = "8 2";
|
||||
canSave = "1";
|
||||
Visible = "1";
|
||||
Command = "$ThisControl.getParent().updateFromChild($ThisControl); MaterialEditorGui.updateActiveMaterial(\"specularStrength[\" @ MaterialEditorGui.currentLayer @ \"]\", $ThisControl.getValue());";
|
||||
hovertime = "1000";
|
||||
AnchorTop = "1";
|
||||
AnchorBottom = "0";
|
||||
AnchorLeft = "1";
|
||||
AnchorRight = "0";
|
||||
text = "1";
|
||||
maxLength = "3";
|
||||
};
|
||||
};
|
||||
};
|
||||
new GuiContainer(){ // glow emissive
|
||||
profile = "ToolsGuiTransparentProfile";
|
||||
|
|
|
|||
|
|
@ -894,6 +894,8 @@ function MaterialEditorGui::guiSync( %this, %material )
|
|||
|
||||
MaterialEditorPropertiesWindow-->specularPowerTextEdit.setText((%material).specularPower[%layer]);
|
||||
MaterialEditorPropertiesWindow-->specularPowerSlider.setValue((%material).specularPower[%layer]);
|
||||
MaterialEditorPropertiesWindow-->specularStrengthTextEdit.setText((%material).specularStrength[%layer]);
|
||||
MaterialEditorPropertiesWindow-->specularStrengthSlider.setValue((%material).specularStrength[%layer]);
|
||||
MaterialEditorPropertiesWindow-->pixelSpecularCheckbox.setValue((%material).pixelSpecular[%layer]);
|
||||
MaterialEditorPropertiesWindow-->glowCheckbox.setValue((%material).glow[%layer]);
|
||||
MaterialEditorPropertiesWindow-->emissiveCheckbox.setValue((%material).emissive[%layer]);
|
||||
|
|
@ -2142,9 +2144,7 @@ function MaterialEditorGui::changeMaterial(%this, %fromMaterial, %toMaterial)
|
|||
|
||||
MaterialEditorGui.currentObject.changeMaterial( %materialTarget, %fromMaterial.getName(), %toMaterial.getName() );
|
||||
|
||||
if( MaterialEditorGui.currentObject.interiorFile !$= "" )
|
||||
%sourcePath = MaterialEditorGui.currentObject.interiorFile;
|
||||
else if( MaterialEditorGui.currentObject.shapeName !$= "" )
|
||||
if( MaterialEditorGui.currentObject.shapeName !$= "" )
|
||||
%sourcePath = MaterialEditorGui.currentObject.shapeName;
|
||||
else if( MaterialEditorGui.currentObject.isMethod("getDatablock") )
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue