I need to 'distort' individual pixels inside a compute shader node of an Unreal material. Specifically, the pseudocode for this per-pixel operation looks as follows.
pol = // analyze the pixel values here to output either +1 or -1
C = (pol > 0) ? Cp : Cm;
sigma_C = (pol > 0) ? sigma_Cp : sigma_Cm;
if(sigma_C > 0)
{
C += sampleNormalDistribution(0, sigma_C); // zero-mean normal distribution
}
How can I sample from a normal distribution through HLSL to achieve this?
Aucun commentaire:
Enregistrer un commentaire