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

    Material Plugin - no clue

    Scheduled Pinned Locked Moved SDK Help
    4 Posts 0 Posters 408 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 15/05/2011 at 14:41, xxxxxxxx wrote:

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

      ---------
      With only three slim examples in the cinema4dsdk and little information here, how am I supposed to write a MaterialData plugin which handles a bunch of 'channels' (such as color, diffuse, specular, etc. - not ChannelDatas)?  Look at this list of classes and structures involved and then back at the skimpy, small, insignificant amount of information and tell me how I'm supposed write something like this.

      Material
      BaseMaterial
      MaterialData
      VolumeData
      BaseVolumeData
      Ray
      RayObject
      IlluminationModel
      InitRenderStruct
      SurfaceData
      RenderData
      Render
      MatPreviewType
      RenderPreviewImageCallback
      MatAssignData
      MatAssignTable
      Multipass
      VPBitmap
      Multibitmap
      RayLight
      MaterialPreviewCustomGui
      MaterialPreviewData
      MaterialPreviewObjectInfo
      MaterialPreviewGenerateImage
      MaterialPreviewModifyCacheScene
      MaterialPreviewPrepareScene
      MaterialPreviewCopyUserData
      MaterialPreviewHandleDragnDrop
      TextureTag
      MatAssignCustomGui
      MatAssignData
      MatAssignTable
      TexData
      IlluminationSurfacePointData
      RayHitID
      IlluminationSurfacePointModel
      RayCamera
      RayParameter
      RayEnvironment
      RayPolyWeight
      PolyVector
      BaseVideoPost
      VPFragment
      LensGlowStruct
      SurfaceIntersection
      VPBuffer

      C4D_Falloff
      FalloffData

      It's pretty certain that this isn't a complete list (and easy classes have been omitted obviously).  Examples!  I need examples!  How would I map a bitmap onto a surface given this choice of hundreds of classes, structs, values?  I have no idea because there are no examples.  Lots of fragmentary information and simplistic full examples.  Not helping.  Please help!

      Thanks,

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

        A good idea is to take apart the SimpleMaterial.cpp example. It shows how to add to channels, diffuse and specularity. All the calculations in this example are done within CalcSurface and the illumination model hook SimpleIllumModel. In CalcSurface you have access to the VolumeData of the material to set for instance the rendered color. It will provide you with the current rendered surface's UVW coordiantes, normal etc. Also it's possible to fill the multipass buffers for the diffuse and specular component there.

        To present the user with some channels is just a matter of the interface. Check the resource files of some of Cinema's materials to get an idea how it's done, for instance mmaterial.res.

        cheers,
        Matthias

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

          Presenting the interface to the channels is easy enough.  Already have the working framework for that.

          That is exactly how I started.  I took the SimpleMaterial example and used it as a starting point for my Material plugin.  Yeah, I can understand setting the color and the specular overall.  But VolumeData is a massive class with many methods and even more variables. Add in the TexData and Multipass classes and it is even more massive.  It could take months of experimentation and trial&error to even start getting a grip on what works, what doesn't, what is needed or not for certain aspects (image mapping, shadows, displacement, bump, etc.).  Eventually it will also be required to have the material's setting reflected in the editor (e.g.: OpenGL).  This isn't even exemplified in the sdk examples.

          For instance, you mention that the surface's UVW coordinates (etc.) are passed.  It looks like one UVW vector is attached to the VolumeData.  Is CalcSurface(), as an example, called for each pixel of the render or for some subdivision of the UVW space or just once (per cpu) per render?  This information is not given anywhere (and I've been going through the SDK docs, examples, and here for many tireless days).

          What would be more educational would be a 'simple' example code which shows a call sequence like that shown in MaterialData::InitCalculation().  InitCalculation() itself, for all of its supposed importance, isn't used in a single sdk example. 😞

          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 18/05/2011 at 00:59, xxxxxxxx wrote:

            Maybe you can tell what you want to achieve. As for CalcSurface, it is called for each pixel or sub-pixel if antialiasing is used. BaseVolumeData::uvw is the current UVW coordinate on the rendered surface. For materials where you don't have to pre-calculate a lot of data InitCalculation is not needed.

            cheers,
            Matthias

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