Skip to content

Commit

Permalink
postfx: dof fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
qreeves committed Aug 23, 2024
1 parent f10dbc8 commit ed70059
Showing 1 changed file with 19 additions and 11 deletions.
30 changes: 19 additions & 11 deletions config/glsl/hud.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ hudglass = [
curdepth = dot(gfetch(tex7, texcoord0 * glassdepth.xy).rgb, gdepthunpackparams);
vec3 focuspos = (linearworldmatrix * vec4(focusdepth * glasssize.xy * 0.5, focusdepth, 1.0)).xyz,
curpos = (linearworldmatrix * vec4(curdepth * texcoord0, curdepth, 1.0)).xyz;
float curoffset = distance(focuspos, curpos) - glassfocus.z;
float curoffset = abs(distance(focuspos, curpos) - glassfocus.z);

glassamt += clamp(curoffset * glassfocus.w, glassfocus.x, glassfocus.y) * dist;
]])
Expand Down Expand Up @@ -477,24 +477,32 @@ huddepth = [
] [
@(gfetchdefs [refractdepth])
])
@(ginterpdepth)

uniform vec3 gdepthpackparams;
varying vec2 texcoord0;

fragdata(0) vec4 fragcolor;

void main(void)
{
@(if (= $gdepthformat 1) [result [
vec3 packdepth = gfetch(refractdepth, texcoord0).rgb;
]] [result [
@(gdepthunpack depth [gfetch(refractdepth, texcoord0)])
@(gpackdepth packdepth depth)
]])

@(? (>= (strstr $arg1 "ref") 0) [
@(gdepthunpack curdepth [gfetch(refractdepth, texcoord0)])
@(gdepthunpack refdepth [gfetch(refractmask, texcoord0)])
if(refdepth != 0.0) curdepth = refdepth;
@(gpackdepth outdepth curdepth)
fragcolor = vec4(outdepth, 0.0);
] [
fragcolor = gfetch(refractdepth, texcoord0);
@(if (= $gdepthformat 1) [result [
vec3 refdepth = gfetch(refractmask, texcoord0).rgb;
]] [result [
@(gdepthunpack rdepth [gfetch(refractmask, texcoord0)])
@(gpackdepth refdepth rdepth)
]])

if(refdepth != vec3(0.0)) packdepth = refdepth;
])


fragcolor = vec4(packdepth, 0.0);
}
]
]
Expand Down

0 comments on commit ed70059

Please sign in to comment.