Skip to content

Commit

Permalink
filmsim: add bandpass/envelope function
Browse files Browse the repository at this point in the history
  • Loading branch information
hanatos committed Mar 2, 2025
1 parent e166012 commit f658fb7
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/pipe/modules/filmsim/main.comp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ int binom(inout uint seed, int n, float p)
#endif
}

float envelope(float w)
{
return smoothstep(380.0, 400.0, w)*(1.0-smoothstep(700.0, 730.0, w));
}

vec3 thorlabs_filters(float w)
{
// this is what looks like it might be a good fit to the thorlabs filters in a plot.
Expand Down Expand Up @@ -212,11 +217,14 @@ void main()
float lambda = 380 + l*10;
// float lambda = 380 + l*10 + mrand(seed)*10;
float val = sigmoid_eval(coeff, lambda);
// not sure if needed: cuts off wavelength ranges that the spectral
// upsampling doesn't care about since it is outside the XYZ support
float env = envelope(lambda);
tc.x = (l+0.5)/256.0;
vec3 log_sensitivity = texture(img_filmsim, tc).rgb;
vec3 sensitivity = pow(vec3(10.0), log_sensitivity);
sensitivity = mix(sensitivity, vec3(0.0), isnan(sensitivity));
raw += sensitivity * val / 40.0; // XXX uh something number of bins * 10nm or something
raw += sensitivity * val * env / 40.0; // XXX uh something number of bins * 10nm or something
}
// TODO: the following two require to split the kernel and blur the intermediates:
// TODO gaussian blur / lens radius
Expand Down

0 comments on commit f658fb7

Please sign in to comment.