diff --git a/src/pipe/modules/filmsim/main.comp b/src/pipe/modules/filmsim/main.comp index 2150b4b0..fe6f4719 100644 --- a/src/pipe/modules/filmsim/main.comp +++ b/src/pipe/modules/filmsim/main.comp @@ -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. @@ -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