Merge branch 'development' of https://github.com/TorqueGameEngines/Torque3D into classPrototypingPresenter

This commit is contained in:
AzaezelX 2023-11-29 14:16:37 -06:00
commit 045c15fd26
36 changed files with 313 additions and 91 deletions

View file

@ -4,8 +4,15 @@ foreach(TEMPLATE_FILE ${TEMPLATE_FILES})
endforeach()
# Perform installation minus scripts
file(COPY "game" "source" DESTINATION "${TORQUE_APP_ROOT_DIRECTORY}" PATTERN "*.tscript" EXCLUDE PATTERN
PATTERN "*.in" EXCLUDE PATTERN)
if(WIN32)
file(COPY "game" "source" DESTINATION "${TORQUE_APP_ROOT_DIRECTORY}" PATTERN "*.tscript" EXCLUDE
PATTERN "*.in" EXCLUDE)
else()
file(COPY "game" "source" DESTINATION "${TORQUE_APP_ROOT_DIRECTORY}" PATTERN "*.tscript" EXCLUDE
PATTERN "*.in" EXCLUDE
PATTERN "*.dll" EXCLUDE)
endif(WIN32)
# Enumerate scripts and install with extension
file(GLOB_RECURSE SCRIPT_FILES "game/*.tscript")
foreach(ITEM ${SCRIPT_FILES})

Binary file not shown.

View file

@ -26,11 +26,7 @@ $PostFX::HDRPostFX::enableToneMapping = 0.5;
/// The tone mapping middle grey or exposure value used
/// to adjust the overall "balance" of the image.
///
/// 0.18 is fairly common value.
///
$PostFX::HDRPostFX::keyValue = 0.115;
$PostFX::HDRPostFX::keyValue = 0.5;
//Explicit HDR Params

View file

@ -73,4 +73,14 @@ float D_GGX(float NdotH, float alphaRoughnessSq)
return alphaRoughnessSq / (M_PI_F * f * f);
}
float3 Fr_DisneyDiffuse(float3 F0, float NdotV, float NdotL, float LdotH, float linearRoughness)
{
float energyBias = lerp (0 , 0.5 , linearRoughness );
float energyFactor = lerp (1.0 , 1.0 / 1.51 , linearRoughness );
float fd90 = energyBias + 2.0 * LdotH * LdotH * linearRoughness ;
float3 lightScatter = F_Schlick( F0 , fd90 , NdotL );
float3 viewScatter = F_Schlick(F0 , fd90 , NdotV );
return lightScatter * viewScatter * energyFactor ;
}
#endif

View file

@ -67,4 +67,15 @@ float D_GGX(float NdotH, float alphaRoughnessSq)
return alphaRoughnessSq / (M_PI_F * f * f);
}
vec3 Fr_DisneyDiffuse(vec3 F0, float NdotV, float NdotL, float LdotH, float linearRoughness)
{
float energyBias = lerp(0 , 0.5 , linearRoughness );
float energyFactor = lerp(1.0 , 1.0 / 1.51 , linearRoughness );
float fd90 = energyBias + 2.0 * LdotH * LdotH * linearRoughness ;
vec3 lightScatter = F_Schlick( F0 , fd90 , NdotL );
vec3 viewScatter = F_Schlick(F0 , fd90 , NdotV );
return lightScatter * viewScatter * energyFactor ;
}
#endif

View file

