Merge branch 'development' into imageAsset_refactor_rev3

This commit is contained in:
marauder2k7 2025-03-24 20:07:06 +00:00 committed by GitHub
commit 0da0903599
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4189 changed files with 29881 additions and 635347 deletions

View file

@ -119,11 +119,11 @@ function Core_ClientServer::onDestroy( %this )
sfxShutdown();
echo("Exporting client prefs");
%prefPath = getPrefpath();
echo("Exporting client prefs to "@ getUserHomeDirectory() @ "/clientPrefs." @ $TorqueScriptFileExtension);
export("$pref::*", %prefPath @ "/clientPrefs." @ $TorqueScriptFileExtension, false);
echo("Exporting server prefs");
echo("Exporting server prefs to "@ getUserHomeDirectory() @ "/serverPrefs." @ $TorqueScriptFileExtension);
export("$Pref::Server::*", %prefPath @ "/serverPrefs." @ $TorqueScriptFileExtension, false);
BanList::Export(%prefPath @ "/banlist." @ $TorqueScriptFileExtension);
}

View file

@ -251,7 +251,7 @@ function destroyServer()
// Save any server settings
%prefPath = getPrefpath();
echo( "Exporting server prefs..." );
echo( "Exporting server prefs to "@ getUserHomeDirectory() @ "/serverPrefs." @ $TorqueScriptFileExtension );
export( "$Pref::Server::*", %prefPath@"/serverPrefs." @ $TorqueScriptFileExtension, false );
BanList::Export(%prefPath@"/banlist." @ $TorqueScriptFileExtension);

View file

@ -20,10 +20,10 @@ function CoreModule::onCreate(%this)
ProjectSettings.read();
ModuleDatabase.LoadExplicit( "Core_Rendering" );
ModuleDatabase.LoadExplicit( "Core_SFX" );
ModuleDatabase.LoadExplicit( "Core_Utility" );
ModuleDatabase.LoadExplicit( "Core_GUI" );
ModuleDatabase.LoadExplicit( "Core_Lighting" );
ModuleDatabase.LoadExplicit( "Core_SFX" );
ModuleDatabase.LoadExplicit( "Core_PostFX" );
ModuleDatabase.LoadExplicit( "Core_GameObjects" );

View file

@ -140,11 +140,11 @@ singleton ShaderData( VolumetricFogReflectionShader )
};
singleton ShaderData( CubemapSaveShader )
{
DXVertexShaderFile = "shaders/common/cubemapSaveV.hlsl";
DXPixelShaderFile = "shaders/common/cubemapSaveP.hlsl";
DXVertexShaderFile = $Core::CommonShaderPath @ "/common/cubemapSaveV.hlsl";
DXPixelShaderFile = $Core::CommonShaderPath @ "/common/cubemapSaveP.hlsl";
OGLVertexShaderFile = "shaders/common/gl/cubemapSaveV.glsl";
OGLPixelShaderFile = "shaders/common/gl/cubemapSaveP.glsl";
OGLVertexShaderFile = $Core::CommonShaderPath @ "/common/gl/cubemapSaveV.glsl";
OGLPixelShaderFile = $Core::CommonShaderPath @ "/common/gl/cubemapSaveP.glsl";
samplerNames[0] = "$cubemapTex";
@ -187,4 +187,58 @@ singleton ShaderData( ThickLineGUI )
OGLPixelShaderFile = $Core::CommonShaderPath @ "/fixedFunction/gl/thickLineP.glsl";
pixVersion = 3.0;
};
};
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
// Arcane-FX - Shared AFX Shaders
//
// All of the non-zodiac shaders support alpha-fading.
//
// Copyright (C) Faust Logic, Inc.
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
// Zodiac Shaders
new ShaderData(afxZodiacTerrainShader)
{
DXVertexShaderFile = $Core::CommonShaderPath @ "/AFX/afxZodiac_Terrain_V.hlsl";
DXPixelShaderFile = $Core::CommonShaderPath @ "/AFX/afxZodiac_Terrain_P.hlsl";
OGLVertexShaderFile = $Core::CommonShaderPath @ "/AFX/gl/afxZodiac_Terrain_V.glsl";
OGLPixelShaderFile = $Core::CommonShaderPath @ "/AFX/gl/afxZodiac_Terrain_P.glsl";
samplerNames[0] = "$zodiacMap";
pixVersion = 1.1;
};
new ShaderData(afxZodiacInteriorShader)
{
DXVertexShaderFile = $Core::CommonShaderPath @ "/AFX/afxZodiac_Interior_V.hlsl";
DXPixelShaderFile = $Core::CommonShaderPath @ "/AFX/afxZodiac_Interior_P.hlsl";
OGLVertexShaderFile = $Core::CommonShaderPath @ "/AFX/gl/afxZodiac_Interior_V.glsl";
OGLPixelShaderFile = $Core::CommonShaderPath @ "/AFX/gl/afxZodiac_Interior_P.glsl";
samplerNames[0] = "$zodiacMap";
pixVersion = 1.1;
};
new ShaderData(afxZodiacPolysoupShader)
{
DXVertexShaderFile = $Core::CommonShaderPath @ "/AFX/afxZodiac_Polysoup_V.hlsl";
DXPixelShaderFile = $Core::CommonShaderPath @ "/AFX/afxZodiac_Polysoup_P.hlsl";
OGLVertexShaderFile = $Core::CommonShaderPath @ "/AFX/gl/afxZodiac_Polysoup_V.glsl";
OGLPixelShaderFile = $Core::CommonShaderPath @ "/AFX/gl/afxZodiac_Polysoup_P.glsl";
samplerNames[0] = "$zodiacMap";
pixVersion = 1.1;
};
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//

View file

@ -87,14 +87,11 @@ function initRenderManager()
// Resolve format change token last.
DiffuseRenderPassManager.addManager( new RenderPassStateBin(FinalBin) { renderOrder = 1.7; stateToken = AL_FormatToken; } );
if(isObject(afxZodiacTerrainRenderer))
{
DiffuseRenderPassManager.addManager( new afxZodiacTerrainRenderer() { bintype = "TerrainZodiac"; renderOrder = 1.41; processAddOrder = 1.41; } );
DiffuseRenderPassManager.addManager( new afxZodiacPolysoupRenderer() { bintype = "PolysoupZodiac"; renderOrder = 1.42; processAddOrder = 1.42; } );
DiffuseRenderPassManager.addManager( new afxZodiacGroundPlaneRenderer() { bintype = "GroundPlaneZodiac"; renderOrder = 1.43; processAddOrder = 1.43; } );
DiffuseRenderPassManager.addManager( new afxZodiacMeshRoadRenderer() { bintype = "MeshRoadZodiac"; renderOrder = 1.44; processAddOrder = 1.44; } );
DiffuseRenderPassManager.addManager( new afxRenderHighlightMgr() { renderOrder = 1.55; processAddOrder = 1.55; } ); // for selection-highlighting
}
DiffuseRenderPassManager.addManager( new afxZodiacTerrainRenderer() { bintype = "TerrainZodiac"; renderOrder = 1.41; processAddOrder = 1.41; } );
DiffuseRenderPassManager.addManager( new afxZodiacPolysoupRenderer() { bintype = "PolysoupZodiac"; renderOrder = 1.42; processAddOrder = 1.42; } );
DiffuseRenderPassManager.addManager( new afxZodiacGroundPlaneRenderer() { bintype = "GroundPlaneZodiac"; renderOrder = 1.43; processAddOrder = 1.43; } );
DiffuseRenderPassManager.addManager( new afxZodiacMeshRoadRenderer() { bintype = "MeshRoadZodiac"; renderOrder = 1.44; processAddOrder = 1.44;} );
DiffuseRenderPassManager.addManager( new afxRenderHighlightMgr() { renderOrder = 1.55; processAddOrder = 1.55;} ); // for selection-highlighting
}
/// This is the Default PostFX state block. Put here to prevent any missing object

View file

@ -5,9 +5,9 @@
// (currently not used for default AFX selection-highlighting)
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
#include "../common/shaderModel.hlsl"
#include "../common/shaderModelAutoGen.hlsl"
#include "shaders/common/postFX/postFx.hlsl"
#include "../shaderModel.hlsl"
#include "../shaderModelAutoGen.hlsl"
#include "../postFX/postFx.hlsl"
TORQUE_UNIFORM_SAMPLER2D(highlightBuffer,0);
TORQUE_UNIFORM_SAMPLER2D(backBuffer,1);

View file

@ -4,9 +4,9 @@
// http://www.garagegames.com/community/resources/view/17821
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
#include "../common/shaderModel.hlsl"
#include "../common/shaderModelAutoGen.hlsl"
#include "shaders/common/postFX/postFx.hlsl"
#include "../shaderModel.hlsl"
#include "../shaderModelAutoGen.hlsl"
#include "../postFX/postFx.hlsl"
TORQUE_UNIFORM_SAMPLER2D(highlightBuffer,0);
TORQUE_UNIFORM_SAMPLER2D(backBuffer,1);

View file

