Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    getting 3D noise values

    Cinema 4D SDK
    python
    3
    4
    1.2k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • R
      ruckzuck
      last edited by

      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 value

      Cheers

      1 Reply Last reply Reply Quote 0
      • eZioPanE
        eZioPan
        last edited by eZioPan

        Hi @ruckzuck ,

        Please check this document:

        c4d.utils.noise.C4DNoise

        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.

        R 1 Reply Last reply Reply Quote 2
        • S
          s_bach
          last edited by

          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

          MAXON SDK Specialist

          Development Blog, MAXON Registered Developer

          1 Reply Last reply Reply Quote 3
          • R
            ruckzuck @eZioPan
            last edited by

            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

            1 Reply Last reply Reply Quote 0
            • First post
              Last post