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
    • Recent
    • Tags
    • Users
    • Login

    Rendering Noise Preview

    Scheduled Pinned Locked Moved SDK Help
    6 Posts 0 Posters 429 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 06/05/2011 at 06:04, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   12 
      Platform:   Windows  ;   
      Language(s) :     C++  ;

      ---------
      Hey everyone. 
       
      I am mostly posting this to verify that my understanding is correct.   I am using noise functions namely C4DNoise::Noise() to deform geometry.  I would like to display the noise that is created in a Bitmap as a preview for the user to see the noise.  The Noise() function uses the different noise presets that are available in C4D...  So here how I understand it.. 
       
      I will need to iterate through the pixels of the bitmap and set their value to the current noise value within the loop.   Does this sound right? 
       
      Is there an example in the SDK of this anywhere?
       
      Thanks,
       
      Shawn

      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 06/05/2011 at 06:11, xxxxxxxx wrote:

        Yep, I think that's right.
        You can draw Pixels into a GeUserArea to present your bitmap.
        As I don't code in Cpp, I will post pseudocode.

          
        //Pseudocode, don't copy   
        uarea = MyUserArea(mydlg);   
        mynoise = C4DNoise.GetNoiseArray(); //should be a 2D array   
          
        for (int i = 0; i < sizeof(mynoise); i++){   
            for (int j = 0; j < sizeof(mynoise[i]); j++) {   
                uarea.SetPen(integer(mynoise[i][j]*255));   
                uarea.DrawXY(i,j);   
            }   
        }   
        uarea.Update()   
        

        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 06/05/2011 at 07:07, xxxxxxxx wrote:

          So in your pseudo code you say GetNoiseArray() which I know is pseudo code lol or coffee which I don't know the SDK very well  ...   HAHA  but would the equivalent be GetValueTable() which is private in the C++ SDK?  or are you just referring to an array filled with each noise value.  🙂 
           
          ~Shawn

          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 06/05/2011 at 08:39, xxxxxxxx wrote:

            Yes, I'm referring to an array holding all values you want to represent in your Userarea.

            A function to obtain the array could look like this.
            Since I do not know much about the C++ Syntax, this code won't work at all. 😉

              
            float GetNoiseArray(C4DNoise *noise, int width, int height) {  
              float arr[width,height];  
              for (int i = 0; i < width; i++) {  
                  for (int j = 0; j < height; j++) {  
                      Vector _2dVector = new Vector(i,j,0);  
                      arr[i,j] = noise.SNoise(vector);  
                  }  
              }  
              return arr;  
            }  
            

            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 06/05/2011 at 08:41, xxxxxxxx wrote:

              Awesome.  Thanks again 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 06/05/2011 at 11:24, xxxxxxxx wrote:

                You're welcome. 🙂
                By the way:
                You could also do this within one loop instead of seperating it by functions.

                float PaintNoiseToArea(GeUserArea *uarea, C4DNoise *noise, int width, int height) {   
                    for (int i = 0; i < width; i++) {   
                        for (int j = 0; j < height; j++) {   
                            Vector _2dVector = new Vector(i,j,0);   
                            float value = noise.SNoise(vector);   
                            uarea.SetPen(integer(value*255));   
                            uarea.Draw(i,j);   
                        }   
                    }   
                    return TRUE;   
                }
                
                1 Reply Last reply Reply Quote 0
                • First post
                  Last post