Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python 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

    c4d Noise random seed

    Scheduled Pinned Locked Moved PYTHON Development
    6 Posts 0 Posters 563 Views
    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.
    • H Offline
      Helper
      last edited by

      THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

      On 11/02/2012 at 14:26, xxxxxxxx wrote:

      I am following this example form the sdk :

      import c4d
      from c4d.utils.noise import C4DNoise
      from c4d import bitmaps
        
      for i in range (1) :
          width = 256
          height = 256
          noisetype = c4d.NOISE_WAVY_TURB
          bmp =  bitmaps.BaseBitmap()
          bmp.Init(width, height, 24)
        
          p = C4DNoise(int(646))
          p.InitFbm(21, 2.1, 0.5)
        
          rw = float(width-1)
          rh = float(height-1)
        
          t = float(i*0.04)
          for x in xrange(width) :
              for y in xrange(height) :
                  r = p.Noise(noisetype, False, c4d.Vector(x/rw, y/rh, 0) * 7, time = t , octaves=2)
                  o = 255.0*r
                  if o<0: o=0
                  elif o>255: o=255
        
                  bmp[x, y] = (o, o, o)
        
          bitmaps.ShowBitmap(bmp)
      

      shouldn't the int in  p = C4DNoise(int(646)) change the bitmap result ? the seed value seems
      to have no influence at all. just to clarify, i want to change the seed of my noise 🙂

      the compiler returns this warning after execution :

       _FILEPATH_ :26: DeprecationWarning: integer argument expected, got float
        kZE_OdÚ'_Ç®_M_%P_o_ôDqI__I__Y
      
      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

        On 11/02/2012 at 14:42, xxxxxxxx wrote:

        I could swear I once posted this bug in the BugReports section, but I just can't find it.
        Yes it does not affect the noise which seems to be a bug, unfortunately. If you do not necessarily need the different noises, you could also use the random module.

        import random   
        random.seed(my_seed)   
        print random.random()
        

        Just to clarify, Python isn't compiled 🙂
        However, that kZE_OdÚ'_Ç®_M_%P_o_ôDqI__I__Y is strange. 😠

        Cheers,
        -Niklas

        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

          THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

          On 11/02/2012 at 15:10, xxxxxxxx wrote:

          ah found it, should have used the search function first, mea culpa.

          https://developers.maxon.net/forum/topic/5847/5909_py4d--c4dnoise-seed&KW=noise

          to your suggestion - i know the python random function but i do not really understand
          what you do suggest ? i want to use  the c4dNoise class to replace the standard
          c4d.utils.noise in our tp_xpresso_pyhton thingie setups. so pure random won't help.

          but offsetting the input vector as a seed workarround sounds like a smart solution.
          at least it will let your create some vectors.

          thanks for your help 🙂

          1 Reply Last reply Reply Quote 0
          • H Offline
            Helper
            last edited by

            THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

            On 11/02/2012 at 15:18, xxxxxxxx wrote:

            Lol, why didn't I find my own post? I really searched for it 😉

            Well, after using random.sees([x]) function, values returned by random.random() are not "real random" any more. If you do not need the C4DNoise class for texturing or simiar (sth. where the "physics" of the noise really care) you can use the random-module instead. (e.g. random values for clones or alike, nobody will care if that offset came from a nice noisy texture or the random-module).

            Cheers,
            -Niklas

            1 Reply Last reply Reply Quote 0
            • H Offline
              Helper
              last edited by

              THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

              On 13/02/2012 at 02:16, xxxxxxxx wrote:

              Originally posted by xxxxxxxx

              the compiler returns this warning after execution :

              _FILEPATH_ :26: DeprecationWarning: integer argument expected, got float
              

              To not get this warning, change this (line 22) :

              o = 255.0*r
              

              with

              o = int(255.0*r)
              

              This error will be corrected in the next update of the documentation.

              1 Reply Last reply Reply Quote 0
              • H Offline
                Helper
                last edited by

                THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                On 13/02/2012 at 16:26, xxxxxxxx wrote:

                ah,

                thanks, did this (i  think the proterm is casting, isn't it ?) with the random seed, because
                i thought it matters that the seed is specificly int, but i don't really get it why i have to
                do this here. r is float and you multiply it with an int (255).  i thought the advantage of
                a type free language is that you do not have to think about things like this ?

                nevertheless might it be possible to get also an answer on my question regarding 
                gvoperatordata iny pyhton - is it possible to write custom xpresso nodes in python ?

                https://developers.maxon.net/forum/topic/6236/6586_gvoperatordata-in-python-

                thanks for your help 🙂

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