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

    Proc Noise into material colour shader

    Scheduled Pinned Locked Moved SDK Help
    9 Posts 0 Posters 885 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 31/12/2010 at 05:17, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   12 
      Platform:      
      Language(s) :       PYTHON  ;

      ---------
      Appreciate a nudge (first steps with python)

      I can create and set a materials colour and check to see if a duplicate exists
         mat_op = c4d.BaseMaterial(c4d.Mmaterial) #create a standard material
          mat_op[c4d.ID_BASELIST_NAME] = "mynewmatname" 
          doc.InsertMaterial(mat_op,pred=None,checknames=True)
        mat_op[c4d.MATERIAL_COLOR_COLOR] = c4d.Vector(.4,.3,.8)

      and texture from a bitmap using a file path

      but cant see how to insert a procedural shader
       p = C4DNoise(1234)
          p.InitFbm(21, 2.1, 0.5)
      mat_op[c4d.MATERIAL_COLOR_SHADER] = p

      or change the mixing method - multiply, add, subtract etc

      any help appreciated

      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 02/01/2011 at 03:00, xxxxxxxx wrote:

        anyone?

        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 02/01/2011 at 07:31, xxxxxxxx wrote:

          Hi C4DNoise cannot be combined with materials. It's used internally in a noise shader but also part of the API so you can determine a noise value manually. Below is a small code snippet how to add a noise shader to the first material in the current active document.

          Unfortunately the noise types are currently not part of the c4d module so you need to define them manually. Just copy them from the following code snippet.

          Cheers, Sebastian

          import c4d
            
          SLA_NOISE_USE_AS_ENV       = 1017  # bool
          SLA_NOISE_PROJECT_ENV      = 1018  # bool
          SLA_NOISE_SEED             = 1024  # int
          SLA_NOISE_NOISE            = 1001  # int
          SLA_NOISE_NOISE_BOX_NOISE  = 2001 
          SLA_NOISE_NOISE_BLIST_TURB = 2002 
          SLA_NOISE_NOISE_BUYA       = 2003 
          SLA_NOISE_NOISE_CELL_NOISE = 2004 
          SLA_NOISE_NOISE_CRANAL     = 2005 
          SLA_NOISE_NOISE_DENTS      = 2006 
          SLA_NOISE_NOISE_DISPL_TURB = 2007 
          SLA_NOISE_NOISE_FBM        = 2008 
          SLA_NOISE_NOISE_HAMA       = 2009 
          SLA_NOISE_NOISE_LUKA       = 2010 
          SLA_NOISE_NOISE_MOD_NOISE  = 2011 
          SLA_NOISE_NOISE_NAKI       = 2012 
          SLA_NOISE_NOISE_NOISE      = 2013 
          SLA_NOISE_NOISE_NUTOUS     = 2014 
          SLA_NOISE_NOISE_OBER       = 2015 
          SLA_NOISE_NOISE_PEZO       = 2016 
          SLA_NOISE_NOISE_POXO       = 2017 
          SLA_NOISE_NOISE_RANDOM     = 2018 
          SLA_NOISE_NOISE_SEMA       = 2019 
          SLA_NOISE_NOISE_STUPL      = 2020 
          SLA_NOISE_NOISE_TURBULENCE = 2021 
          SLA_NOISE_NOISE_VL_NOISE   = 2022 
          SLA_NOISE_NOISE_WAVY_TURB  = 2023 
          SLA_NOISE_NOISE_SEPARATOR  = 3000 
          SLA_NOISE_NOISE_CELL_VORONOI   = 2024 
          SLA_NOISE_NOISE_DISPL_VORONOI  = 2025 
          SLA_NOISE_NOISE_SPARSE_CONV= 2026 
          SLA_NOISE_NOISE_VORONOI_1  = 2027 
          SLA_NOISE_NOISE_VORONOI_2  = 2028 
          SLA_NOISE_NOISE_VORONOI_3  = 2029 
          SLA_NOISE_NOISE_ZADA       = 2030 
          SLA_NOISE_SPACE            = 1022 
          SLA_NOISE_SPACE_UV         = 2099 
          SLA_NOISE_SPACE_TEXTURE    = 2100 
          SLA_NOISE_SPACE_OBJECT     = 2101 
          SLA_NOISE_SPACE_WORLD      = 2102 
          SLA_NOISE_SPACE_CAMERA     = 2103 
          SLA_NOISE_SPACE_SCREEN     = 2104 
          SLA_NOISE_SPACE_RASTER     = 2105 
          SLA_NOISE_GLOBAL_SCALE     = 1002  # float
          SLA_NOISE_SCALE            = 1003  # c4d.Vector
          SLA_NOISE_ANI_SPEED        = 1005  # float
          SLA_NOISE_DETAIL_ATT       = 1006  # float
          SLA_NOISE_OCTAVES          = 1007  # float
          SLA_NOISE_DELTA            = 1008  # float
          XSLANoise                  = 1011116 #for ID
            
          def main() :
            
              mat = doc.GetFirstMaterial()
              if not mat: return True
            
              shd = c4d.BaseList2D(XSLANoise)
              shd[SLA_NOISE_NOISE] =SLA_NOISE_NOISE_BOX_NOISE
            
              mat[c4d.MATERIAL_COLOR_SHADER] = shd
              mat.InsertShader(shd)
              mat.Message(c4d.MSG_UPDATE)
              mat.Update(True, True)
            
              c4d.EventAdd()
            
          main()
            
          
          
          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 02/01/2011 at 08:11, xxxxxxxx wrote:

            Many, many thanks Sebastian.

            These first steps are always tough even though the fog is gradually clearing.

            Much appreciate the 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 02/01/2011 at 09:46, xxxxxxxx wrote:

              last one for now

              I can set the material channels on and off using (bump example)
              mat_op[c4d.MATERIAL_USE_BUMP]=True

              but can't figure how to get or set using GetChannelState() SetChannelState()
              I appreciate I'm addressing this wrongly - help pls

              print mat_op.GetChannelState(CHANNEL_BUMP)
              error  c4d.BaseMaterial object has no attribute ' GetChannelState'

              I see this a c4d.material rather than c4d.Basematerial, but stuck as how to address this function.

              Again I'm only getting my head around the coding, objects etc
              The correct syntax would be very helpful in making the leap in understanding how these objects fit together.

              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 02/01/2011 at 10:21, xxxxxxxx wrote:

                GetChannelState/SetChannelState is obsolete for Python. To get the information if a channel is enabled, just call:

                print mat[c4d.MATERIAL_USE_BUMP] #Is '1' if enabled, otherwise 0 for disabled
                

                Cheers, Sebastian

                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 02/01/2011 at 11:14, xxxxxxxx wrote:

                  I was looking to enable a channel after setting a shader
                  hence used SetChannelState (I guess this should be marked obsolete in the SDK)
                  mat[c4d.MATERIAL_USE_BUMP]=True
                  does the job - cheers

                  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 02/01/2011 at 11:18, xxxxxxxx wrote:

                    Is there a way to create an instance of a shader
                    or is it a case of feeding one source value to all the intended targets and refreshing when necessary?

                    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 02/01/2011 at 12:16, xxxxxxxx wrote:

                      shd = c4d.BaseList2D(XSLANoise)
                      Here you already create a new instance of the noise shader.

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