@ -8,7 +8,7 @@
// Copyright (C) Faust Logic, Inc.
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
#include "../common/shaderModel.hlsl"
#include "../shaderModel.hlsl"
struct ConnectData
{

View file

@ -8,7 +8,7 @@
// Copyright (C) Faust Logic, Inc.
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
#include "../common/shaderModel.hlsl"
#include "../shaderModel.hlsl"
struct VertData
{
float3 position : POSITION;

View file

@ -8,7 +8,7 @@
// Copyright (C) Faust Logic, Inc.
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
#include "../common/shaderModel.hlsl"
#include "../shaderModel.hlsl"
struct ConnectData
{

View file

@ -8,7 +8,7 @@
// Copyright (C) Faust Logic, Inc.
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
#include "../common/shaderModel.hlsl"
#include "../shaderModel.hlsl"
struct VertData
{
float3 position : POSITION;

View file

@ -8,7 +8,7 @@
// Copyright (C) Faust Logic, Inc.
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
#include "../common/shaderModel.hlsl"
#include "../shaderModel.hlsl"
struct ConnectData
{

View file

@ -8,7 +8,7 @@
// Copyright (C) Faust Logic, Inc.
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
#include "../common/shaderModel.hlsl"
#include "../shaderModel.hlsl"
struct VertData
{
float3 position : POSITION;

View file

@ -8,7 +8,7 @@
// Copyright (C) Faust Logic, Inc.
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
#include "../../common/gl/hlslCompat.glsl"
#include "../../gl/hlslCompat.glsl"
uniform mat4 modelview;

View file

@ -8,7 +8,7 @@
// Copyright (C) Faust Logic, Inc.
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
#include "../../common/gl/hlslCompat.glsl"
#include "../../gl/hlslCompat.glsl"
uniform mat4 modelview;

View file

@ -36,41 +36,76 @@
// Charles de Rousiers - Electronic Arts Frostbite
// SIGGRAPH 2014
float3 F_Schlick(float3 f0, float f90, float u)
float3 F_Schlick(float3 F0, float cosTheta)
{
return f0 + (f90 - f0) * pow(1.f - u, 5.f);
return F0 + (1.0 - F0) * pow(1.0 - cosTheta, 5.0);
}
float3 FresnelSchlickRoughness(float cosTheta, float3 F0, float roughness)
{
float3 ret = float3(0.0, 0.0, 0.0);
float powTheta = pow(1.0 - cosTheta, 5.0);
float invRough = float(1.0 - roughness);
// Compute the Fresnel-Schlick term for the given cosine of the angle
float powTheta = pow(1.0 - cosTheta, 5.0);
// Adjust the reflectance based on roughness: The roughness scales the contrast of the Fresnel term.
float3 fresnel = F0 + (float3(1.0, 1.0, 1.0) - F0) * powTheta;
// Modulate the fresnel term by roughness, reducing the effect at higher roughness
fresnel *= (1.0 - roughness); // Adjust based on roughness
ret.x = F0.x + (max(invRough, F0.x) - F0.x) * powTheta;
ret.y = F0.y + (max(invRough, F0.y) - F0.y) * powTheta;
ret.z = F0.z + (max(invRough, F0.z) - F0.z) * powTheta;
return ret;
return fresnel;
}
float V_SmithGGXCorrelated(float NdotL, float NdotV, float alphaRoughnessSq)
{
float GGXV = NdotL * sqrt(NdotV * NdotV * (1.0 - alphaRoughnessSq) + alphaRoughnessSq);
float GGXL = NdotV * sqrt(NdotL * NdotL * (1.0 - alphaRoughnessSq) + alphaRoughnessSq);
float GGX = GGXV + GGXL;
if (GGX > 0.0f)
{
return 0.5f / GGX;
}
return 0.f;
float GeometrySchlickGGX(float NdotV, float roughness) {
float r = (roughness + 1.0);
float k = (r * r) / 8.0;
return NdotV / (NdotV * (1.0 - k) + k);
}
float D_GGX(float NdotH, float alphaRoughnessSq)
float V_SmithGGXCorrelated(float NdotL, float NdotV, float roughness) {
float r = roughness * roughness;
float ggx1 = NdotV / (NdotV * (1.0 - r) + r);
float ggx2 = NdotL / (NdotL * (1.0 - r) + r);
return ggx1 * ggx2;
}
float D_GGX(float NdotH, float roughnessSq)
{
float f = (NdotH * alphaRoughnessSq - NdotH) * NdotH + 1;
return alphaRoughnessSq / (M_PI_F * f * f);
float f = (NdotH * NdotH * (roughnessSq - 1.0) + 1.0);
return roughnessSq / (M_PI_F * f * f);
}
// The Cook-Torrance BRDF for specular reflection
float3 CookTorrance(float3 normal, float3 viewDir, float roughness, float3 F)
{
float3 H = normalize(viewDir + reflect(-viewDir, normal));
float NdotH = max(dot(normal, H), 0.0001);
float VdotH = max(dot(viewDir, H), 0.0001);
float NdotV = clamp( dot(normal, viewDir), 0.0009765625f,0.9990234375f);
float NdotL = NdotH; // Approximate light angle
// Normal Distribution Function (GGX)
float D = D_GGX(NdotH, roughness);
// Geometry Term (Smith GGX)
float G = V_SmithGGXCorrelated(NdotL, NdotV, roughness);
// Final BRDF (Rebalanced Energy)
return (F * D * G) / max(4.0 * NdotV * NdotL, 0.0001);
}
float3 OrenNayarDiffuse(float3 albedo, float3 N, float3 V, float3 L, float roughnessSq) {
float NdotL = max(dot(N, L), 0.0);
float NdotV = max(dot(N, V), 0.0);
float alpha2 = roughnessSq * roughnessSq;
float A = 1.0 + (alpha2 / (alpha2 + 0.33));
float B = 0.45 * (alpha2 / (alpha2 + 0.09));
float alpha = max(NdotL, NdotV);
float beta = min(NdotL, NdotV);
return albedo * (A + B * max(0.0, dot(V - N * NdotV, L - N * NdotL)) * alpha * beta) * M_1OVER_PI_F;
}
float3 Fr_DisneyDiffuse(float3 F0, float NdotV, float NdotL, float LdotH, float linearRoughness)
@ -78,8 +113,8 @@ float3 Fr_DisneyDiffuse(float3 F0, float NdotV, float NdotL, float LdotH, float
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 );
float3 lightScatter = F_Schlick( F0 , fd90 );
float3 viewScatter = F_Schlick(F0 , fd90);
return lightScatter * viewScatter * energyFactor ;
}

View file

@ -124,7 +124,7 @@ void foliageProcessVert( inout float3 position,
in float3 eyePos )
{
// Assign the normal and tagent values.
//normal = float3( 0, 0, 1 );//cross( gc_camUp, gc_camRight );
normal = float3( 0, 0, 1 );
T = gc_camRight;
// Pull out local vars we need for work.
@ -166,15 +166,6 @@ void foliageProcessVert( inout float3 position,
texCoord.x = uvSet.x + ( uvSet.z * sUVCornerExtent[corner].x );
texCoord.y = uvSet.y + ( uvSet.w * sUVCornerExtent[corner].y );
// Animate the normal to get lighting changes
// across the the wind swept foliage.
//
// TODO: Expose the 10x as a factor to control
// how much the wind effects the lighting on the grass.
//
normal.xy += wind.xy * ( 10.0 * texCoord.w );
normal = normalize( normal );
// Get the alpha fade value.
float fadeStart = gc_fadeParams.x;

View file

@ -30,52 +30,86 @@
// Charles de Rousiers - Electronic Arts Frostbite
// SIGGRAPH 2014
vec3 F_Schlick(vec3 f0, float f90, float u)
vec3 F_Schlick(vec3 F0, float cosTheta)
{
return f0 + (f90 - f0) * pow(1.f - u, 5.f);
return F0 + (1.0 - F0) * pow(1.0 - cosTheta, 5.0);
}
vec3 FresnelSchlickRoughness(float cosTheta, vec3 F0, float roughness)
{
vec3 ret = vec3(0.0, 0.0, 0.0);
float powTheta = pow(1.0 - cosTheta, 5.0);
float invRough = float(1.0 - roughness);
// Compute the Fresnel-Schlick term for the given cosine of the angle
float powTheta = pow(1.0 - cosTheta, 5.0);
// Adjust the reflectance based on roughness: The roughness scales the contrast of the Fresnel term.
vec3 fresnel = F0 + (vec3(1.0, 1.0, 1.0) - F0) * powTheta;
// Modulate the fresnel term by roughness, reducing the effect at higher roughness
fresnel *= (1.0 - roughness); // Adjust based on roughness
ret.x = F0.x + (max(invRough, F0.x) - F0.x) * powTheta;
ret.y = F0.y + (max(invRough, F0.y) - F0.y) * powTheta;
ret.z = F0.z + (max(invRough, F0.z) - F0.z) * powTheta;
return ret;
return fresnel;
}
float V_SmithGGXCorrelated(float NdotL, float NdotV, float alphaRoughnessSq)
{
float GGXV = NdotL * sqrt(NdotV * NdotV * (1.0 - alphaRoughnessSq) + alphaRoughnessSq);
float GGXL = NdotV * sqrt(NdotL * NdotL * (1.0 - alphaRoughnessSq) + alphaRoughnessSq);
float GGX = GGXV + GGXL;
if (GGX > 0.0f)
{
return 0.5f / GGX;
}
return 0.f;
float GeometrySchlickGGX(float NdotV, float roughness) {
float r = (roughness + 1.0);
float k = (r * r) / 8.0;
return NdotV / (NdotV * (1.0 - k) + k);
}
float D_GGX(float NdotH, float alphaRoughnessSq)
float V_SmithGGXCorrelated(float NdotL, float NdotV, float roughness) {
float r = roughness * roughness;
float ggx1 = NdotV / (NdotV * (1.0 - r) + r);
float ggx2 = NdotL / (NdotL * (1.0 - r) + r);
return ggx1 * ggx2;
}
float D_GGX(float NdotH, float roughnessSq)
{
float f = (NdotH * alphaRoughnessSq - NdotH) * NdotH + 1;
return alphaRoughnessSq / (M_PI_F * f * f);
float f = (NdotH * NdotH * (roughnessSq - 1.0) + 1.0);
return roughnessSq / (M_PI_F * f * f);
}
// The Cook-Torrance BRDF for specular reflection
vec3 CookTorrance(vec3 normal, vec3 viewDir, float roughness, vec3 F)
{
vec3 H = normalize(viewDir + reflect(-viewDir, normal));
float NdotH = max(dot(normal, H), 0.0001);
float VdotH = max(dot(viewDir, H), 0.0001);
float NdotV = clamp( dot(normal, viewDir), 0.0009765625f,0.9990234375f);
float NdotL = NdotH; // Approximate light angle
// Normal Distribution Function (GGX)
float D = D_GGX(NdotH, roughness);
// Geometry Term (Smith GGX)
float G = V_SmithGGXCorrelated(NdotL, NdotV, roughness);
// Final BRDF (Rebalanced Energy)
return (F * D * G) / max(4.0 * NdotV * NdotL, 0.0001);
}
vec3 OrenNayarDiffuse(vec3 albedo, vec3 N, vec3 V, vec3 L, float roughnessSq) {
float NdotL = max(dot(N, L), 0.0);
float NdotV = max(dot(N, V), 0.0);
float alpha2 = roughnessSq * roughnessSq;
float A = 1.0 + (alpha2 / (alpha2 + 0.33));
float B = 0.45 * (alpha2 / (alpha2 + 0.09));
float alpha = max(NdotL, NdotV);
float beta = min(NdotL, NdotV);
return albedo * (A + B * max(0.0, dot(V - N * NdotV, L - N * NdotL)) * alpha * beta) * M_1OVER_PI_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 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 );
vec3 lightScatter = F_Schlick( F0 , fd90 );
vec3 viewScatter = F_Schlick(F0 , fd90);
return lightScatter * viewScatter * energyFactor ;
}
#endif

View file

@ -124,7 +124,7 @@ void foliageProcessVert( inout vec3 position,
in vec3 eyePos )
{
// Assign the normal and tagent values.
//normal = vec3( 0, 0, 1 );//cross( gc_camUp, gc_camRight );
normal = vec3( 0, 0, 1 );
T = gc_camRight;
// Pull out local vars we need for work.
@ -166,15 +166,6 @@ void foliageProcessVert( inout vec3 position,
texCoord.x = uvSet.x + ( uvSet.z * sUVCornerExtent[corner].x );
texCoord.y = uvSet.y + ( uvSet.w * sUVCornerExtent[corner].y );
// Animate the normal to get lighting changes
// across the the wind swept foliage.
//
// TODO: Expose the 10x as a factor to control
// how much the wind effects the lighting on the grass.
//
normal.xy += wind.xy * ( 10.0 * texCoord.w );
normal = normalize( normal );
// Get the alpha fade value.
float fadeStart = gc_fadeParams.x;

View file

@ -114,12 +114,12 @@ void updateSurface(inout Surface surface)
surface.linearRoughness = surface.roughness * surface.roughness;
surface.linearRoughnessSq = surface.linearRoughness * surface.linearRoughness;
surface.albedo = surface.baseColor.rgb * (1.0f - surface.metalness);
surface.albedo = max(toLinear(surface.baseColor.rgb),0.04f);
surface.f0 = mix(vec3(0.04f,0.04f,0.04f), surface.baseColor.rgb, surface.metalness);
surface.R = -reflect(surface.V, surface.N);
surface.f90 = saturate(50.0 * dot(surface.f0, vec3(0.33,0.33,0.33)));
surface.F = F_Schlick(surface.f0, surface.f90, surface.NdotV);
surface.F = F_Schlick(surface.f0, surface.NdotV);
}
Surface createSurface(vec4 gbuffer0, sampler2D gbufferTex1, sampler2D gbufferTex2, in vec2 uv, in vec3 wsEyePos, in vec3 wsEyeRay, in mat4 invView)
@ -186,7 +186,7 @@ SurfaceToLight createSurfaceToLight(in Surface surface, in vec3 L)
vec3 BRDF_GetDebugSpecular(in Surface surface, in SurfaceToLight surfaceToLight)
{
//GGX specular
vec3 F = F_Schlick(surface.f0, surface.f90, surfaceToLight.HdotV);
vec3 F = F_Schlick(surface.f0, surface.NdotV);
float Vis = V_SmithGGXCorrelated(surface.NdotV, surfaceToLight.NdotL, surface.linearRoughnessSq);
float D = D_GGX(surfaceToLight.NdotH, surface.linearRoughnessSq);
vec3 Fr = D * F * Vis * M_1OVER_PI_F;
@ -225,19 +225,32 @@ float getDistanceAtt( vec3 unormalizedLightVector , float invSqrAttRadius )
vec3 evaluateStandardBRDF(Surface surface, SurfaceToLight surfaceToLight)
{
//diffuse term
vec3 Fd = surface.albedo.rgb * M_1OVER_PI_F;
// Compute Fresnel term
vec3 F = F_Schlick(surface.f0, surfaceToLight.HdotV);
F += lerp(vec3(0.04f,0.04f,0.04f), surface.baseColor.rgb, surface.metalness);
//GGX specular
vec3 F = F_Schlick(surface.f0, surface.f90, surfaceToLight.HdotV);
float Vis = V_SmithGGXCorrelated(surface.NdotV, surfaceToLight.NdotL, surface.linearRoughnessSq);
float D = D_GGX(surfaceToLight.NdotH, surface.linearRoughnessSq);
vec3 Fr = D * F * Vis;
// GGX Normal Distribution Function
float D = D_GGX(surfaceToLight.NdotH, surface.linearRoughness);
// Smith GGX Geometry Function
float G = V_SmithGGXCorrelated(surface.NdotV, surfaceToLight.NdotL, surface.linearRoughness);
// Specular BRDF
vec3 numerator = D * G * F;
float denominator = 4.0 * max(surface.NdotV, 0.0) * max(surfaceToLight.NdotL, 0.0) + 0.0001;
vec3 specularBRDF = numerator / denominator;
vec3 diffuseBRDF = surface.baseColor.rgb * M_1OVER_PI_F * surface.ao;
// Final output combining all terms
vec3 kS = F; // Specular reflectance
vec3 kD = (1.0 - kS) * (1.0 - surface.metalness); // Diffuse reflectance
vec3 returnBRDF = kD * (diffuseBRDF) + specularBRDF;
if(isCapturing == 1)
return mix(Fd + Fr, surface.baseColor.rgb, surface.metalness);
return lerp(returnBRDF ,surface.albedo.rgb,surface.metalness);
else
return Fd + Fr;
return returnBRDF;
}
vec3 getDirectionalLight(Surface surface, SurfaceToLight surfaceToLight, vec3 lightColor, float lightIntensity, float shadow)
@ -246,8 +259,13 @@ vec3 getDirectionalLight(Surface surface, SurfaceToLight surfaceToLight, vec3 li
if(isCapturing != 1)
lightfloor = 0.0;
vec3 factor = lightColor * max(surfaceToLight.NdotL * shadow * lightIntensity, lightfloor);
return evaluateStandardBRDF(surface,surfaceToLight) * factor;
// Calculate both specular and diffuse lighting in one BRDF evaluation
vec3 directLighting = evaluateStandardBRDF(surface, surfaceToLight);
// Direct Diffuse Light Contribution (using Lambertian diffuse in BRDF)
vec3 diffuseLight = directLighting * (lightColor * max(surfaceToLight.NdotL * shadow * lightIntensity, lightfloor));
return diffuseLight;
}
vec3 getPunctualLight(Surface surface, SurfaceToLight surfaceToLight, vec3 lightColor, float lightIntensity, float radius, float shadow)
@ -257,8 +275,14 @@ vec3 getPunctualLight(Surface surface, SurfaceToLight surfaceToLight, vec3 light
lightfloor = 0.0;
float attenuation = getDistanceAtt(surfaceToLight.Lu, radius);
vec3 factor = lightColor * max(surfaceToLight.NdotL * shadow * lightIntensity * attenuation, lightfloor);
return evaluateStandardBRDF(surface,surfaceToLight) * factor;
// Calculate both specular and diffuse lighting in one BRDF evaluation
vec3 directLighting = evaluateStandardBRDF(surface, surfaceToLight);
// Direct Diffuse Light Contribution (using Lambertian diffuse in BRDF)
vec3 diffuseLight = directLighting * lightColor * max(surfaceToLight.NdotL* shadow * lightIntensity * attenuation, lightfloor);
return diffuseLight;
}
vec3 getSpotlight(Surface surface, SurfaceToLight surfaceToLight, vec3 lightColor, float lightIntensity, float radius, vec3 lightDir, vec2 lightSpotParams, float shadow)
@ -270,18 +294,32 @@ vec3 getSpotlight(Surface surface, SurfaceToLight surfaceToLight, vec3 lightColo
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, lightfloor);
return evaluateStandardBRDF(surface,surfaceToLight) * factor;
// Calculate both specular and diffuse lighting in one BRDF evaluation
vec3 directLighting = evaluateStandardBRDF(surface, surfaceToLight);
// Direct Diffuse Light Contribution (using Lambertian diffuse in BRDF)
vec3 diffuseLight = directLighting * lightColor * max(surfaceToLight.NdotL* shadow * lightIntensity * attenuation, lightfloor);
return diffuseLight;
}
float computeSpecOcclusion( float NdotV , float AO , float roughness )
{
return saturate (pow( abs(NdotV + AO) , exp2 ( -16.0f * roughness - 1.0f )) - 1.0f + AO );
// Compute the geometry term using Smith's GGX for occlusion
float r = roughness * roughness; // Roughness squared
float ggx = (NdotV) / (NdotV * (1.0 - r) + r); // Smith GGX Geometry Function for occlusion
// Optionally modify by AO (ambient occlusion) and roughness
float specOcclusion = pow(ggx + AO, 2.0);
// Return the final occlusion factor (clamped between 0 and 1)
return saturate(specOcclusion);
}
float roughnessToMipLevel(float roughness, float numMips)
{
return pow(abs(roughness),0.25) * numMips;
return saturate((roughness * numMips) - (pow(roughness, 6.0) * (numMips * 0.125)));
}
vec4 compute4Lights( Surface surface,
@ -393,21 +431,18 @@ void dampen(inout Surface surface, sampler2D WetnessTexture, float accumTime, fl
{
if (degree<=0.0) return;
vec3 n = abs(surface.N);
float ang = dot(float3(0,0,-1),surface.N);
float grav = 2.0-pow(ang,3);
if (grav<0) grav*=-1.0;
float ang = clamp(n.z, 0.04, 0.96);
float speed = accumTime*(1.0-surface.roughness)*grav;
vec2 wetoffset = vec2(speed,speed/2)*0.1;
float speed = accumTime*(1.0-surface.roughness)*ang;
vec2 wetoffset = vec2(speed,speed/2);
float wetness = texture(WetnessTexture, vec2(surface.P.xy*0.2+wetoffset)).b;
wetness = lerp(wetness,texture(WetnessTexture,vec2(surface.P.zx*0.2+wetoffset)).b,n.y);
wetness = lerp(wetness,texture(WetnessTexture,vec2(surface.P.zy*0.2+wetoffset)).b,n.x);
wetness = pow(wetness,3)*degree;
float wetness = texture(WetnessTexture, vec2(surface.P.xy*0.1+wetoffset)).b;
wetness = lerp(wetness,texture(WetnessTexture,vec2(surface.P.zx*0.1+wetoffset)).b,n.y);
wetness = lerp(wetness,texture(WetnessTexture,vec2(surface.P.zy*0.1+wetoffset)).b,n.x);
wetness = pow(wetness*ang*degree,3);
surface.roughness = lerp(surface.roughness,(1.0-wetness*surface.roughness)*0.92f+0.04f,ang);
surface.baseColor.rgb = lerp(surface.baseColor.rgb*(2.0-wetness),surface.baseColor.rgb,ang*surface.roughness);
surface.roughness = lerp(surface.roughness, 0.04f, wetness);
surface.baseColor.rgb = lerp(surface.baseColor.rgb, surface.baseColor.rgb*0.96+vec3(0.04,0.04,0.04), pow(wetness,5));
updateSurface(surface);
}
@ -544,33 +579,24 @@ vec4 computeForwardProbes(Surface surface,
if(skylightCubemapIdx != -1 && alpha >= 0.001)
{
irradiance = mix(irradiance,textureLod(irradianceCubemapAR, vec4(surface.R, skylightCubemapIdx), 0).xyz, alpha);
irradiance = mix(irradiance,textureLod(irradianceCubemapAR, vec4(surface.N, skylightCubemapIdx), 0).xyz, alpha);
specular = mix(specular,textureLod(specularCubemapAR, vec4(surface.R, skylightCubemapIdx), lod).xyz, alpha);
}
//energy conservation
vec3 F = FresnelSchlickRoughness(surface.NdotV, surface.f0, surface.roughness);
vec3 kD = 1.0f - F;
kD *= 1.0f - surface.metalness;
//float dfgNdotV = max( surface.NdotV , 0.0009765625f ); //0.5f/512.0f (512 is size of dfg/brdf lookup tex)
vec2 envBRDF = textureLod(BRDFTexture, vec2(surface.NdotV, surface.roughness),0).rg;
specular *= F * envBRDF.x + surface.f90 * envBRDF.y;
irradiance *= kD * surface.baseColor.rgb;
//AO
irradiance *= surface.ao;
specular *= computeSpecOcclusion(surface.NdotV, surface.ao, surface.roughness);
//http://marmosetco.tumblr.com/post/81245981087
float horizonOcclusion = 1.3;
float horizon = saturate( 1 + horizonOcclusion * dot(surface.R, surface.N));
horizon *= horizon;
vec3 diffuse = irradiance * lerp(surface.baseColor.rgb, vec3(0.04f,0.04f,0.04f), surface.metalness);
vec3 specularCol = ((specular + surface.baseColor.rgb) * envBRDF.x + envBRDF.y)*surface.metalness;
// Final color output after environment lighting
vec3 finalColor = diffuse + specularCol;
finalColor *= surface.ao;
if(isCapturing == 1)
return vec4(mix((irradiance + specular* horizon),surface.baseColor.rgb,surface.metalness),0);
return vec4(lerp((finalColor), surface.baseColor.rgb,surface.metalness),0);
else
return vec4((irradiance + specular* horizon) , 0);//alpha writes disabled
{
return vec4(finalColor, 0);
}
}
vec4 debugVizForwardProbes(Surface surface,
@ -696,7 +722,7 @@ vec4 debugVizForwardProbes(Surface surface,
if(skylightCubemapIdx != -1 && alpha >= 0.001)
{
irradiance = mix(irradiance,textureLod(irradianceCubemapAR, vec4(surface.R, skylightCubemapIdx), 0).xyz,alpha);
irradiance = mix(irradiance,textureLod(irradianceCubemapAR, vec4(surface.N, skylightCubemapIdx), 0).xyz,alpha);
specular = mix(specular,textureLod(specularCubemapAR, vec4(surface.R, skylightCubemapIdx), lod).xyz,alpha);
}
@ -710,23 +736,18 @@ vec4 debugVizForwardProbes(Surface surface,
return vec4(irradiance, 0);
}
//energy conservation
vec3 F = FresnelSchlickRoughness(surface.NdotV, surface.f0, surface.roughness);
vec3 kD = 1.0f - F;
kD *= 1.0f - surface.metalness;
vec2 envBRDF = textureLod(BRDFTexture, vec2(surface.NdotV, surface.roughness),0).rg;
specular *= F * envBRDF.x + surface.f90 * envBRDF.y;
irradiance *= kD * surface.baseColor.rgb;
//AO
irradiance *= surface.ao;
specular *= computeSpecOcclusion(surface.NdotV, surface.ao, surface.roughness);
//http://marmosetco.tumblr.com/post/81245981087
float horizonOcclusion = 1.3;
float horizon = saturate( 1 + horizonOcclusion * dot(surface.R, surface.N));
horizon *= horizon;
return vec4((irradiance + specular* horizon) , 0);//alpha writes disabled
vec3 diffuse = irradiance * lerp(surface.baseColor.rgb, vec3(0.04f,0.04f,0.04f), surface.metalness);
vec3 specularCol = ((specular + surface.baseColor.rgb) * envBRDF.x + envBRDF.y)*surface.metalness;
// Final color output after environment lighting
vec3 finalColor = diffuse + specularCol;
finalColor *= surface.ao;
if(isCapturing == 1)
return vec4(lerp((finalColor), surface.baseColor.rgb,surface.metalness),0);
else
{
return vec4(finalColor, 0);
}
}

View file

@ -113,12 +113,12 @@ struct Surface
linearRoughness = roughness * roughness;
linearRoughnessSq = linearRoughness * linearRoughness;
albedo = baseColor.rgb * (1.0f - metalness);
f0 = lerp(0.04f, baseColor.rgb, metalness);
albedo = max(toLinear(baseColor.rgb),0.04f);
f0 = lerp(0.04f, albedo.rgb, metalness);
R = -reflect(V, N);
f90 = saturate(50.0f * dot(f0, 0.33f));
F = F_Schlick(f0, f90, NdotV);
F = F_Schlick(f0, NdotV);
}
};
@ -187,7 +187,7 @@ inline SurfaceToLight createSurfaceToLight(in Surface surface, in float3 L)
float3 BRDF_GetDebugSpecular(in Surface surface, in SurfaceToLight surfaceToLight)
{
//GGX specular
float3 F = F_Schlick(surface.f0, surface.f90, surfaceToLight.HdotV);
float3 F = F_Schlick(surface.f0, surface.NdotV);
float Vis = V_SmithGGXCorrelated(surface.NdotV, surfaceToLight.NdotL, surface.linearRoughnessSq);
float D = D_GGX(surfaceToLight.NdotH, surface.linearRoughnessSq);
float3 Fr = D * F * Vis * M_1OVER_PI_F;
@ -226,19 +226,32 @@ float getDistanceAtt( float3 unormalizedLightVector , float invSqrAttRadius )
float3 evaluateStandardBRDF(Surface surface, SurfaceToLight surfaceToLight)
{
//diffuse term
float3 Fd = surface.albedo.rgb * M_1OVER_PI_F;
// Compute Fresnel term
float3 F = F_Schlick(surface.f0, surfaceToLight.HdotV);
F += lerp(0.04f, surface.baseColor.rgb, surface.metalness);
//GGX specular
float3 F = F_Schlick(surface.f0, surface.f90, surfaceToLight.HdotV);
float Vis = V_SmithGGXCorrelated(surface.NdotV, surfaceToLight.NdotL, surface.linearRoughnessSq);
float D = D_GGX(surfaceToLight.NdotH, surface.linearRoughnessSq);
float3 Fr = D * F * Vis;
// GGX Normal Distribution Function
float D = D_GGX(surfaceToLight.NdotH, surface.linearRoughness);
// Smith GGX Geometry Function
float G = V_SmithGGXCorrelated(surface.NdotV, surfaceToLight.NdotL, surface.linearRoughness);
// Specular BRDF
float3 numerator = D * G * F;
float denominator = 4.0 * max(surface.NdotV, 0.0) * max(surfaceToLight.NdotL, 0.0) + 0.0001;
float3 specularBRDF = numerator / denominator;
float3 diffuseBRDF = surface.baseColor.rgb * M_1OVER_PI_F * surface.ao;
// Final output combining all terms
float3 kS = F; // Specular reflectance
float3 kD = (1.0 - kS) * (1.0 - surface.metalness); // Diffuse reflectance
float3 returnBRDF = kD * (diffuseBRDF) + specularBRDF;
if(isCapturing == 1)
return lerp(Fd + Fr,surface.baseColor.rgb,surface.metalness);
return lerp(returnBRDF ,surface.albedo.rgb,surface.metalness);
else
return Fd + Fr;
return returnBRDF;
}
float3 getDirectionalLight(Surface surface, SurfaceToLight surfaceToLight, float3 lightColor, float lightIntensity, float shadow)
@ -247,8 +260,13 @@ float3 getDirectionalLight(Surface surface, SurfaceToLight surfaceToLight, float
if(isCapturing != 1)
lightfloor = 0.0;
float3 factor = lightColor * max(surfaceToLight.NdotL* shadow * lightIntensity, lightfloor) ;
return evaluateStandardBRDF(surface,surfaceToLight) * factor;
// Calculate both specular and diffuse lighting in one BRDF evaluation
float3 directLighting = evaluateStandardBRDF(surface, surfaceToLight);
// Direct Diffuse Light Contribution (using Lambertian diffuse in BRDF)
float3 diffuseLight = directLighting * (lightColor * max(surfaceToLight.NdotL * shadow * lightIntensity, lightfloor));
return diffuseLight;
}
float3 getPunctualLight(Surface surface, SurfaceToLight surfaceToLight, float3 lightColor, float lightIntensity, float radius, float shadow)
@ -258,8 +276,14 @@ float3 getPunctualLight(Surface surface, SurfaceToLight surfaceToLight, float3 l
lightfloor = 0.0;
float attenuation = getDistanceAtt(surfaceToLight.Lu, radius);
float3 factor = lightColor * max(surfaceToLight.NdotL* shadow * lightIntensity * attenuation, lightfloor) ;
return evaluateStandardBRDF(surface,surfaceToLight) * factor;
// Calculate both specular and diffuse lighting in one BRDF evaluation
float3 directLighting = evaluateStandardBRDF(surface, surfaceToLight);
// Direct Diffuse Light Contribution (using Lambertian diffuse in BRDF)
float3 diffuseLight = directLighting * lightColor * max(surfaceToLight.NdotL* shadow * lightIntensity * attenuation, lightfloor);
return diffuseLight;
}
float3 getSpotlight(Surface surface, SurfaceToLight surfaceToLight, float3 lightColor, float lightIntensity, float radius, float3 lightDir, float2 lightSpotParams, float shadow)
@ -271,18 +295,32 @@ float3 getSpotlight(Surface surface, SurfaceToLight surfaceToLight, float3 light
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, lightfloor) ;
return evaluateStandardBRDF(surface,surfaceToLight) * factor;
// Calculate both specular and diffuse lighting in one BRDF evaluation
float3 directLighting = evaluateStandardBRDF(surface, surfaceToLight);
// Direct Diffuse Light Contribution (using Lambertian diffuse in BRDF)
float3 diffuseLight = directLighting * lightColor * max(surfaceToLight.NdotL* shadow * lightIntensity * attenuation, lightfloor);
return diffuseLight;
}
float computeSpecOcclusion( float NdotV , float AO , float roughness )
{
return saturate (pow( abs(NdotV + AO) , exp2 ( -16.0f * roughness - 1.0f )) - 1.0f + AO );
// Compute the geometry term using Smith's GGX for occlusion
float r = roughness * roughness; // Roughness squared
float ggx = (NdotV) / (NdotV * (1.0 - r) + r); // Smith GGX Geometry Function for occlusion
// Optionally modify by AO (ambient occlusion) and roughness
float specOcclusion = pow(ggx + AO, 2.0);
// Return the final occlusion factor (clamped between 0 and 1)
return saturate(specOcclusion);
}
float roughnessToMipLevel(float roughness, float numMips)
{
return pow(abs(roughness),0.25) * numMips;
return saturate((roughness * numMips) - (pow(roughness, 6.0) * (numMips * 0.125)));
}
float4 compute4Lights( Surface surface,
@ -396,20 +434,18 @@ void dampen(inout Surface surface, TORQUE_SAMPLER2D(WetnessTexture), float accum
{
if (degree<=0.0) return;
float3 n = abs(surface.N);
float ang = dot(float3(0,0,-1),surface.N);
float grav = 2.0-pow(ang,3);
if (grav<0) grav*=-1.0;
float ang = clamp(n.z, 0.04, 0.96);
float speed = accumTime*(1.0-surface.roughness)*grav;
float2 wetoffset = float2(speed,speed/2)*0.1;
float speed = accumTime*(1.0-surface.roughness)*ang;
float2 wetoffset = float2(speed,speed/2);
float wetness = TORQUE_TEX2D(WetnessTexture, float2(surface.P.xy*0.2+wetoffset)).b;
wetness = lerp(wetness,TORQUE_TEX2D(WetnessTexture,float2(surface.P.zx*0.2+wetoffset)).b,n.y);
wetness = lerp(wetness,TORQUE_TEX2D(WetnessTexture,float2(surface.P.zy*0.2+wetoffset)).b,n.x);
wetness = pow(wetness,3)*degree;
float wetness = TORQUE_TEX2D(WetnessTexture, float2(surface.P.xy*0.1+wetoffset)).b;
wetness = lerp(wetness,TORQUE_TEX2D(WetnessTexture,float2(surface.P.zx*0.1+wetoffset)).b,n.y);
wetness = lerp(wetness,TORQUE_TEX2D(WetnessTexture,float2(surface.P.zy*0.1+wetoffset)).b,n.x);
wetness = pow(wetness*ang*degree,3);
surface.roughness = lerp(surface.roughness,(1.0-wetness*surface.roughness)*0.92f+0.04f,ang);
surface.baseColor.rgb = lerp(surface.baseColor.rgb*(2.0-wetness),surface.baseColor.rgb,ang*surface.roughness);
surface.roughness = lerp(surface.roughness, 0.04f, wetness);
surface.baseColor.rgb = lerp(surface.baseColor.rgb, surface.baseColor.rgb*0.96+float3(0.04,0.04,0.04), pow(wetness,5));
surface.Update();
}
@ -549,33 +585,28 @@ float4 computeForwardProbes(Surface surface,
if(skylightCubemapIdx != -1 && alpha >= 0.001)
{
irradiance = lerp(irradiance,TORQUE_TEXCUBEARRAYLOD(irradianceCubemapAR, surface.R, skylightCubemapIdx, 0).xyz,alpha);
irradiance = lerp(irradiance,TORQUE_TEXCUBEARRAYLOD(irradianceCubemapAR, surface.N, skylightCubemapIdx, 0).xyz,alpha);
specular = lerp(specular,TORQUE_TEXCUBEARRAYLOD(specularCubemapAR, surface.R, skylightCubemapIdx, lod).xyz,alpha);
}
//energy conservation
float3 F = FresnelSchlickRoughness(surface.NdotV, surface.f0, surface.roughness);
float3 kD = 1.0f - F;
kD *= 1.0f - surface.metalness;
//float dfgNdotV = max( surface.NdotV , 0.0009765625f ); //0.5f/512.0f (512 is size of dfg/brdf lookup tex)
float2 envBRDF = TORQUE_TEX2DLOD(BRDFTexture, float4(surface.NdotV, surface.roughness,0,0)).rg;
specular *= F * envBRDF.x + surface.f90 * envBRDF.y;
irradiance *= kD * surface.baseColor.rgb;
float3 diffuse = irradiance * lerp(surface.baseColor.rgb, 0.04f, surface.metalness);
float3 specularCol = ((specular + surface.baseColor.rgb) * envBRDF.x + envBRDF.y)*surface.metalness;
//AO
irradiance *= surface.ao;
specular *= computeSpecOcclusion(surface.NdotV, surface.ao, surface.roughness);
//http://marmosetco.tumblr.com/post/81245981087
float horizonOcclusion = 1.3;
float horizon = saturate( 1 + horizonOcclusion * dot(surface.R, surface.N));
horizon *= horizon;
// Final color output after environment lighting
float3 finalColor = diffuse + specularCol;
finalColor *= surface.ao;
if(isCapturing == 1)
return float4(lerp((irradiance + specular* horizon),surface.baseColor.rgb,surface.metalness),0);
return float4(lerp((finalColor), surface.baseColor.rgb,surface.metalness),0);
else
return float4((irradiance + specular* horizon) , 0);//alpha writes disabled
{
return float4(finalColor, 0);
}
}
float4 debugVizForwardProbes(Surface surface,
@ -715,23 +746,22 @@ float4 debugVizForwardProbes(Surface surface,
return float4(irradiance, 0);
}
//energy conservation
float3 F = FresnelSchlickRoughness(surface.NdotV, surface.f0, surface.roughness);
float3 kD = 1.0f - F;
kD *= 1.0f - surface.metalness;
float2 envBRDF = TORQUE_TEX2DLOD(BRDFTexture, float4(surface.NdotV, surface.roughness,0,0)).rg;
specular *= F * envBRDF.x + surface.f90 * envBRDF.y;
irradiance *= kD * surface.baseColor.rgb;
float3 diffuse = irradiance * lerp(surface.baseColor.rgb, 0.04f, surface.metalness);
float3 specularCol = ((specular + surface.baseColor.rgb) * envBRDF.x + envBRDF.y)*surface.metalness;
//AO
irradiance *= surface.ao;
specular *= computeSpecOcclusion(surface.NdotV, surface.ao, surface.roughness);
//http://marmosetco.tumblr.com/post/81245981087
float horizonOcclusion = 1.3;
float horizon = saturate( 1 + horizonOcclusion * dot(surface.R, surface.N));
horizon *= horizon;
return float4((irradiance + specular* horizon) , 0);//alpha writes disabled
// Final color output after environment lighting
float3 finalColor = diffuse + specularCol;
finalColor *= surface.ao;
if(isCapturing == 1)
return float4(lerp((finalColor), surface.baseColor.rgb,surface.metalness),0);
else
{
return float4(finalColor, 0);
}
}

View file

@ -204,27 +204,18 @@ void main()
return;
#endif
//energy conservation
vec3 F = FresnelSchlickRoughness(surface.NdotV, surface.f0, surface.roughness);
vec3 kD = 1.0f - F;
kD *= 1.0f - surface.metalness;
vec2 envBRDF = textureLod(BRDFTexture, vec2(surface.NdotV, surface.roughness),0).rg;
specular *= F * envBRDF.x + surface.f90 * envBRDF.y;
irradiance *= kD * surface.baseColor.rgb;
//AO
irradiance *= surface.ao;
specular *= computeSpecOcclusion(surface.NdotV, surface.ao, surface.roughness);
//http://marmosetco.tumblr.com/post/81245981087
float horizonOcclusion = 1.3;
float horizon = saturate( 1 + horizonOcclusion * dot(surface.R, surface.N));
horizon *= horizon;
vec3 diffuse = irradiance * lerp(surface.baseColor.rgb, vec3(0.04f,0.04f,0.04f), surface.metalness);
vec3 specularCol = ((specular + surface.baseColor.rgb) * envBRDF.x + envBRDF.y)*surface.metalness;
// Final color output after environment lighting
vec3 finalColor = diffuse + specularCol;
finalColor *= surface.ao;
if(isCapturing == 1)
OUT_col = vec4(mix((irradiance + specular* horizon),surface.baseColor.rgb, surface.metalness),0);
OUT_col = vec4(lerp((finalColor), surface.baseColor.rgb,surface.metalness),0);
else
OUT_col = vec4((irradiance + specular* horizon)*ambientColor, 0);//alpha writes disabled
{
OUT_col = vec4(finalColor*ambientColor, 0);
}
}

View file

@ -159,13 +159,14 @@ float4 main(PFXVertToPix IN) : SV_TARGET
dampen(surface, TORQUE_SAMPLER2D_MAKEARG(WetnessTexture), accumTime, wetAmmout*dampness);
// Radiance (Specular)
#if DEBUGVIZ_SPECCUBEMAP == 0
float lod = roughnessToMipLevel(surface.roughness, cubeMips);
#elif DEBUGVIZ_SPECCUBEMAP == 1
float lod = 0;
#endif
#if DEBUGVIZ_SPECCUBEMAP == 0
lod = roughnessToMipLevel(surface.roughness, cubeMips);
#elif DEBUGVIZ_SPECCUBEMAP == 1
lod = 0;
#endif
#if SKYLIGHT_ONLY == 0
#if SKYLIGHT_ONLY == 0
for (i = 0; i < numProbes; i++)
{
float contrib = contribution[i];
@ -181,35 +182,32 @@ float4 main(PFXVertToPix IN) : SV_TARGET
#endif
if(skylightCubemapIdx != -1 && alpha >= 0.001)
{
irradiance = lerp(irradiance,TORQUE_TEXCUBEARRAYLOD(irradianceCubemapAR, surface.R, skylightCubemapIdx, 0).xyz,alpha);
irradiance = lerp(irradiance,TORQUE_TEXCUBEARRAYLOD(irradianceCubemapAR, surface.N, skylightCubemapIdx, 0).xyz,alpha);
specular = lerp(specular,TORQUE_TEXCUBEARRAYLOD(specularCubemapAR, surface.R, skylightCubemapIdx, lod).xyz,alpha);
}
#if DEBUGVIZ_SPECCUBEMAP == 1 && DEBUGVIZ_DIFFCUBEMAP == 0
return float4(specular, 1);
return float4(specular, 1);
#elif DEBUGVIZ_DIFFCUBEMAP == 1
return float4(irradiance, 1);
#endif
//energy conservation
float3 F = FresnelSchlickRoughness(surface.NdotV, surface.f0, surface.roughness);
float3 kD = 1.0f - F;
kD *= 1.0f - surface.metalness;
#endif
float2 envBRDF = TORQUE_TEX2DLOD(BRDFTexture, float4(surface.NdotV, surface.roughness,0,0)).rg;
specular *= F * envBRDF.x + surface.f90 * envBRDF.y;
irradiance *= kD * surface.baseColor.rgb;
float3 diffuse = irradiance * lerp(surface.baseColor.rgb, 0.04f, surface.metalness);
float3 specularCol = ((specular + surface.baseColor.rgb) * envBRDF.x + envBRDF.y)*surface.metalness;
//AO
irradiance *= surface.ao;
specular *= computeSpecOcclusion(surface.NdotV, surface.ao, surface.roughness);
//http://marmosetco.tumblr.com/post/81245981087
float horizonOcclusion = 1.3;
float horizon = saturate( 1 + horizonOcclusion * dot(surface.R, surface.N));
horizon *= horizon;
if(isCapturing == 1)
return float4(lerp((irradiance + specular* horizon), surface.baseColor.rgb,surface.metalness),0);
// Final color output after environment lighting
float3 finalColor = diffuse + specularCol;
finalColor *= surface.ao;
if(isCapturing == 1)
return float4(lerp(finalColor, surface.baseColor.rgb,surface.metalness),0);
else
return float4((irradiance + specular* horizon)*ambientColor, 0);//alpha writes disabled
{
return float4((finalColor*ambientColor), 0);
}
}

View file

@ -782,4 +782,15 @@ function getNumCanCallOnObjectList(%functionName, %objectsList)
}
return %numberWithFunction;
}
function getImageFileName(%id)
{
%assetDef = AssetDatabase.acquireAsset(%id);
return %assetDef.getImagePath();
}
function makeTerrainMapsFrom(%id)
{
splitTerrainMaps(getImageFileName(%id));
}

View file

@ -11,8 +11,8 @@ function JoinServerMenu::onWake(%this)
function JoinServerMenu::onSleep(%this)
{
echo("Exporting client prefs");
%prefPath = getPrefpath();
echo("Exporting client prefs to "@ getUserHomeDirectory() @ "/clientPrefs." @ $TorqueScriptFileExtension);
export("$pref::*", %prefPath @ "/clientPrefs." @ $TorqueScriptFileExtension, false);
}

View file

@ -1,3 +1,4 @@
$reportKeymapping = false;
$optionsEntryPad = 10;
$OptionsMenuCategories[0] = "Video";
@ -672,8 +673,8 @@ function OptionsMenu::populateKeybinds(%this, %device, %controlsList)
%keyMap = buildFullMapString( %i, $RemapActionMap[%i], %device );
%description = $RemapDescription[%i];
echo("Added ActionMap Entry: " @ %actionMapName @ " | " @ %device @ " | " @ %keymap @ " | " @ %description);
if ($reportKeymapping)
echo("Added ActionMap Entry: " @ %actionMapName @ " | " @ %device @ " | " @ %keymap @ " | " @ %description);
%remapEntry = addActionMapEntry(%actionMapName, %device, %keyMap, %i, %description);
%controlsList.add(%remapEntry);
@ -1074,7 +1075,8 @@ function addActionMapEntry(%actionMap, %device, %keyMap, %index, %description)
};
%buttonContainer = %entry.findObjectByInternalName("valuesContainer");
echo("Keymap: " @ %keymap @ " | Keymap word count: " @ getWordCount(getField(%keyMap, 1)));
if ($reportKeymapping)
echo("Keymap: " @ %keymap @ " | Keymap word count: " @ getWordCount(getField(%keyMap, 1)));
if(getWordCount(getField(%keyMap, 1)) == 2)
{
%modifierBtn = new GuiIconButtonCtrl() {

View file

@ -37,12 +37,18 @@ function PlayGui::onWake(%this)
if(isObject(moveMap))
moveMap.push();
callOnModules("Playgui_onWake");
%modulesIDList = getModulesAndGameModesList(true, "Game");
%numModsNeedingLoaded = getNumCanCallOnObjectList("Playgui_onWake", %modulesIDList);
if (%numModsNeedingLoaded)
callOnObjectList("Playgui_onWake", %modulesIdList);
}
function PlayGui::onSleep(%this)
{
callOnModules("Playgui_onSleep");
%modulesIDList = getModulesAndGameModesList(true, "Game");
%numModsNeedingLoaded = getNumCanCallOnObjectList("Playgui_onSleep", %modulesIDList);
if (%numModsNeedingLoaded)
callOnObjectList("Playgui_onSleep", %modulesIdList);
// pop the keymaps
if(isObject(moveMap))
@ -51,7 +57,11 @@ function PlayGui::onSleep(%this)
function PlayGui::clearHud( %this )
{
callOnModules("Playgui_clearHud");
%modulesIDList = getModulesAndGameModesList(true, "Game");
%numModsNeedingLoaded = getNumCanCallOnObjectList("Playgui_clearHud", %modulesIDList);
if (%numModsNeedingLoaded)
callOnObjectList("Playgui_clearHud", %modulesIdList);
Canvas.popDialog( MainChatHud );
while ( %this.getCount() > 0 )

View file

@ -4,7 +4,13 @@ function AssetBrowser::setupCreateNewLevelAsset(%this)
NewAssetPropertiesInspector.addField("LevelName", "Level Name", "String", "Human-readable name of new level", "", "", %this.newAssetSettings);
NewAssetPropertiesInspector.addField("levelPreviewImage", "Level Preview Image", "Image", "Preview Image for the level", "", "", %this.newAssetSettings);
NewAssetPropertiesInspector.addField("isSubScene", "Is SubScene", "bool", "Is this levelAsset intended as a subScene", "", "", %this.newAssetSettings);
//If we forcefully set it elsewhere, adhere
if($createLevelAssetIsSubScene == true)
%this.newAssetSettings.isSubScene = true;
else
%this.newAssetSettings.isSubScene = false;
NewAssetPropertiesInspector.addField("isSubScene", "Is SubScene", "bool", "Is this levelAsset intended as a subScene", %this.newAssetSettings.isSubScene, "", %this.newAssetSettings);
NewAssetPropertiesInspector.endGroup();
}
@ -27,6 +33,7 @@ function AssetBrowser::createLevelAsset(%this)
%tamlpath = %assetPath @ %assetName @ ".asset.taml";
%levelPath = %assetPath @ %assetName @ %misExtension;
%asset = new LevelAsset()
{
AssetName = %assetName;
@ -55,7 +62,24 @@ function AssetBrowser::createLevelAsset(%this)
echo("Unable to copy template level file!");
}
replaceInFile(%levelPath, "EditorTemplateLevel", %assetName);
if(%asset.isSubScene)
{
%fileObj = new FileObject();
if (!%fileObj.openForWrite(%levelPath))
{
echo("Unable to write subScene file!");
}
else
{
%fileObj.writeLine("");
%fileObj.close();
%fileObj.delete();
}
}
else
{
replaceInFile(%levelPath, "EditorTemplateLevel", %assetName);
}
//Generate the associated files
DecalManagerSave( %assetPath @ %asset.DecalsFile );
@ -87,6 +111,8 @@ function AssetBrowser::setupCreateNewSubScene(%this)
function AssetBrowser::editLevelAsset(%this, %assetDef)
{
echo("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA");
echo(%assetDef @ ".isSubScene = " @ %assetDef.isSubScene);
if(!%assetDef.isSubScene)
schedule( 1, 0, "EditorOpenMission", %assetDef);
}
@ -157,7 +183,15 @@ function AssetBrowser::buildLevelAssetPreview(%this, %assetDef, %previewData)
{
%previewData.assetName = %assetDef.assetName;
%previewData.assetPath = %assetDef.getLevelPath();
%previewData.doubleClickCommand = "schedule( 1, 0, \"EditorOpenMission\", "@%assetDef@");";
if(%this.selectMode || %assetDef.isSubScene)
{
%previewData.doubleClickCommand = "AssetBrowser.selectAsset( AssetBrowser.selectedAsset );";
}
else
{
%previewData.doubleClickCommand = "schedule( 1, 0, \"EditorOpenMission\", "@%assetDef@");";
}
%levelPreviewImage = %assetDef.PreviewImage;
@ -176,7 +210,10 @@ function AssetBrowser::buildLevelAssetPreview(%this, %assetDef, %previewData)
function createAndAssignLevelAsset(%moduleName, %assetName)
{
$createAndAssignField.apply(%moduleName @ ":" @ %assetName);
if(AssetDatabase.isDeclaredAsset(%moduleName))
$createAndAssignField.apply(%moduleName);
else
$createAndAssignField.apply(%moduleName @ ":" @ %assetName);
}
function EWorldEditor::createSelectedAsSubScene( %this, %object )

View file

@ -124,6 +124,8 @@ function AssetBrowser::setupCreateNewAsset(%this, %assetType, %moduleName, %call
%command = %this @ ".setupCreateNew"@%assetType @"();";
eval(%command);
}
NewAssetPropertiesInspector.refresh();
}
function NewAssetPropertiesInspector::updateNewAssetField(%this)

View file

@ -287,3 +287,10 @@ function EditorInspectorBase::getFullFilePath( %field )
else
return makeFullPath( %fileName, getMainDotCsDir() );
}
function GameBase::onInspect(%this, %inspector)
{
Parent::onInspect(%this, %inspector);
if (%this.getDatablock().isMethod("onInspect"))
%this.getDatablock().onInspect(%this, %inspector);
}

View file

@ -1,43 +1,32 @@
//--- OBJECT WRITE BEGIN ---
$guiContent = new GuiColorPickerCtrl(ColorPickerDlg,EditorGuiGroup) {
displayMode = "Dropper"; // this makes the background visible
actionOnMove = "1";
position = "0 0";
extent = "1024 768";
minExtent = "8 2";
horizSizing = "right";
vertSizing = "bottom";
profile = "ToolsGuiDefaultProfile";
visible = "1";
active = "1";
Clickable = "1";
AffectChildren = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "1";
canSave = "1";
canSaveDynamicFields = "0";
displayMode = "Dropper";
extent = "1024 768";
profile = "GuiDefaultProfile";
command = "%selHue = ColorPickerDlg.getSelectedHue();\n%selSat = ColorPickerDlg.getSelectedSaturation();\n%selBright = ColorPickerDlg.getSelectedBrightness();\n%selAlpha = ColorPickerDlg.getSelectedAlpha();\n\nColorHueRange.setSelectedHue(%selHue);\nColorHueRange.executeUpdate();\n\nColorBlendRange.setSelectedBrightness(%selBright);\nColorBlendRange.setSelectedSaturation(%selSat);\nColorBlendRange.executeUpdate();\n\nColorAlphaRange.setSelectedAlpha(%selAlpha);\nColorAlphaRange.executeUpdate();\n\nColorEyeDropperButton.setStateOn(false);";
tooltipProfile = "GuiToolTipProfile";
isContainer = "1";
new GuiWindowCtrl() {
text = " ";
resizeWidth = "0";
resizeHeight = "0";
canMinimize = "0";
canMaximize = "0";
closeCommand = "DoColorPickerCancelCallback(); ColorPickerDlg.getRoot().popDialog(ColorPickerDlg);";
position = "33 33";
extent = "271 574";
horizSizing = "windowRelative";
vertSizing = "windowRelative";
profile = "ToolsGuiWindowProfile";
tooltipProfile = "ToolsGuiToolTipProfile";
text = " ";
resizeWidth = "0";
resizeHeight = "0";
canMinimize = "0";
canMaximize = "0";
closeCommand = "DoColorPickerCancelCallback(); ColorPickerDlg.getRoot().popDialog(ColorPickerDlg);";
position = "33 33";
extent = "271 574";
horizSizing = "windowRelative";
vertSizing = "windowRelative";
profile = "ToolsGuiWindowProfile";
tooltipProfile = "ToolsGuiToolTipProfile";
new GuiStackControl() {
padding = "5";
changeChildSizeToFit = "0";
changeChildPosition = "0";
position = "0 24";
extent = "271 481";
extent = "271 491";
profile = "GuiDefaultProfile";
tooltipProfile = "GuiToolTipProfile";
@ -120,7 +109,7 @@ $guiContent = new GuiColorPickerCtrl(ColorPickerDlg,EditorGuiGroup) {
position = "213 3";
extent = "50 25";
profile = "GuiDefaultProfile";
command = "%selHue = ColorNewSelected.getSelectedHue();\n%selSat = ColorNewSelected.getSelectedSaturation();\n%selBright = ColorNewSelected.getSelectedBrightness();\n\nHueTextEditor.setText(%selHue);\nSatTextEditor.setText(%selSat);\nBrightTextEditor.setText(%selBright);\n\n%color = ColorNewSelected.getSelectedColorI();\nRedTextEdit.setText(getWord(%color, 0));\nGreenTextEdit.setText(getWord(%color, 1));\nBlueTextEdit.setText(getWord(%color, 2));\nAlphaTextEdit.setText(getWord(%color, 3));\n\n%hex = ColorRGBToHEX(%color);\nHexTextEditor.setText(%hex);";
command = "%selHue = ColorNewSelected.getSelectedHue();\n%selSat = ColorNewSelected.getSelectedSaturation();\n%selBright = ColorNewSelected.getSelectedBrightness();\n\nHueTextEditor.setText(%selHue);\nSatTextEditor.setText(%selSat);\nBrightTextEditor.setText(%selBright);\n\n%color = $ColorCallbackType == 1 ? ColorNewSelected.getSelectedColorI() : ColorNewSelected.getSelectedLinearColor();\nRedTextEdit.setText(getWord(%color, 0));\nGreenTextEdit.setText(getWord(%color, 1));\nBlueTextEdit.setText(getWord(%color, 2));\nAlphaTextEdit.setText(getWord(%color, 3));\n\n%hex = ColorRGBToHEX(ColorNewSelected.getSelectedColorI());\nHexTextEditor.setText(%hex);";
tooltipProfile = "GuiToolTipProfile";
};
new GuiColorPickerCtrl(ColorOld) {
@ -268,16 +257,25 @@ $guiContent = new GuiColorPickerCtrl(ColorPickerDlg,EditorGuiGroup) {
text = "Apply";
position = "211 1";
extent = "52 20";
command = "DoColorPickerCallback();";
profile = "ToolsGuiButtonProfile";
command = "DoColorPickerCallback();";
tooltipProfile = "GuiToolTipProfile";
};
new GuiButtonCtrl() {
text = "Cancel";
position = "211 24";
extent = "52 20";
command = "DoColorPickerCancelCallback();";
profile = "ToolsGuiButtonProfile";
command = "DoColorPickerCancelCallback();";
tooltipProfile = "GuiToolTipProfile";
};
new GuiBitmapButtonCtrl(ColorEyeDropperButton) {
BitmapAsset = "ToolsModule:eyedropper_n_image";
buttonType = "ToggleButton";
position = "223 56";
extent = "25 25";
profile = "ToolsGuiCheckBoxProfile";
command = "ColorPickerDlg.activateEyeDropper();";
tooltipProfile = "GuiToolTipProfile";
};
};
@ -285,20 +283,26 @@ $guiContent = new GuiColorPickerCtrl(ColorPickerDlg,EditorGuiGroup) {
};
new GuiRolloutCtrl() {
caption = ":: Color Palette";
margin = "5 5 5 5";
position = "0 445";
extent = "271 36";
extent = "271 46";
profile = "GuiRolloutProfile";
tooltipProfile = "GuiToolTipProfile";
new GuiStackControl() {
stackingType = "Dynamic";
padding = "5";
changeChildSizeToFit = "0";
position = "0 17";
extent = "271 16";
profile = "GuiDefaultProfile";
tooltipProfile = "GuiToolTipProfile";
};
new GuiDynamicCtrlArrayControl(ColorPaletteStack) {
colCount = "12";
colSize = "12";
rowSize = "12";
rowCount = "3";
rowSpacing = "1";
colSpacing = "1";
dynamicSize = "1";
padding = "3 3 3 3";
position = "0 17";
extent = "271 47";
profile = "GuiDefaultProfile";
tooltipProfile = "GuiToolTipProfile";
};
};
};
};
@ -344,6 +348,87 @@ function GetColorF( %currentColor, %callback, %root, %updateCallback, %cancelCal
%root.pushDialog(ColorPickerDlg);
}
function ColorPaletteStack::onWake(%this)
{
if($Pref::ColorPicker::ColorPalette $= "")
{
$Pref::ColorPicker::ColorPalette = "#FFFFFF #FF0000 #00FF00 #0000FF";
}
%colorCount = getWordCount($Pref::ColorPicker::ColorPalette);
if(%colorCount > 63)
%colorCount = 63;
for(%i=0; %i < %colorCount; %i++)
{
%hex = getWord($Pref::ColorPicker::ColorPalette, %i);
%rgb = ColorHEXToRGB(%hex);
%rgb = ColorIntToFloat(%rgb);
%colorBox = new GuiSwatchButtonCtrl() {
extent = "16 16";
color = %rgb;
profile = "GuiDefaultProfile";
colorHex = %hex;
useMouseEvents = "1";
class = "ColorPaletteSwatch";
};
ColorPaletteStack.Add(%colorBox);
}
%button = new GuiButtonCtrl() {
text = "+";
extent = "16 16";
profile = "ToolsGuiButtonProfile";
tooltipProfile = "GuiToolTipProfile";
command = "ColorPaletteStack.addCurrentColorToStack();";
};
ColorPaletteStack.Add(%button);
}
function ColorPaletteStack::addCurrentColorToStack(%this)
{
%hex = HexTextEditor.getValue();
//Make sure we have 6 characters
while(strlen(%hex) < 6)
{
%hex = "0" @ %hex;
}
%hex = strupr(%hex);
$Pref::ColorPicker::ColorPalette = "#" @ %hex SPC $Pref::ColorPicker::ColorPalette;
ColorPaletteStack.clear();
ColorPaletteStack.onWake();
}
function ColorPaletteStack::onSleep(%this)
{
ColorPaletteStack.clear();
}
function ColorPaletteSwatch::onMouseDown(%this)
{
//Update all the other color fields
%rgb = ColorHEXToRGB(%this.colorHex);
%hsb = ColorRGBToHSB(%rgb);
// these automatically update our ColorNewSelected which
// updates all text fields including these.
ColorHueRange.setSelectedHue(getWord(%hsb, 0));
ColorHueRange.executeUpdate();
ColorBlendRange.setSelectedSaturation(getWord(%hsb, 1));
ColorBlendRange.setSelectedBrightness(getWord(%hsb, 2));
ColorBlendRange.executeUpdate();
// for now just set full alpha until we save out alpha as well
ColorAlphaRange.setSelectedAlpha(255);
ColorAlphaRange.executeUpdate();
}
function ColorPickerRGBClass::onValidate(%this)
{
%red = RedTextEdit.getValue();
@ -352,8 +437,13 @@ function ColorPickerRGBClass::onValidate(%this)
%alpha = AlphaTextEdit.getValue();
//Update all the other color fields
%hsb = ColorRGBToHSB(%red SPC %green SPC %blue);
if( $ColorCallbackType == 1)
%hsb = ColorRGBToHSB(%red SPC %green SPC %blue);
else
{
%hsb = ColorLinearRGBToHSB(%red SPC %green SPC %blue);
%alpha *= 255.0;
}
// these automatically update our ColorNewSelected which
// updates all text fields including these.
ColorHueRange.setSelectedHue(getWord(%hsb, 0));

View file

@ -0,0 +1,3 @@
<ImageAsset
AssetName="add-simgroup-btn_ctrl_i_image"
imageFile="@assetFile=add-simgroup-btn_ctrl_i.png"/>

View file

@ -0,0 +1,3 @@
<ImageAsset
AssetName="add-simgroup-btn_i_image"
imageFile="@assetFile=add-simgroup-btn_i.png"/>

View file

@ -0,0 +1,3 @@
<ImageAsset
AssetName="camera-btn_i_image"
imageFile="@assetFile=camera-btn_i.png"/>

View file

@ -0,0 +1,3 @@
<ImageAsset
AssetName="clear-icon_i_image"
imageFile="@assetFile=clear-icon_i.png"/>

View file

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

View file

@ -0,0 +1,3 @@
<ImageAsset
AssetName="dropdown-button-arrow_d_image"
imageFile="@assetFile=dropdown-button-arrow_d.png"/>

View file

@ -0,0 +1,3 @@
<ImageAsset
AssetName="dropdown-button-arrow_h_image"
imageFile="@assetFile=dropdown-button-arrow_h.png"/>

View file

@ -0,0 +1,3 @@
<ImageAsset
AssetName="dropdown-button-arrow_i_image"
imageFile="@assetFile=dropdown-button-arrow_i.png"/>

View file

@ -0,0 +1,3 @@
<ImageAsset
AssetName="dropdown-button-arrow_n_image"
imageFile="@assetFile=dropdown-button-arrow_n.png"/>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View file

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 1 KiB

View file

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View file

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -0,0 +1,3 @@
<ImageAsset
AssetName="layers-btn_i_image"
imageFile="@assetFile=layers-btn_i.png"/>

View file

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

View file

@ -0,0 +1,3 @@
<ImageAsset
AssetName="new-folder-btn_i_image"
imageFile="@assetFile=new-folder-btn_i.png"/>

View file

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

View file

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

View file

@ -0,0 +1,3 @@
<ImageAsset
AssetName="open-file_i_image"
imageFile="@assetFile=open-file_i.png"/>

View file

@ -0,0 +1,3 @@
<ImageAsset
AssetName="reset-icon_i_image"
imageFile="@assetFile=reset-icon_i.png"/>

View file

@ -0,0 +1,3 @@
<ImageAsset
AssetName="selector-button_image"
imageFile="@assetFile=selector-button.png"/>

View file

@ -0,0 +1,3 @@
<ImageAsset
AssetName="tab-border_image"
imageFile="@assetFile=tab-border.png"/>

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -0,0 +1,3 @@
<ImageAsset
AssetName="uv-editor-btn_i_image"
imageFile="@assetFile=uv-editor-btn_i.png"/>

View file

@ -2733,6 +2733,11 @@ function matEdDragNDropMapAssignment(%type, %payload)
MaterialEditorGui.guiSync( materialEd_previewMaterial );
MaterialEditorGui.doUpdateTextureMap( %assetId );
Canvas.popDialog(EditorDragAndDropLayer);
if(EditorSettings.value("AssetManagement/Assets/closeBrowserOnDragAction", false))
{
AssetBrowser.hideDialog();
}
}
function materialEditorDiffuseMapContainer::onControlDropped( %this, %payload, %position )

View file

@ -1502,6 +1502,22 @@ function ObjectBuilderGui::buildFlyingVehicle(%this)
%this.process();
}
function ObjectBuilderGui::buildSpawnSphere(%this)
{
%this.objectClassName = "SpawnSphere";
%this.addField("dataBlock", "TypeDataBlock", "dataBlock", "MissionMarkerData SpawnSphereMarker");
%this.addField("radius", "TypeFloat", "Radius", 1);
%this.addField("sphereWeight", "TypeFloat", "Sphere Weight", 1);
%this.addField("spawnClass", "TypeString", "Spawn Class", "");
%this.addField("spawnDatablock", "TypeString", "Spawn Data", "");
%this.addField("spawnTransform", "TypeBool", "Spawn Here", "true");
%this.addField("autoSpawn", "TypeBool", "Auto Spawn Objects", "false");
%this.addField("spawnScript", "TypeString", "spawnScript", "%this.spawned = $SpawnObject;");
%this.addField("canSaveDynamicFields", "TypeBool", "Save metadata", "false");
%this.process();
}
function ObjectBuilderGui::buildObserverDropPoint(%this)
{
%this.objectClassName = "SpawnSphere";

Binary file not shown.

After

Width:  |  Height:  |  Size: 890 B

View file

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 741 B

View file

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 544 B

View file

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 729 B

View file

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 640 B

View file

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 509 B

View file

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 477 B

View file

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 468 B

View file

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 427 B

View file

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 898 B

View file

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 739 B

View file

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 633 B

Some files were not shown because too many files have changed in this diff Show more