getting 3D noise values
-
Hi,
is there any way to get the color value of any x/y/z coordinate in a 3D noise space using python ?
Like:
input = vector(x,y,z)
result = color valueCheers
-
Hi @ruckzuck ,
Please check this document:
Here is a sample code:
import c4d from c4d import utils #Welcome to the world of Python def main(): pos = c4d.Vector(0,0,0) # Here is the input seed = 12346 noiseGen = utils.noise.C4DNoise(seed) result = noiseGen.Noise(t=c4d.NOISE_NOISE,two_d=False,p=pos) # Here is the result print(result)
You can then remap result float number into a color using other methods.
-
Hello,
as @eZioPan has shown you can use the C4DNoise class to sample a noise. Additionally, you find further noises in the c4d.utils.noise namespace.
A noise function typically just returns a scalar value. So if you want to create a color you have to combine different noises (with different seeds) or you sample the same noise with different offsets.
Please also make sure to mark your post as a question using our Q&A system.
best wishes,
Sebastian -
Thanks @eziopan and Sebastian for your answers !
So far I searched a way for getting values out of the 3D noise shaders. Starting point was the c4d.BaseShader class but it seems to me that accessing these shaders in order to get noise values is much more cumbersome than using the C4DNoise class and specifying the corresponding noise type as parameter 't' - as @eziopan has pointed out.
So: thank you - problem solved
... and sorry, I haven't read the Q&A system thoroughly enough - next time I will mark my post properly.
cheers, Jens