mirror of
https://git.triforceproject.com/triforce/source
synced 2026-11-27 19:48:49 -04:00
Triforce v0.8.4
Smoother frames and less memory: a compact pipeline cache on NVIDIA, the renderer and game-code profiles, native float in the hot game code, late GPU work left as before. A PC whose NVIDIA shader cache drops the game's gets a driver cache folder of its own. Fixes from the 0.8.3 reports: RenoDX's encoder and tone mapping matched on NVIDIA again; the out-of-memory notice at the next start; no microphone open without a recording device; Evil HD undergrowth kept to 80/120 m; the FG HUD layer keeps what it learned; a stick past 92% is a full push; the DualSense jack read only when used; Linux Save Select, Quit and Restart, and the Linux launcher's sound; the update check uses the program's own version.
This commit is contained in:
@@ -68,11 +68,20 @@ void main() {
|
||||
const float r2 = radius * radius;
|
||||
float occluded = 0.0;
|
||||
vec3 bounce = vec3(0.0);
|
||||
// ((Triforce, 11-25, a player's report "Ambient Occlusion in fog") how much the picture itself varies around the pixel: its
|
||||
// brightness here and at the samples' points, lowest and highest. The game's fog is already in the picture this takes, and
|
||||
// fog (or a room the game keeps dark) makes it nearly flat: the creases the occlusion finds there are ones the fog hides, and
|
||||
// drawn over it they showed the rock through a foggy cave. Where the picture is that flat the occlusion fades out
|
||||
const vec3 luma_w = vec3(0.2126, 0.7152, 0.0722);
|
||||
float lo = dot(texelFetch(src, c, 0).rgb, luma_w), hi = lo;
|
||||
for (int i = 0; i < kSamples; i++) {
|
||||
const float t = (float(i) + 0.5) / float(kSamples);
|
||||
const float angle = 6.2831853 * (t * kTurns + noise);
|
||||
const vec2 offset = vec2(cos(angle), sin(angle)) * (px * t);
|
||||
const ivec2 q = c + ivec2(round(offset));
|
||||
const vec3 seen = texelFetch(src, clamp(q, ivec2(0), pc.size - 1), 0).rgb;
|
||||
const float y = dot(seen, luma_w);
|
||||
lo = min(lo, y), hi = max(hi, y);
|
||||
const vec3 v = view_at(q) - p;
|
||||
const float vv = dot(v, v);
|
||||
if (vv < 1e-8) continue;
|
||||
@@ -84,13 +93,16 @@ void main() {
|
||||
const float near_share = smoothstep(0.15 * radius, 0.4 * radius, sqrt(vv));
|
||||
const float w = clamp((cosine - 0.25) / 0.75, 0.0, 1.0) * clamp(1.0 - vv / r2, 0.0, 1.0) * near_share;
|
||||
occluded += w;
|
||||
bounce += w * texelFetch(src, clamp(q, ivec2(0), pc.size - 1), 0).rgb;
|
||||
bounce += w * seen;
|
||||
}
|
||||
// (the spread as a share of the brightest, and 0.05 more: a dark place's small differences count as flat too)
|
||||
const float contrast = (hi - lo) / (hi + 0.05);
|
||||
const float not_flat = smoothstep(0.04, 0.16, contrast);
|
||||
// (never darker than kFloor: a corner keeps some light, and what goes wrong (a fringe, a clump) cannot turn black)
|
||||
const float kFloor = 0.5;
|
||||
float ao = clamp(1.0 - pc.k.y * occluded / float(kSamples), kFloor, 1.0);
|
||||
ao = mix(ao, 1.0, smoothstep(0.6 * far, far, p.z));
|
||||
ao = mix(1.0, ao, smooth_here);
|
||||
const float keep = smooth_here * (1.0 - smoothstep(0.6 * far, far, p.z));
|
||||
ao = mix(1.0, ao, smooth_here * not_flat);
|
||||
const float keep = smooth_here * not_flat * (1.0 - smoothstep(0.6 * far, far, p.z));
|
||||
imageStore(ao_out, c, vec4(bounce / float(kSamples) * keep, ao));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user