mirror of
https://github.com/stevenrobertson/cuburn.git
synced 2025-02-05 11:40:04 -05:00
Gaussian dither
This commit is contained in:
parent
18ca9cf2f9
commit
702e303509
@ -112,10 +112,16 @@ void iter(mwc_st *msts, iter_info *infos, float4 *accbuf, float *denbuf) {
|
|||||||
'cp.camera_transform', 'cam')}}
|
'cp.camera_transform', 'cam')}}
|
||||||
{{endif}}
|
{{endif}}
|
||||||
|
|
||||||
float ditherwidth = {{packer.get('0.5 * cp.spatial_filter_radius')}};
|
// TODO: verify that constants get premultiplied
|
||||||
float ditherx = mwc_next_11(&rctx) * ditherwidth;
|
float ditherwidth = {{packer.get('0.33 * cp.spatial_filter_radius')}};
|
||||||
float dithery = mwc_next_11(&rctx) * ditherwidth;
|
float u0 = mwc_next_01(&rctx);
|
||||||
|
float r = ditherwidth * sqrt(-2.0f * log2f(u0) / M_LOG2E);
|
||||||
|
|
||||||
|
// TODO: provide mwc_next_0_2pi()
|
||||||
|
float u1 = 2.0f * M_PI * mwc_next_01(&rctx);
|
||||||
|
|
||||||
|
float ditherx = r * cos(u1);
|
||||||
|
float dithery = r * sin(u1);
|
||||||
int ix = trunca(cx+ditherx), iy = trunca(cy+dithery);
|
int ix = trunca(cx+ditherx), iy = trunca(cy+dithery);
|
||||||
|
|
||||||
if (ix < 0 || ix >= {{features.acc_width}} ||
|
if (ix < 0 || ix >= {{features.acc_width}} ||
|
||||||
|
Loading…
Reference in New Issue
Block a user