diff options
author | Kae <80987908+Novaenia@users.noreply.github.com> | 2024-03-19 18:21:54 +1100 |
---|---|---|
committer | Kae <80987908+Novaenia@users.noreply.github.com> | 2024-03-19 18:21:54 +1100 |
commit | 983bb82a96707ae81be5c35e7f9af700ade7d77e (patch) | |
tree | 7594648ca829fc8b4c958d02f86b9cc22b04f5d7 /assets/opensb/rendering | |
parent | 17ea975970d8f2be994bb1c8e7646f9c8a6c4647 (diff) |
Async lighting improvements
Diffstat (limited to 'assets/opensb/rendering')
-rw-r--r-- | assets/opensb/rendering/effects/world.config | 5 | ||||
-rw-r--r-- | assets/opensb/rendering/effects/world.frag | 14 |
2 files changed, 1 insertions, 18 deletions
diff --git a/assets/opensb/rendering/effects/world.config b/assets/opensb/rendering/effects/world.config index 188b727..68b84fa 100644 --- a/assets/opensb/rendering/effects/world.config +++ b/assets/opensb/rendering/effects/world.config @@ -30,11 +30,6 @@ "textureSizeUniform" : "lightMapSize", "textureAddressing" : "clamp", "textureFiltering" : "linear" - }, - "tileLightMap" : { - "textureUniform" : "tileLightMap", - "textureAddressing" : "clamp", - "textureFiltering" : "linear" } }, diff --git a/assets/opensb/rendering/effects/world.frag b/assets/opensb/rendering/effects/world.frag index b4450ad..10bd1ad 100644 --- a/assets/opensb/rendering/effects/world.frag +++ b/assets/opensb/rendering/effects/world.frag @@ -6,9 +6,7 @@ uniform sampler2D texture2; uniform sampler2D texture3; uniform bool lightMapEnabled; uniform vec2 lightMapSize; -uniform vec2 tileLightMapSize; uniform sampler2D lightMap; -uniform sampler2D tileLightMap; uniform float lightMapMultiplier; varying vec2 fragmentTextureCoordinate; @@ -55,16 +53,6 @@ vec4 bicubicSample(sampler2D texture, vec2 texcoord, vec2 texscale) { mix(sample1, sample0, sx), sy); } -vec3 sampleLightMap(vec2 texcoord, vec2 texscale) { - vec4 b = bicubicSample(tileLightMap, texcoord, texscale); - vec4 a = bicubicSample(lightMap, texcoord, texscale); - - if (b.z <= 0.0) - return a.rgb; - - return mix(a.rgb, b.rgb / b.z, b.z); -} - void main() { vec4 texColor; if (fragmentTextureIndex > 2.9) { @@ -84,6 +72,6 @@ void main() { if (texColor.a == 0.99607843137) finalColor.a = fragmentColor.a; else if (lightMapEnabled && finalLightMapMultiplier > 0.0) - finalColor.rgb *= sampleLightMap(fragmentLightMapCoordinate, 1.0 / lightMapSize) * finalLightMapMultiplier; + finalColor.rgb *= bicubicSample(lightMap, fragmentLightMapCoordinate, 1.0 / lightMapSize).rgb * finalLightMapMultiplier; gl_FragColor = finalColor; }
\ No newline at end of file |