@ -216,15 +216,15 @@ float getDistanceAtt( vec3 unormalizedLightVector , float invSqrAttRadius )
float getSpotAngleAtt( vec3 normalizedLightVector , vec3 lightDir , vec2 lightSpotParams )
{
float cd = dot ( lightDir , normalizedLightVector );
float attenuation = saturate ( ( cd - lightSpotParams.x ) / lightSpotParams.y );
float cd = max(dot( lightDir , normalizedLightVector ),0.0);
float attenuation = saturate ( ( cd - lightSpotParams.x/(cd*1.001) ) / lightSpotParams.y );
// smooth the transition
return sqr(attenuation);
}
vec3 evaluateStandardBRDF(Surface surface, SurfaceToLight surfaceToLight)
{
//lambert diffuse
//diffuse term
vec3 Fd = surface.albedo.rgb * M_1OVER_PI_F;
//GGX specular
@ -236,7 +236,7 @@ vec3 evaluateStandardBRDF(Surface surface, SurfaceToLight surfaceToLight)
#if CAPTURING == 1
return saturate(mix(Fd + Fr,surface.f0,surface.metalness));
#else
return saturate(Fd + Fr);
return Fd + Fr;
#endif
}
@ -254,6 +254,15 @@ vec3 getPunctualLight(Surface surface, SurfaceToLight surfaceToLight, vec3 light
return evaluateStandardBRDF(surface,surfaceToLight) * factor;
}
vec3 getSpotlight(Surface surface, SurfaceToLight surfaceToLight, vec3 lightColor, float lightIntensity, float radius, vec3 lightDir, vec2 lightSpotParams, float shadow)
{
float attenuation = 1.0f;
attenuation *= getDistanceAtt(surfaceToLight.Lu, radius);
attenuation *= getSpotAngleAtt(-surfaceToLight.L, lightDir, lightSpotParams.xy);
vec3 factor = lightColor * max(surfaceToLight.NdotL* shadow * lightIntensity * attenuation, 0.0f) ;
return evaluateStandardBRDF(surface,surfaceToLight) * factor;
}
float computeSpecOcclusion( float NdotV , float AO , float roughness )
{
return saturate (pow( abs(NdotV + AO) , exp2 ( -16.0f * roughness - 1.0f )) - 1.0f + AO );
@ -270,7 +279,7 @@ vec4 compute4Lights( Surface surface,
vec4 inLightConfigData[4],
vec4 inLightColor[4],
vec4 inLightSpotDir[4],
vec2 lightSpotParams[4],
vec2 inlightSpotParams[4],
int hasVectorLight,
vec4 vectorLightDirection,
vec4 vectorLightingColor,
@ -305,13 +314,10 @@ vec4 compute4Lights( Surface surface,
//get punctual light contribution
lighting = getPunctualLight(surface, surfaceToLight, lightCol, lightBrightness, lightInvSqrRange, shadowed);
}
else //spot
else if(inLightConfigData[i].x == 1) //spot
{
//get Punctual light contribution
lighting = getPunctualLight(surface, surfaceToLight, lightCol, lightBrightness, lightInvSqrRange, shadowed);
//get spot angle attenuation
lighting *= getSpotAngleAtt(-surfaceToLight.L, inLightSpotDir[i].xyz, lightSpotParams[i].xy );
//get spot light contribution
lighting = getSpotlight(surface, surfaceToLight, lightCol, lightBrightness, lightInvSqrRange, inLightSpotDir[i].xyz, inlightSpotParams[i], shadowed);
}
}
finalLighting += lighting;

View file

@ -217,15 +217,15 @@ float getDistanceAtt( float3 unormalizedLightVector , float invSqrAttRadius )
float getSpotAngleAtt( float3 normalizedLightVector , float3 lightDir , float2 lightSpotParams )
{
float cd = dot ( lightDir , normalizedLightVector );
float attenuation = saturate ( ( cd - lightSpotParams.x ) / lightSpotParams.y );
float cd = max(dot ( lightDir , normalizedLightVector ),0.0);
float attenuation = saturate(((cd - lightSpotParams.x/(cd*1.001))/lightSpotParams.y));
// smooth the transition
return sqr(attenuation);
}
float3 evaluateStandardBRDF(Surface surface, SurfaceToLight surfaceToLight)
{
//lambert diffuse
//diffuse term
float3 Fd = surface.albedo.rgb * M_1OVER_PI_F;
//GGX specular
@ -237,7 +237,7 @@ float3 evaluateStandardBRDF(Surface surface, SurfaceToLight surfaceToLight)
#if CAPTURING == 1
return saturate(lerp(Fd + Fr,surface.f0,surface.metalness));
#else
return saturate(Fd + Fr);
return Fd + Fr;
#endif
}
@ -255,6 +255,14 @@ float3 getPunctualLight(Surface surface, SurfaceToLight surfaceToLight, float3 l
return evaluateStandardBRDF(surface,surfaceToLight) * factor;
}
float3 getSpotlight(Surface surface, SurfaceToLight surfaceToLight, float3 lightColor, float lightIntensity, float radius, float3 lightDir, float2 lightSpotParams, float shadow)
{
float attenuation = 1.0f;
attenuation *= getDistanceAtt(surfaceToLight.Lu, radius);
attenuation *= getSpotAngleAtt(-surfaceToLight.L, lightDir, lightSpotParams.xy);
float3 factor = lightColor * max(surfaceToLight.NdotL* shadow * lightIntensity * attenuation, 0.0f) ;
return evaluateStandardBRDF(surface,surfaceToLight) * factor;
}
float computeSpecOcclusion( float NdotV , float AO , float roughness )
{
return saturate (pow( abs(NdotV + AO) , exp2 ( -16.0f * roughness - 1.0f )) - 1.0f + AO );
@ -271,7 +279,7 @@ float4 compute4Lights( Surface surface,
float4 inLightConfigData[4],
float4 inLightColor[4],
float4 inLightSpotDir[4],
float2 lightSpotParams[4],
float2 inlightSpotParams[4],
int hasVectorLight,
float4 vectorLightDirection,
float4 vectorLightingColor,
@ -296,7 +304,7 @@ float4 compute4Lights( Surface surface,
float lightBrightness = inLightConfigData[i].y;
float lightInvSqrRange= inLightConfigData[i].a;
float3 lighting = 0.0.xxx;
float3 lighting = float3(0.0,0.0,0.0);
[branch]
if(dist < lightRange)
@ -307,13 +315,10 @@ float4 compute4Lights( Surface surface,
//get punctual light contribution
lighting = getPunctualLight(surface, surfaceToLight, lightCol, lightBrightness, lightInvSqrRange, shadowed);
}
else //spot
else if(inLightConfigData[i].x == 1) //spot
{
//get Punctual light contribution
lighting = getPunctualLight(surface, surfaceToLight, lightCol, lightBrightness, lightInvSqrRange, shadowed);
//get spot angle attenuation
lighting *= getSpotAngleAtt(-surfaceToLight.L, inLightSpotDir[i].xyz, lightSpotParams[i].xy );
//get spot light contribution
lighting = getSpotlight(surface, surfaceToLight, lightCol, lightBrightness, lightInvSqrRange, inLightSpotDir[i].xyz, inlightSpotParams[i], shadowed);
}
}
finalLighting += lighting;
@ -321,7 +326,7 @@ float4 compute4Lights( Surface surface,
//Vector light
[branch]
if(hasVectorLight)
if(hasVectorLight == 1)
{
SurfaceToLight surfaceToVecLight = createSurfaceToLight(surface, -vectorLightDirection.xyz);

View file

@ -154,10 +154,8 @@ void main()
return;
#endif
//get Punctual light contribution
lighting = getPunctualLight(surface, surfaceToLight, lightCol, lightBrightness, lightInvSqrRange, shadow);
//get spot angle attenuation
lighting *= getSpotAngleAtt(-surfaceToLight.L, lightDirection, lightSpotParams );
//get spot light contribution
lighting = getSpotlight(surface, surfaceToLight, lightCol, lightBrightness, lightInvSqrRange, lightDirection, lightSpotParams, shadow);
}
OUT_col = vec4(lighting, 0);

View file

@ -151,10 +151,8 @@ float4 main( ConvexConnectP IN ) : SV_TARGET
return final;
#endif
//get Punctual light contribution
lighting = getPunctualLight(surface, surfaceToLight, lightCol, lightBrightness, lightInvSqrRange, shadow);
//get spot angle attenuation
lighting *= getSpotAngleAtt(-surfaceToLight.L, lightDirection, lightSpotParams );
//get spot light contribution
lighting = getSpotlight(surface, surfaceToLight, lightCol, lightBrightness, lightInvSqrRange, lightDirection, lightSpotParams, shadow);
}
return float4(lighting, 0);

View file

@ -0,0 +1,5 @@
<ShapeAsset
AssetName="Primitive"
fileName="@assetFile=Primitive.fbx"
constuctorFileName="@assetFile=Primitive.tscript"
materialSlot0="@asset=Prototyping:InteractiveRed"/>

View file

@ -0,0 +1,8 @@
singleton TSShapeConstructor(ArrowPrimitivefbx)
{
baseShapeAsset = "Prototyping:ArrowPrimitive";
singleDetailSize = "0";
neverImportMat = "DefaultMaterial ColorEffect*";
animFPS = "2";
};

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

View file

@ -0,0 +1,3 @@
<ImageAsset
AssetName="ColorCalibrationChart_image"
imageFile="@assetFile=ColorCalibrationChart.png"/>

View file

@ -0,0 +1,13 @@
<MaterialAsset
AssetName="ColorCalibration_mat"
materialDefinitionName="ColorCalibration_mat"
imageMap0="@asset=Prototyping:ColorCalibrationChart_image">
<Material
Name="ColorCalibration_mat"
mapTo="ColorCalibration">
<Material.Stages>
<Stages_beginarray
DiffuseMapAsset="Prototyping:ColorCalibrationChart_image"/>
</Material.Stages>
</Material>
</MaterialAsset>

View file

@ -0,0 +1,16 @@
<MaterialAsset
AssetName="MaterialGridMat"
materialDefinitionName="MaterialGridMat"
imageMap0="@asset=Prototyping:materialGrid_ORM_image">
<Material
Name="MaterialGridMat"
mapTo="MaterialGrid"
originalAssetName="MaterialGridMat">
<Material.Stages>
<Stages_beginarray
ORMConfigMapAsset="Prototyping:materialGrid_ORM_image"/>
<Stages_beginarray
DiffuseColor="White"/>
</Material.Stages>
</Material>
</MaterialAsset>

View file

@ -0,0 +1 @@
<ShapeAsset canSave="true" canSaveDynamicFields="true" AssetName="MaterialGrid_shape" fileName="@assetFile=MaterialGrid.fbx" constuctorFileName="@assetFile=MaterialGrid.tscript" materialSlot0="@asset=TestBed:MaterialGrid" originalFilePath="C:/Users/Arelo/Desktop/MaterialGrid.fbx"/>

View file

@ -0,0 +1,115 @@
<?xml version="1.0" encoding="utf-8"?>
<COLLADA xmlns="http://www.collada.org/2005/11/COLLADASchema" version="1.4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<asset>
<contributor>
<author>Blender User</author>
<authoring_tool>Blender 4.0.1 commit date:2023-11-16, commit time:16:40, hash:d0dd92834a08</authoring_tool>
</contributor>
<created>2023-11-28T06:31:25</created>
<modified>2023-11-28T06:31:25</modified>
<unit name="meter" meter="1"/>
<up_axis>Z_UP</up_axis>
</asset>
<library_effects>
<effect id="ColorCalibration-effect">
<profile_COMMON>
<newparam sid="ColorCalibrationChart_png-surface">
<surface type="2D">
<init_from>ColorCalibrationChart_png</init_from>
</surface>
</newparam>
<newparam sid="ColorCalibrationChart_png-sampler">
<sampler2D>
<source>ColorCalibrationChart_png-surface</source>
</sampler2D>
</newparam>
<technique sid="common">
<lambert>
<emission>
<color sid="emission">0 0 0 1</color>
</emission>
<diffuse>
<texture texture="ColorCalibrationChart_png-sampler" texcoord="UVMap"/>
</diffuse>
<index_of_refraction>
<float sid="ior">1.45</float>
</index_of_refraction>
</lambert>
</technique>
</profile_COMMON>
</effect>
</library_effects>
<library_images>
<image id="ColorCalibrationChart_png" name="ColorCalibrationChart_png">
<init_from>ColorCalibrationChart.png</init_from>
</image>
</library_images>
<library_materials>
<material id="ColorCalibration-material" name="ColorCalibration">
<instance_effect url="#ColorCalibration-effect"/>
</material>
</library_materials>
<library_geometries>
<geometry id="Plane-mesh" name="Plane">
<mesh>
<source id="Plane-mesh-positions">
<float_array id="Plane-mesh-positions-array" count="48">-3 -2 -0.125 3 -2 -0.125 -3 2 -0.125 3 2 -0.125 -3 -2 0.09394234 -2.906827 -1.937885 0.125 -2.972711 -1.981807 0.1159034 3 -2 0.09394234 2.906827 -1.937885 0.125 2.972711 -1.981807 0.1159034 -2.906827 1.937885 0.125 -3 2 0.09394234 -2.972711 1.981807 0.1159034 3 2 0.09394234 2.906827 1.937885 0.125 2.972711 1.981807 0.1159034</float_array>
<technique_common>
<accessor source="#Plane-mesh-positions-array" count="16" stride="3">
<param name="X" type="float"/>
<param name="Y" type="float"/>
<param name="Z" type="float"/>
</accessor>
</technique_common>
</source>
<source id="Plane-mesh-normals">
<float_array id="Plane-mesh-normals-array" count="75">0 -1 0 0 0 -1 0.04734104 -0.08288294 0.9954342 -0.04734104 0.08288294 0.9954342 -0.04734086 -0.08288335 0.9954342 1 0 0 0 1 0 -0.6269479 0 0.7790613 -0.6269475 0 0.7790615 -0.6269475 0 0.7790616 -0.08579593 -0.07703024 0.9933305 -0.08579528 0.07703095 0.9933305 0 -0.7700822 0.6379447 0 -0.7700783 0.6379494 0.08579528 -0.07703095 0.9933305 0.6269479 0 0.7790613 0.6269475 0 0.7790615 0.6269475 0 0.7790616 0.08579593 0.07703024 0.9933305 0 0.7700822 0.6379447 0 0.7700783 0.6379494 0.04734086 0.08288335 0.9954342 -1 0 0 0 -0.7700822 0.6379448 0 0.7700822 0.6379448</float_array>
<technique_common>
<accessor source="#Plane-mesh-normals-array" count="25" stride="3">
<param name="X" type="float"/>
<param name="Y" type="float"/>
<param name="Z" type="float"/>
</accessor>
</technique_common>
</source>
<source id="Plane-mesh-map-0">
<float_array id="Plane-mesh-map-0-array" count="168">0 0 1 0 1 0 0 1 1 0 0 0 0.9844712 0.01552879 0.01552879 0.9844712 0.01552879 0.01552879 1 0 1 1 1 1 1 1 0 1 0 1 0 0 0.002274096 0.9977259 0 1 0.002274096 0.002274096 0.01552879 0.9844712 0.002274096 0.9977259 1 0 0.002274096 0.002274096 0 0 0.9977259 0.002274096 0.01552879 0.01552879 0.002274096 0.002274096 1 1 0.9977259 0.002274096 1 0 0.9977259 0.9977259 0.9844712 0.01552879 0.9977259 0.002274096 0 1 0.9977259 0.9977259 1 1 0.002274096 0.9977259 0.9844712 0.9844712 0.9977259 0.9977259 0 1 0 0 0 0 0 0 0 0 1 0 0 1 1 1 1 0 0.9844712 0.01552879 0.9844712 0.9844712 0.01552879 0.9844712 1 0 1 0 1 1 1 1 1 1 0 1 0 0 0.002274096 0.002274096 0.002274096 0.9977259 0.002274096 0.002274096 0.01552879 0.01552879 0.01552879 0.9844712 1 0 0.9977259 0.002274096 0.002274096 0.002274096 0.9977259 0.002274096 0.9844712 0.01552879 0.01552879 0.01552879 1 1 0.9977259 0.9977259 0.9977259 0.002274096 0.9977259 0.9977259 0.9844712 0.9844712 0.9844712 0.01552879 0 1 0.002274096 0.9977259 0.9977259 0.9977259 0.002274096 0.9977259 0.01552879 0.9844712 0.9844712 0.9844712 0 1 0 1 0 0</float_array>
<technique_common>
<accessor source="#Plane-mesh-map-0-array" count="84" stride="2">
<param name="S" type="float"/>
<param name="T" type="float"/>
</accessor>
</technique_common>
</source>
<vertices id="Plane-mesh-vertices">
<input semantic="POSITION" source="#Plane-mesh-positions"/>
</vertices>
<triangles material="ColorCalibration-material" count="28">
<input semantic="VERTEX" source="#Plane-mesh-vertices" offset="0"/>
<input semantic="NORMAL" source="#Plane-mesh-normals" offset="1"/>
<input semantic="TEXCOORD" source="#Plane-mesh-map-0" offset="2" set="0"/>
<p>4 0 0 1 0 1 7 0 2 2 1 3 1 1 4 0 1 5 8 2 6 10 3 7 5 4 8 7 5 9 3 5 10 13 5 11 13 6 12 2 6 13 11 6 14 4 7 15 12 8 16 11 9 17 6 10 18 10 3 19 12 11 20 7 12 21 6 13 22 4 13 23 9 14 24 5 4 25 6 10 26 13 15 27 9 16 28 7 17 29 15 18 30 8 2 31 9 14 32 11 19 33 15 20 34 13 20 35 12 11 36 14 21 37 15 18 38 11 22 39 0 22 40 4 22 41 4 0 42 0 0 43 1 0 44 2 1 45 3 1 46 1 1 47 8 2 48 14 21 49 10 3 50 7 5 51 1 5 52 3 5 53 13 6 54 3 6 55 2 6 56 4 7 57 6 7 58 12 8 59 6 10 60 5 4 61 10 3 62 7 12 63 9 23 64 6 13 65 9 14 66 8 2 67 5 4 68 13 15 69 15 15 70 9 16 71 15 18 72 14 21 73 8 2 74 11 19 75 12 24 76 15 20 77 12 11 78 10 3 79 14 21 80 11 22 81 2 22 82 0 22 83</p>
</triangles>
</mesh>
</geometry>
</library_geometries>
<library_visual_scenes>
<visual_scene id="Scene" name="Scene">
<node id="colorCard" name="colorCard" type="NODE">
<matrix sid="transform">1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1</matrix>
<instance_geometry url="#Plane-mesh" name="colorCard">
<bind_material>
<technique_common>
<instance_material symbol="ColorCalibration-material" target="#ColorCalibration-material">
<bind_vertex_input semantic="UVMap" input_semantic="TEXCOORD" input_set="0"/>
</instance_material>
</technique_common>
</bind_material>
</instance_geometry>
</node>
</visual_scene>
</library_visual_scenes>
<scene>
<instance_visual_scene url="#Scene"/>
</scene>
</COLLADA>

View file

@ -0,0 +1,12 @@
singleton TSShapeConstructor(colorCalibrationCarddae)
{
baseShapeAsset = ":colorCalibrationCard_shape";
singleDetailSize = "0";
neverImportMat = "DefaultMaterial ColorEffect*";
flipUVCoords = "0";
joinIdenticalVerts = "0";
reverseWindingOrder = "0";
removeRedundantMats = "0";
animFPS = "2";
};

View file

@ -0,0 +1,5 @@
<ShapeAsset
AssetName="colorCalibrationCard_shape"
fileName="@assetFile=colorCalibrationCard.dae"
constuctorFileName="@assetFile=colorCalibrationCard.tscript"
materialSlot0="@asset=Prototyping:ColorCalibration_mat"/>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View file

@ -0,0 +1 @@
<ImageAsset canSave="true" canSaveDynamicFields="true" AssetName="materialGrid_ORM_image" imageFile="@assetFile=materialGrid_ORM.png" UseMips="true" isHDRImage="false" imageType="Albedo" originalFilePath="C:/Users/Arelo/Desktop/materialGrid_ORM.png"/>

View file

@ -1105,7 +1105,7 @@ $guiContent = new GuiControl(AssetBrowser) {
groupNum = "-1";
buttonType = "PushButton";
useMouseEvents = "0";
position = "120 340";
position = getWord($pref::Video::mode, 0) - 420 SPC 340;
extent = "53 19";
minExtent = "8 2";
horizSizing = "left";

View file

@ -31,7 +31,7 @@ $guiContent = new GuiContainer(EditorGui,EditorGuiGroup) {
new GuiTabPageCtrl(MainSceneEditorTab) {
text = "Main Scene";
position = 0 SPC $MainEditor::TabHeight;
position = 0 SPC 20;
extent = 800 SPC 580;
horizSizing = "width";
vertSizing = "height";

View file

@ -131,7 +131,7 @@ $guiContent = new GuiControl() {
HorizSizing = "width";
VertSizing = "height";
Position = "5 29";
Extent = "300 271";
Extent = "290 240";
MinExtent = "8 8";
canSave = "1";
Visible = "1";