Update Freelancer Advanced Renderer to Version 1.2

This commit is contained in:
D4rkl1ght3r
2026-03-15 12:12:07 +01:00
parent 8a728cc2f3
commit 2f79502390
13 changed files with 174 additions and 47 deletions

View File

@@ -58,6 +58,7 @@ struct Light{
struct glFogParameters
{
vec3 color;
vec3 colorLinear;
float density;
float start;
float end;
@@ -171,15 +172,14 @@ float ShadowCalculation(const float bias, const int shadowMapIndex, const int li
float ShadowCalculationForAllSplitPlanes(const int lightIndex, const vec3 lightDirViewSpace, const vec3 normal, float lightIntensity, const sampler2DArrayShadow shadowSampler)
{
float distance = v.z;
float distance = v.z;
float bias = max(0.001 * (1.0 - dot(normal, lightDirViewSpace)), 0.0003);
bool applied = false;
for (int i = 0; i < NUM_SPLITS; i++)
if(!applied && (distance < splitPlanes[i]))
{
//bias = ((i+1)*0.1)*0.001;
{
lightIntensity *= ShadowCalculation(bias, i, lightIndex, shadowSampler);
applied=true;
//Graphics cards hate break (SLOW), hence boolean value above
@@ -468,7 +468,7 @@ void main(void)
{
float fogFactor = 0;
if (enableFog && fogMode > 0)
{
{
//Radial fog
float z = length(v);
if (fogMode == 3)
@@ -476,12 +476,12 @@ void main(void)
fogFactor = (fogEnd - z) * fogScale;
}
else if (fogMode == 1)
{
fogFactor = 1.0/exp(glFog.density * z);
{
fogFactor = exp(-glFog.density * z);
}
else if (fogMode == 2)
{
fogFactor = 1.0 /exp( (z * glFog.density)* (z * glFog.density));
fogFactor = exp(- pow(z * glFog.density,2));
}
fogFactor = clamp(fogFactor, 0.0, 1.0);
@@ -524,7 +524,8 @@ void main(void)
firstTexture = vec4(1,1,1,1);
}
float alpha = alphaValue*firstTexture.a;
float alpha = alphaValue*firstTexture.a;
if (enableAlphaTest)
if(alphaTestCompareMethod==5)
{
@@ -592,7 +593,7 @@ void main(void)
vec3 radiance;
if (enableFog)
{
vec3 ambientTint=PBR_FACTOR_ENV*glFog.color.rgb;
vec3 ambientTint=PBR_FACTOR_ENV*glFog.colorLinear.rgb;
irradiance = vec3(texture(irradianceMap, n).r)*ambientTint;
radiance = vec3(textureLod(envMap, reflectDir, lod).r)*ambientTint;
}
@@ -715,8 +716,9 @@ void main(void)
if (enableFog && fogMode > 0)
{
finalColor = mix(vec4(glFog.color,1.0),finalColor, fogFactor);
finalColor.rgb = mix(glFog.color.rgb,ToGammaCorrected(finalColor.rgb), fogFactor);
diffuseColorOut=vec4(finalColor.rgb,finalColor.a);
}
diffuseColorOut=vec4(ToGammaCorrected(finalColor.rgb),finalColor.a);
else
diffuseColorOut=vec4(ToGammaCorrected(finalColor.rgb),finalColor.a);
}