On 04/09/2016 at 07:27, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 14+
Platform: Windows ; Mac ; Mac OSX ;
Language(s) : C++ ;
---------
Hi,
I am trying to blend 2 textures in shader output, according to a noise function.
I am getting the bitmap textures from shaderlinks.
This is the blending code that I am using inside the shader output:
Real noise = Turbulence(cd->vd->p/500, 0, 3, FALSE);
if (shaderA) colorA = shaderA->Sample(cd);
if (shaderB) colorB = shaderB->Sample(cd);
result = Mix(colorA , colorB , noise);
return result;
The result that I get is grainy when the noise < 1, resulting in a grainy, jittery render. It's as if each point is sampled twice, instead of once, and the result is different every frame. So my method is obviously wrong.
The question is, what is the proper way to mix 2 textures according to a noise (or any other) function, in the OUTPUT of a shader?