You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
369 lines
8.2 KiB
Plaintext
369 lines
8.2 KiB
Plaintext
10 months ago
|
#pragma once
|
||
|
|
||
|
// Poisson Disk sample positions
|
||
|
static const float2 PoissonDisk64[64] =
|
||
|
{
|
||
|
{0.0, 0.0},
|
||
|
{-0.613392, 0.617481},
|
||
|
{0.170019, -0.040254},
|
||
|
{-0.299417, 0.791925},
|
||
|
{0.645680, 0.493210},
|
||
|
{-0.651784, 0.717887},
|
||
|
{0.421003, 0.027070},
|
||
|
{-0.817194, -0.271096},
|
||
|
{-0.705374, -0.668203},
|
||
|
{0.977050, -0.108615},
|
||
|
{0.063326, 0.142369},
|
||
|
{0.203528, 0.214331},
|
||
|
{-0.667531, 0.326090},
|
||
|
{-0.098422, -0.295755},
|
||
|
{-0.885922, 0.215369},
|
||
|
{0.566637, 0.605213},
|
||
|
{0.039766, -0.396100},
|
||
|
{0.751946, 0.453352},
|
||
|
{0.078707, -0.715323},
|
||
|
{-0.075838, -0.529344},
|
||
|
{0.724479, -0.580798},
|
||
|
{0.222999, -0.215125},
|
||
|
{-0.467574, -0.405438},
|
||
|
{-0.248268, -0.814753},
|
||
|
{0.354411, -0.887570},
|
||
|
{0.175817, 0.382366},
|
||
|
{0.487472, -0.063082},
|
||
|
{-0.084078, 0.898312},
|
||
|
{0.488876, -0.783441},
|
||
|
{0.470016, 0.217933},
|
||
|
{-0.696890, -0.549791},
|
||
|
{-0.149693, 0.605762},
|
||
|
{0.034211, 0.979980},
|
||
|
{0.503098, -0.308878},
|
||
|
{-0.016205, -0.872921},
|
||
|
{0.385784, -0.393902},
|
||
|
{-0.146886, -0.859249},
|
||
|
{0.643361, 0.164098},
|
||
|
{0.634388, -0.049471},
|
||
|
{-0.688894, 0.007843},
|
||
|
{0.464034, -0.188818},
|
||
|
{-0.440840, 0.137486},
|
||
|
{0.364483, 0.511704},
|
||
|
{0.034028, 0.325968},
|
||
|
{0.099094, -0.308023},
|
||
|
{0.693960, -0.366253},
|
||
|
{0.678884, -0.204688},
|
||
|
{0.001801, 0.780328},
|
||
|
{0.145177, -0.898984},
|
||
|
{0.062655, -0.611866},
|
||
|
{0.315226, -0.604297},
|
||
|
{-0.780145, 0.486251},
|
||
|
{-0.371868, 0.882138},
|
||
|
{0.200476, 0.494430},
|
||
|
{-0.494552, -0.711051},
|
||
|
{0.612476, 0.705252},
|
||
|
{-0.578845, -0.768792},
|
||
|
{-0.772454, -0.090976},
|
||
|
{0.504440, 0.372295},
|
||
|
{0.155736, 0.065157},
|
||
|
{0.391522, 0.849605},
|
||
|
{-0.620106, -0.328104},
|
||
|
{0.789239, -0.419965},
|
||
|
{-0.545396, 0.538133},
|
||
|
// {-0.178564, -0.596057},
|
||
|
};
|
||
|
|
||
|
// Poisson Disk sample positions
|
||
|
static const float2 PoissonDisk256[256] =
|
||
|
{
|
||
|
{0.0, 0.0},
|
||
|
{0.201831,-0.206817},
|
||
|
{0.857496,0.272746},
|
||
|
{-0.187503,0.605156},
|
||
|
{-0.416242,-0.351588},
|
||
|
{-0.895393,0.413806},
|
||
|
{-0.723454,0.055031},
|
||
|
{-0.470912,0.800247},
|
||
|
{-0.586173,-0.339482},
|
||
|
{0.162912,-0.502638},
|
||
|
{0.162941,-0.123341},
|
||
|
{0.361659,0.267284},
|
||
|
{0.403121,0.118606},
|
||
|
{0.301263,-0.210103},
|
||
|
{-0.739004,-0.218741},
|
||
|
{0.472062,-0.37983},
|
||
|
{-0.978135,-0.105582},
|
||
|
{-0.05923,-0.266228},
|
||
|
{0.644061,-0.072531},
|
||
|
{-0.365833,-0.007062},
|
||
|
{0.518375,-0.038047},
|
||
|
{0.752662,0.01173},
|
||
|
{-0.426705,0.095247},
|
||
|
{-0.13555,-0.440492},
|
||
|
{0.880471,-0.337994},
|
||
|
{0.01657,0.361167},
|
||
|
{-0.051918,0.007473},
|
||
|
{0.427612,-0.752434},
|
||
|
{-0.179583,-0.263828},
|
||
|
{-0.136597,0.099981},
|
||
|
{0.314113,-0.109243},
|
||
|
{0.199352,-0.852254},
|
||
|
{0.936842,0.065325},
|
||
|
{-0.178775,0.306935},
|
||
|
{-0.280718,-0.125331},
|
||
|
{-0.643188,0.366312},
|
||
|
{-0.314381,0.258232},
|
||
|
{0.287573,0.530133},
|
||
|
{-0.692479,0.285856},
|
||
|
{0.18313,0.63479},
|
||
|
{0.122202,0.903619},
|
||
|
{-0.493751,0.16395},
|
||
|
{-0.357456,0.165943},
|
||
|
{-0.084838,0.181531},
|
||
|
{0.423114,0.028883},
|
||
|
{-0.318249,-0.693755},
|
||
|
{0.579987,-0.73339},
|
||
|
{-0.13253,-0.984469},
|
||
|
{-0.79784,-0.42642},
|
||
|
{-0.151694,0.489457},
|
||
|
{0.429271,0.341555},
|
||
|
{-0.260269,0.691643},
|
||
|
{0.504145,0.131153},
|
||
|
{0.779375,0.345444},
|
||
|
{0.57773,0.062006},
|
||
|
{-0.037774,-0.910143},
|
||
|
{0.677565,-0.46263},
|
||
|
{0.431646,-0.060776},
|
||
|
{-0.221471,-0.93614},
|
||
|
{0.029345,0.539159},
|
||
|
{-0.152274,-0.671918},
|
||
|
{-0.208263,0.187007},
|
||
|
{-0.091659,0.716578},
|
||
|
{-0.383439,0.403722},
|
||
|
{0.04065,0.827583},
|
||
|
{0.061666,0.151981},
|
||
|
{0.460813,-0.480045},
|
||
|
{0.104825,-0.685303},
|
||
|
{-0.31538,-0.602707},
|
||
|
{0.160934,-0.294777},
|
||
|
{0.887944,0.413856},
|
||
|
{0.210217,-0.602392},
|
||
|
{-0.685118,-0.712948},
|
||
|
{-0.591641,-0.642552},
|
||
|
{0.197412,0.770526},
|
||
|
{0.755988,0.148273},
|
||
|
{-0.266268,0.051394},
|
||
|
{-0.286376,-0.353044},
|
||
|
{-0.382379,-0.0981},
|
||
|
{-0.19213,0.800699},
|
||
|
{0.559494,-0.404643},
|
||
|
{0.678788,0.421512},
|
||
|
{-0.963281,0.210767},
|
||
|
{-0.592594,-0.735566},
|
||
|
{0.040772,-0.473333},
|
||
|
{-0.117332,-0.826573},
|
||
|
{0.310146,-0.580783},
|
||
|
{0.698835,-0.565382},
|
||
|
{0.873749,-0.476573},
|
||
|
{0.137678,0.086004},
|
||
|
{0.53196,0.736058},
|
||
|
{0.792228,-0.14239},
|
||
|
{-0.276933,0.883928},
|
||
|
{-0.736969,-0.313723},
|
||
|
{-0.727352,0.593695},
|
||
|
{-0.102067,0.841333},
|
||
|
{-0.483281,0.356904},
|
||
|
{-0.690074,-0.566776},
|
||
|
{-0.616491,0.759741},
|
||
|
{0.332892,0.647045},
|
||
|
{0.053142,-0.156524},
|
||
|
{-0.768858,0.180945},
|
||
|
{-0.497971,0.445299},
|
||
|
{-0.818,-0.104065},
|
||
|
{0.215856,0.36323},
|
||
|
{-0.826259,0.27728},
|
||
|
{-0.540964,0.568164},
|
||
|
{0.388453,-0.342334},
|
||
|
{0.187835,0.501372},
|
||
|
{0.867952,-0.213804},
|
||
|
{0.708402,0.231059},
|
||
|
{0.306361,-0.01605},
|
||
|
{0.773875,-0.421648},
|
||
|
{-0.900915,-0.267752},
|
||
|
{-0.033362,0.957757},
|
||
|
{0.681506,-0.296654},
|
||
|
{0.105523,-0.575122},
|
||
|
{-0.448871,0.257553},
|
||
|
{-0.652859,-0.278522},
|
||
|
{0.107153,0.717232},
|
||
|
{-0.70892,-0.113331},
|
||
|
{-0.458818,-0.151908},
|
||
|
{-0.265307,0.452636},
|
||
|
{-0.50409,-0.058525},
|
||
|
{0.15197,-0.948215},
|
||
|
{0.502423,-0.682846},
|
||
|
{0.230074,0.167101},
|
||
|
{-0.627005,-0.490066},
|
||
|
{0.072557,0.981297},
|
||
|
{0.582593,0.513682},
|
||
|
{-0.830161,-0.339207},
|
||
|
{-0.323269,-0.512178},
|
||
|
{0.389569,0.732203},
|
||
|
{0.452894,-0.578546},
|
||
|
{-0.749949,-0.637502},
|
||
|
{0.662696,0.028902},
|
||
|
{0.971269,-0.207202},
|
||
|
{0.900839,-0.022344},
|
||
|
{-0.058329,0.434121},
|
||
|
{0.478238,-0.860509},
|
||
|
{-0.554517,-0.548521},
|
||
|
{-0.667144,0.189137},
|
||
|
{0.095216,0.458629},
|
||
|
{0.269951,0.288897},
|
||
|
{0.83622,0.092869},
|
||
|
{0.770783,-0.275776},
|
||
|
{0.164705,-0.385181},
|
||
|
{-0.343724,0.626858},
|
||
|
{-0.453456,0.595952},
|
||
|
{-0.897829,-0.148863},
|
||
|
{0.010253,0.705469},
|
||
|
{-0.348942,-0.797578},
|
||
|
{0.555481,-0.291888},
|
||
|
{0.118707,0.328242},
|
||
|
{0.269035,-0.917959},
|
||
|
{-0.139283,-0.181833},
|
||
|
{0.154863,-0.027398},
|
||
|
{-0.424371,-0.46681},
|
||
|
{0.512259,0.858147},
|
||
|
{-0.852948,-0.503923},
|
||
|
{0.669483,-0.737988},
|
||
|
{-0.913278,-0.027771},
|
||
|
{-0.241322,-0.037337},
|
||
|
{0.586203,-0.544609},
|
||
|
{-0.505756,-0.288042},
|
||
|
{-0.397923,-0.228158},
|
||
|
{0.127997,-0.79205},
|
||
|
{0.369368,0.431756},
|
||
|
{-0.420669,0.890195},
|
||
|
{-0.459881,-0.816277},
|
||
|
{-0.561498,0.299785},
|
||
|
{0.071751,-0.248652},
|
||
|
{-0.011457,-0.998302},
|
||
|
{-0.674525,-0.398308},
|
||
|
{0.847162,0.497413},
|
||
|
{0.463661,-0.162335},
|
||
|
{0.344975,-0.681166},
|
||
|
{0.785004,-0.512665},
|
||
|
{0.883098,-0.111289},
|
||
|
{0.627726,-0.63564},
|
||
|
{-0.579576,-0.113879},
|
||
|
{-0.764785,0.344735},
|
||
|
{0.760114,0.522722},
|
||
|
{-0.369159,-0.891257},
|
||
|
{-0.657272,-0.039401},
|
||
|
{0.447229,0.223605},
|
||
|
{0.885342,0.173692},
|
||
|
{0.257983,-0.350891},
|
||
|
{-0.020933,0.102441},
|
||
|
{-0.059253,-0.688386},
|
||
|
{-0.979011,0.067452},
|
||
|
{0.053726,-0.924242},
|
||
|
{-0.040387,-0.125634},
|
||
|
{0.156414,0.229646},
|
||
|
{-0.362821,0.793144},
|
||
|
{0.46921,-0.253273},
|
||
|
{0.225932,0.036329},
|
||
|
{0.436179,0.530042},
|
||
|
{0.56045,0.246595},
|
||
|
{0.312774,0.127159},
|
||
|
{-0.408828,0.690232},
|
||
|
{-0.814324,0.004154},
|
||
|
{0.630304,0.719031},
|
||
|
{-0.801651,0.433787},
|
||
|
{-0.140232,0.388463},
|
||
|
{-0.484626,-0.726787},
|
||
|
{-0.116796,-0.057837},
|
||
|
{0.003038,-0.60395},
|
||
|
{-0.068701,0.601077},
|
||
|
{-0.15363,0.983873},
|
||
|
{-0.322771,0.529466},
|
||
|
{0.220748,0.884451},
|
||
|
{0.666189,0.32321},
|
||
|
{0.294533,0.739595},
|
||
|
{-0.179644,0.891372},
|
||
|
{-0.592585,-0.207548},
|
||
|
{0.559402,0.627741},
|
||
|
{0.670165,0.120473},
|
||
|
{-0.016783,-0.379218},
|
||
|
{-0.307317,-0.21695},
|
||
|
{-0.469684,-0.630699},
|
||
|
{-0.40268,-0.571034},
|
||
|
{-0.225429,-0.461274},
|
||
|
{-0.42234,0.494256},
|
||
|
{-0.549883,0.669367},
|
||
|
{-0.631021,0.605051},
|
||
|
{0.073851,0.633436},
|
||
|
{0.267328,0.442737},
|
||
|
{-0.252024,-0.771118},
|
||
|
{-0.535048,0.048638},
|
||
|
{0.012879,-0.767478},
|
||
|
{0.076943,-0.365247},
|
||
|
{-0.904975,-0.407722},
|
||
|
{0.577832,-0.150833},
|
||
|
{-0.180796,-0.583402},
|
||
|
{0.051117,-0.026034},
|
||
|
{-0.59775,0.120319},
|
||
|
{-0.935376,0.300276},
|
||
|
{-0.700589,0.492607},
|
||
|
{0.325319,0.881039},
|
||
|
{-0.075864,0.292461},
|
||
|
{-0.113051,-0.338576},
|
||
|
{0.000052,0.219904},
|
||
|
{0.307151,-0.810112},
|
||
|
{0.349866,-0.440253},
|
||
|
{0.677038,0.556809},
|
||
|
{-0.274906,0.340499},
|
||
|
{0.430692,0.626748},
|
||
|
{0.244626,-0.440119},
|
||
|
{-0.600218,0.458129},
|
||
|
{0.692425,-0.170823},
|
||
|
{-0.860862,0.138738},
|
||
|
{-0.535037,-0.418377},
|
||
|
{0.533566,0.394974},
|
||
|
{0.256947,-0.718212},
|
||
|
{-0.077482,-0.521145},
|
||
|
};
|
||
|
|
||
|
float Remap(float value, float oldmin, float oldmax, float newmin, float newmax)
|
||
|
{
|
||
|
return newmin + (((value - oldmin) / ( oldmax - oldmin )) * ( newmax - newmin ));
|
||
|
}
|
||
|
|
||
|
float2 VogelDiskSample(int sampleIndex, int samplesCount, float phi)
|
||
|
{
|
||
|
float GoldenAngle = 2.4f;
|
||
|
|
||
|
float r = sqrt(sampleIndex + 0.5f) / sqrt(samplesCount);
|
||
|
float theta = sampleIndex * GoldenAngle + phi;
|
||
|
|
||
|
float sine, cosine;
|
||
|
sincos(theta, sine, cosine);
|
||
|
|
||
|
return float2(r * cosine, r * sine);
|
||
|
}
|
||
|
|
||
|
float InterleavedGradientNoise(float2 position_screen)
|
||
|
{
|
||
|
float3 magic = float3(0.06711056f, 0.00583715f, 52.9829189f);
|
||
|
return frac(magic.z * frac(dot(position_screen, magic.xy)));
|
||
|
}
|
||
|
|
||
|
float3 DrawCircleTest(float2 UV, float2 Origin, float Size)
|
||
|
{
|
||
|
float3 CircleMask = float3(0.,0.,0.);
|
||
|
|
||
|
if (length(Origin - UV) < Size)
|
||
|
{
|
||
|
CircleMask = float3(1.,1.,1.);
|
||
|
}
|
||
|
|
||
|
return CircleMask;
|
||
|
}
|