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

    Sphere colored in 2 colours

    SDK Help
    0
    4
    538
    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
      Helper
      last edited by

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

      On 16/03/2003 at 10:30, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   8.012 
      Platform:   Windows  ;   
      Language(s) :   C.O.F.F.E.E  ;

      ---------
      How to plot sphere with the color dependence on some function.
      So I have f(x,y,z). If f(x,y,z)>0 in the point of sphere I want to be
      this poin red, if f(x,y,z)<0 green, and f(x,y,z)=0 black (for
      example).
      Could somebody help with such porblem?
      Thank you,
      Nikolai

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

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

        On 18/03/2003 at 10:08, xxxxxxxx wrote:

        You could do this with a shader. Just set the color based on the ray point.

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

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

          On 26/03/2003 at 06:18, xxxxxxxx wrote:

          Just enter this sample script into a file named "volume.cof" inside your "plugins" folder:

              
              
                
              var PLUGIN_ID = 1011472; // Unique ID
              
              
              
              
              class VolumeExample : VolumePlugin  
              {  
              public:  
                VolumeExample();  
                  
                GetName();  
                GetID();  
                GetInfo(settings);  
                FillInfoData(settings,is);  
                CalcSurface(settings,render,vd);  
              };
              
              
              
              
              VolumeExample::VolumeExample() { super(); }  
              VolumeExample::GetName() { return "Volume Example"; }  
              VolumeExample::GetID() { return PLUGIN_ID; }  
              VolumeExample::GetInfo(settings) { return SHADER_SOFTSHADOW|SHADER_MIPSAT; }
              
              
              
              
              VolumeExample::CalcSurface(settings, render, vd)  
              {  
                var f = 2*vd->p.z*vd->p.z - vd->p.x*vd->p.x - vd->p.y*vd->p.y;
              
              
              
              
                if (f < -1000)   
                {  
                  vd->col = vector(1,0,0);  
                }  
                else if (f > 1000)  
                {  
                  vd->col = vector(0,1,0);  
                }  
                else  
                {  
                  vd->col = vector(0,0,0);  
                }  
              }
              
              
              
              
              VolumeExample::FillInfoData(settings,is)  
              {  
                is->midcol   = vector(0,0,0); // Preview color  
                is->midtrans = vector(0,0,0);  
                is->midrefl  = vector(0,0,0);  
              }
              
              
              
              
              main()  
              {  
                Register(VolumeExample);  
              }
          
          1 Reply Last reply Reply Quote 0
          • H
            Helper
            last edited by

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

            On 01/04/2003 at 23:08, xxxxxxxx wrote:

            Dear Mikael!
            Thank you very much! You help was very useful.
             
            Thank you,
            Nikolai

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