Merge remote-tracking branch 'upstream/development' into imageAsset_refactor_rev3

This commit is contained in:
marauder2k7 2025-04-05 15:59:02 +01:00
commit 7c4d41ee21
21 changed files with 98 additions and 158 deletions

View file

@ -144,13 +144,20 @@ function GameConnectionListener::onSetSpawnObjectTypeComplete( %this, %client )
// a new one could result in an uncontrolled player object.
error("Attempting to create a player for a client that already has one!");
}
if ((!isClass(%client.spawnClass)) || (!isClass(%client.spawnDBType)) || (!isObject(%client.spawnDataBlock)))
%this.onSetSpawnObjectTypeFailed(%client, false );
%client.setSpawnPoint();
}
function GameConnectionListener::onSetSpawnObjectTypeFailed( %this, %client, %canContinueOnFail )
{
errorf("Failed to properly set Spawn Object Type for client: " @ %client);
error("Failed to properly set Spawn Object Type for client: " @ %client);
//baseline controlObject spawn type with extention points
%client.spawnClass = "Camera";
%client.spawnDBType = "CameraData";
%client.spawnDataBlock = "Observer";
%client.onSetSpawnObjectTypeComplete(%client);
}
function GameConnection::setSpawnPoint( %this )
@ -246,7 +253,15 @@ function GameConnectionListener::onSetSpawnPointComplete( %this, %client )
function GameConnectionListener::onSetSpawnPointFailed( %this, %client, %canContinueOnFail )
{
errorf("Failed to properly set Spawn Object Type for client: " @ %client);
error("Failed to properly set Spawn Location for client: " @ %client);
//baseline spawn point config rules with extention points
%this.playerSpawnGroups = "PlayerSpawnPoints PlayerDropPoints";
%this.spawnPoint = "";
%this.spawnLocation = "0 0 0";
%this.spawnProperties = "";
%this.spawnScript = "";
%this.onSetSpawnPointComplete(%client);
}
function GameConnection::onPostSpawn( %this )

View file

@ -433,16 +433,24 @@ void dampen(inout Surface surface, sampler2D WetnessTexture, float accumTime, fl
vec3 n = abs(surface.N);
float ang = clamp(n.z, 0.04, 0.96);
float speed = accumTime*(1.0-surface.roughness)*ang;
vec2 wetoffset = vec2(speed,speed/2);
float speed = -accumTime*(1.0-surface.linearRoughnessSq)*clamp((2.0-ang), 0.04, 0.96);
if ((n.x > 0.0) || (n.y > 0.0))
speed *= -1.0;
vec2 wetoffset = vec2(speed,speed)*0.1;
vec3 wetNormal = texture(WetnessTexture, float2(surface.P.xy*0.1+wetoffset)).xyz;
wetNormal = lerp(wetNormal,texture(WetnessTexture,float2(surface.P.zx*0.1+wetoffset)).rgb ,n.y);
wetNormal = lerp(wetNormal,texture(WetnessTexture,float2(surface.P.zy*0.1+wetoffset)).rgb ,n.x);
surface.N = lerp(surface.N, wetNormal, 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, 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));
surface.baseColor.rgb = lerp(surface.baseColor.rgb, surface.baseColor.rgb*0.6+float3(0.4,0.4,0.4)*wetness, wetness);
surface.metalness = lerp(surface.metalness, 0.96, wetness);
updateSurface(surface);
}

View file

@ -436,16 +436,24 @@ void dampen(inout Surface surface, TORQUE_SAMPLER2D(WetnessTexture), float accum
float3 n = abs(surface.N);
float ang = clamp(n.z, 0.04, 0.96);
float speed = accumTime*(1.0-surface.roughness)*ang;
float2 wetoffset = float2(speed,speed/2);
float speed = -accumTime*(1.0-surface.linearRoughnessSq)*clamp((2.0-ang), 0.04, 0.96);
if ((n.x > 0.0) || (n.y > 0.0))
speed *= -1.0;
float2 wetoffset = float2(speed,speed)*0.1;
float3 wetNormal = TORQUE_TEX2D(WetnessTexture, float2(surface.P.xy*0.1+wetoffset)).xyz;
wetNormal = lerp(wetNormal,TORQUE_TEX2D(WetnessTexture,float2(surface.P.zx*0.1+wetoffset)).rgb ,n.y);
wetNormal = lerp(wetNormal,TORQUE_TEX2D(WetnessTexture,float2(surface.P.zy*0.1+wetoffset)).rgb ,n.x);
surface.N = lerp(surface.N, wetNormal, 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, 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.baseColor.rgb = lerp(surface.baseColor.rgb, surface.baseColor.rgb*0.6+float3(0.4,0.4,0.4)*wetness, wetness);
surface.metalness = lerp(surface.metalness, 0.96, wetness);
surface.Update();
}

View file

@ -206,7 +206,7 @@ void main()
vec2 envBRDF = textureLod(BRDFTexture, vec2(surface.NdotV, surface.roughness),0).rg;
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;
vec3 specularCol = (specular * surface.f0 * envBRDF.x + envBRDF.y)*surface.metalness;
float horizonOcclusion = 1.3;
float horizon = saturate( 1 + horizonOcclusion * dot(surface.R, surface.N));

View file

@ -156,6 +156,7 @@ float4 main(PFXVertToPix IN) : SV_TARGET
if (SkylightDamp>0)
wetAmmout += alpha;
dampen(surface, TORQUE_SAMPLER2D_MAKEARG(WetnessTexture), accumTime, wetAmmout*dampness);
// Radiance (Specular)
@ -179,9 +180,9 @@ float4 main(PFXVertToPix IN) : SV_TARGET
specular += TORQUE_TEXCUBEARRAYLOD(specularCubemapAR, dir, cubemapIdx, lod).xyz * contrib;
}
}
#endif
#endif
if(skylightCubemapIdx != -1 && alpha >= 0.001)
{
{
irradiance = lerp(irradiance,TORQUE_TEXCUBEARRAYLOD(irradianceCubemapAR, surface.N, skylightCubemapIdx, 0).xyz,alpha);
specular = lerp(specular,TORQUE_TEXCUBEARRAYLOD(specularCubemapAR, surface.R, skylightCubemapIdx, lod).xyz,alpha);
}
@ -193,8 +194,8 @@ float4 main(PFXVertToPix IN) : SV_TARGET
#endif
float2 envBRDF = TORQUE_TEX2DLOD(BRDFTexture, float4(surface.NdotV, surface.roughness,0,0)).rg;
float3 diffuse = irradiance * lerp(surface.baseColor.rgb, 0.04f, surface.metalness);
float3 specularCol = ((specular * surface.baseColor.rgb) * envBRDF.x + envBRDF.y)*surface.metalness;
float3 diffuse = irradiance * lerp(surface.baseColor.rgb, float3(0.04f,0.04f,0.04f), surface.metalness);
float3 specularCol = (specular * surface.f0 * envBRDF.x + envBRDF.y)*surface.metalness;
float horizonOcclusion = 1.3;
float horizon = saturate( 1 + horizonOcclusion * dot(surface.R, surface.N));