remove broken precise midtexture trace, fix sky tracing for actors
This commit is contained in:
parent
66d4d2d7d0
commit
e0897ae8b2
8 changed files with 19 additions and 97 deletions
|
|
@ -183,4 +183,3 @@ int get_gl_spritelight()
|
|||
CVARD(Bool, gl_fakemodellight, true, CVAR_GLOBALCONFIG | CVAR_ARCHIVE, "adds a fake sunlight on models to improve contrast")
|
||||
CVARD(Float, gl_fakemodellightintensity, 0.05, CVAR_GLOBALCONFIG | CVAR_ARCHIVE, "fake sunlight intensity (brightness)")
|
||||
|
||||
CVARD(Bool, gl_precise_midtextures_trace, false, CVAR_GLOBALCONFIG | CVAR_ARCHIVE, "trace midtextures facing towards camera, only needed for maps that don't use midtextures 'evenly', roughly doubles the cost of ray-traced lights")
|
||||
|
|
@ -67,4 +67,5 @@ int get_gl_spritelight();
|
|||
|
||||
EXTERN_CVAR(Bool, gl_fakemodellight)
|
||||
EXTERN_CVAR(Float, gl_fakemodellightintensity)
|
||||
EXTERN_CVAR(Bool, gl_precise_midtextures_trace)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -441,7 +441,6 @@ void VkShaderManager::BuildDefinesBlock(FString &definesBlock, const char *defin
|
|||
|
||||
definesBlock << "#define USE_RAYTRACE ((uShaderKey1 & SK1_USE_RAYTRACE) != 0)\n";
|
||||
definesBlock << "#define USE_RAYTRACE_PRECISE ((uShaderKey1 & SK1_USE_RAYTRACE_PRECISE) != 0)\n";
|
||||
definesBlock << "#define PRECISE_MIDTEXTURES ((uShaderKey1 & SK1_PRECISE_MIDTEXTURES) != 0)\n";
|
||||
|
||||
definesBlock << "#define SHADOWMAP_FILTER (SK_GET_SHADOWMAP_FILTER())\n";
|
||||
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ public:
|
|||
uint64_t UseShadowmap : 1; // USE_SHADOWMAP
|
||||
uint64_t UseRaytrace : 1; // USE_RAYTRACE
|
||||
uint64_t UseRaytracePrecise : 1; // USE_RAYTRACE_PRECISE
|
||||
uint64_t PreciseMidtextureTrace : 1; // PRECISE_MIDTEXTURES
|
||||
uint64_t Unused4 : 1; // formerly PRECISE_MIDTEXTURES
|
||||
uint64_t ShadowmapFilter : 4; // SHADOWMAP_FILTER
|
||||
uint64_t FogBeforeLights : 1; // FOG_BEFORE_LIGHTS
|
||||
uint64_t FogAfterLights : 1; // FOG_AFTER_LIGHTS
|
||||
|
|
@ -105,12 +105,12 @@ public:
|
|||
uint64_t LightMode : 2; // LIGHTMODE_DEFAULT, LIGHTMODE_SOFTWARE, LIGHTMODE_VANILLA, LIGHTMODE_BUILD
|
||||
uint64_t LightBlendMode : 2; // LIGHT_BLEND_CLAMPED , LIGHT_BLEND_COLORED_CLAMP , LIGHT_BLEND_UNCLAMPED
|
||||
uint64_t LightAttenuationMode : 1; // LIGHT_ATTENUATION_LINEAR , LIGHT_ATTENUATION_INVERSE_SQUARE
|
||||
uint64_t Unused4: 1;
|
||||
uint64_t Unused5: 1;
|
||||
uint64_t FogBalls : 1; // FOGBALLS
|
||||
uint64_t NoFragmentShader : 1;
|
||||
uint64_t DepthFadeThreshold : 1;
|
||||
uint64_t AlphaTestOnly : 1; // ALPHATEST_ONLY
|
||||
uint64_t Unused5 : 1;
|
||||
uint64_t Unused6 : 1;
|
||||
uint64_t LightNoNormals : 1; // LIGHT_NONORMALS
|
||||
uint64_t UseSpriteCenter : 1; // USE_SPRITE_CENTER
|
||||
uint64_t Unused : 26;
|
||||
|
|
|
|||
|
|
@ -336,7 +336,6 @@ void VkRenderState::ApplyRenderPass(int dt)
|
|||
pipelineKey.ShaderKey.UseShadowmap = gl_light_shadows == 1;
|
||||
pipelineKey.ShaderKey.UseRaytrace = gl_light_shadows >= 2;
|
||||
pipelineKey.ShaderKey.UseRaytracePrecise = gl_light_shadows >= 3;
|
||||
pipelineKey.ShaderKey.PreciseMidtextureTrace = gl_precise_midtextures_trace;
|
||||
pipelineKey.ShaderKey.ShadowmapFilter = std::clamp(int(gl_light_shadow_filter), 0, 15);
|
||||
|
||||
pipelineKey.ShaderKey.Layout.GBufferPass = mRenderTarget.DrawBuffers > 1;
|
||||
|
|
@ -1110,7 +1109,6 @@ void VkRenderState::ApplyLevelMeshPipeline(VulkanCommandBuffer* cmdbuffer, VkPip
|
|||
pipelineKey.ShaderKey.UseShadowmap = gl_light_shadows == 1;
|
||||
pipelineKey.ShaderKey.UseRaytrace = gl_light_shadows >= 2;
|
||||
pipelineKey.ShaderKey.UseRaytracePrecise = gl_light_shadows >= 3;
|
||||
pipelineKey.ShaderKey.PreciseMidtextureTrace = gl_precise_midtextures_trace;
|
||||
pipelineKey.ShaderKey.ShadowmapFilter = std::clamp(int(gl_light_shadow_filter), 0, 15);
|
||||
|
||||
pipelineKey.ShaderKey.Layout.GBufferPass = mRenderTarget.DrawBuffers > 1;
|
||||
|
|
|
|||
|
|
@ -1070,7 +1070,6 @@ OptionMenu "LightOptions" protected
|
|||
Option "$GLLIGHTMNU_LIGHTSHADOWS", gl_light_shadows, "ShadowMode"
|
||||
Option "$GLLIGHTMNU_LIGHTSHADOWFILTER", gl_light_shadow_filter, "ShadowFilter"
|
||||
Option "$GLLIGHTMNU_LIGHTSHADOWMAPQUALITY", gl_shadowmap_quality, "ShadowMapQuality"
|
||||
Option "$GLLIGHTMNU_PRECISEMIDTEXTRACE", gl_precise_midtextures_trace, "YesNo"
|
||||
StaticText " "
|
||||
Option "$GLPREFMNU_SWLMBANDED", gl_bandedswlight, "OnOff"
|
||||
Option "$GLPREFMNU_FOGFORCEFULLBRIGHT", gl_brightfog, "YesNo"
|
||||
|
|
|
|||
|
|
@ -15,97 +15,23 @@ float TraceDynLightRay(vec3 origin, float tmin, vec3 direction, float dist)
|
|||
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
TraceResult result;
|
||||
SurfaceInfo surface;
|
||||
if (PRECISE_MIDTEXTURES)
|
||||
{
|
||||
bool skip = true;
|
||||
TraceResult result = TraceFirstHit(origin, tmin, direction, dist);
|
||||
|
||||
{
|
||||
TraceResult frontResult = TraceFirstHit(origin, tmin, direction, dist);
|
||||
TraceResult backResult = TraceFirstHitReverse(origin, tmin, direction, dist);
|
||||
|
||||
if(frontResult.primitiveIndex != -1 && backResult.primitiveIndex != -1)
|
||||
{
|
||||
//both hit
|
||||
SurfaceInfo frontSurface = GetSurface(frontResult.primitiveIndex);
|
||||
SurfaceInfo backSurface = GetSurface(backResult.primitiveIndex);
|
||||
|
||||
bool frontFacing = TraceHitIsFacing(origin + direction * frontResult.t, frontSurface);
|
||||
bool backFacing = TraceHitIsFacing(origin + direction * backResult.t, backSurface);
|
||||
// Stop if we hit nothing - the point light is visible.
|
||||
if (result.primitiveIndex == -1)
|
||||
return alpha;
|
||||
|
||||
if(frontFacing && frontFacing == backFacing)
|
||||
{
|
||||
skip = false;
|
||||
if(frontResult.t < backResult.t)
|
||||
{
|
||||
result = frontResult;
|
||||
surface = frontSurface;
|
||||
}
|
||||
else
|
||||
{
|
||||
result = backResult;
|
||||
surface = backSurface;
|
||||
}
|
||||
}
|
||||
else if(backFacing)
|
||||
{
|
||||
skip = false;
|
||||
result = backResult;
|
||||
surface = backSurface;
|
||||
}
|
||||
else
|
||||
{
|
||||
skip = !frontFacing;
|
||||
result = frontResult;
|
||||
surface = frontSurface;
|
||||
}
|
||||
}
|
||||
else if(frontResult.primitiveIndex != -1)
|
||||
{
|
||||
result = frontResult;
|
||||
surface = GetSurface(frontResult.primitiveIndex);
|
||||
skip = TraceHitIsFacing(origin + direction * result.t, surface);
|
||||
}
|
||||
else if(backResult.primitiveIndex != -1)
|
||||
{
|
||||
result = backResult;
|
||||
surface = GetSurface(backResult.primitiveIndex);
|
||||
skip = TraceHitIsFacing(origin + direction * result.t, surface);
|
||||
}
|
||||
else
|
||||
{
|
||||
// neither hit
|
||||
return alpha;
|
||||
}
|
||||
}
|
||||
|
||||
if(!skip)
|
||||
{
|
||||
alpha = PassRayThroughSurfaceDynLight(surface, GetSurfaceUV(result.primitiveIndex, result.primitiveWeights), alpha);
|
||||
|
||||
// Stop if there is no light left
|
||||
if (alpha <= 0.0)
|
||||
return 0.0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
result = TraceFirstHit(origin, tmin, direction, dist);
|
||||
|
||||
// Stop if we hit nothing - the point light is visible.
|
||||
if (result.primitiveIndex == -1)
|
||||
return alpha;
|
||||
|
||||
surface = GetSurface(result.primitiveIndex);
|
||||
SurfaceInfo surface = GetSurface(result.primitiveIndex);
|
||||
|
||||
// Pass through surface texture
|
||||
alpha = PassRayThroughSurfaceDynLight(surface, GetSurfaceUV(result.primitiveIndex, result.primitiveWeights), alpha);
|
||||
if (surface.Sky > 0.0)
|
||||
return alpha;
|
||||
|
||||
// Pass through surface texture
|
||||
alpha = PassRayThroughSurfaceDynLight(surface, GetSurfaceUV(result.primitiveIndex, result.primitiveWeights), alpha);
|
||||
|
||||
// Stop if there is no light left
|
||||
if (alpha <= 0.0)
|
||||
return 0.0;
|
||||
}
|
||||
// Stop if there is no light left
|
||||
if (alpha <= 0.0)
|
||||
return 0.0;
|
||||
|
||||
// Move to surface hit point
|
||||
origin += direction * result.t;
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
#define SK1_USE_SHADOWMAP (1 << 12)
|
||||
#define SK1_USE_RAYTRACE (1 << 13)
|
||||
#define SK1_USE_RAYTRACE_PRECISE (1 << 14)
|
||||
#define SK1_PRECISE_MIDTEXTURES (1 << 15)
|
||||
|
||||
#define SK1_SHADOWMAP_FILTER (15 << 16)
|
||||
#define SK1_FOG_BEFORE_LIGHTS (1 << 20)
|
||||
#define SK1_FOG_AFTER_LIGHTS (1 << 21)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue