Hello and welcome!

André here from Iris VFX.
Back with another CINEMA 4D tutorial.

In This Episode

We will kick it off with a brief tour of what’s included with the CINEMA 4D SDK.

Then I will show you two ways of accomplishing the same goal: setting up your very own plugin.
The first way will have me demonstrate briefly how to manually copy bits and pieces from the SDK examples such that you are left with a starting point for your own plugin.
The second way will allow me to show off how my recently released CINEMA 4D Plugin Wizard application makes this process even simpler and much quicker.

Once we set up our bare-bones template, I will then show you how to create your very own shader plugin:
a sexy turbulence-based noise shader.

A Few Notes

Before I go ahead and link the video in, here are a couple of notes to keep in mind:

This episode serves as a bare minimum starting point from where we will expand on in future episodes.
I won’t be spending too much time on how exactly a plugin is put together. We will also not be coding much.

This episode accomplishes exactly two things:

1) it shows you the necessary steps to create your own bare-bones plugin template as painlessly as possible.
2) it gets a nice result quickly, to pique your interest so you may experience the motivation to embark on your own journey.

And finally: as my main means of recording is OS X based the video shows OS X. However, if you are on Windows don’t fret.
I do use Windows as well, and the main reason I am writing this blog post is that it provides me with an opportunity to attach screenshots for a Windows version of the tutorial.

Visual Studio and Xcode are very similar these days in their functionality. Sure, the feature may not have the exact same name but you can usually deduce what the equivalent is between both IDEs.If you do get stuck though, don’t hesitate to leave a comment. Either here or on the Vimeo page for the tutorial video.

So, without further ado, please enjoy the video!

Setting The Host Application In Visual Studio

Since the compiled plugin is not an executable program by itself it needs CINEMA 4D to actually be able to run. CINEMA 4D in this case is the plugin’s host application.

In the video I mention how to set up a host application in Xcode, so to complement this, here are the steps to set the host application in Visual Studio Express 2012:

Step 1
Step 2
Step 3
Step 4
  • Select target
    Select target

Shader Plugin Template for R14

I was asked if the shader plugin template will work with CINEMA 4D R14.
Sadly, it won’t.

The SDK changed rather significantly between R14 and R15. Many base types got replaced, for example Float in R15 was called Real in R14, Int32 in R15 is LONG in R14. These are just a few of the many changes done with the R15 SDK.

The changes are so numerous in fact that a define was introduced, so you can compile plugins using the pre-R15 SDK types with the R15 SDK: if you define the preprocessor macro __LEGACY_API in your compiler settings, you can continue to use LONG et al. in your plugin’s code and still compile with the R15 SDK.

What does this mean for the shaderplugin template? Well, I need to adjust the one included with the Plugin Wizard so it uses the pre-R15 SDK types. You can download the adjusted template at the end of this paragraph.

To use it, drop the shaderplugin_r14 directory inside the c4dplugwiz_data/cpp folder included with the Plugin Wizard so it sits on the same level as the original shaderplugin template (actually, it doesn’t matter where you put it, I just think it’s nice to keep things tidy).

Here’s the template:

shaderplugin_r14.zip

Here’s what needed changing:

Main.cpp (R15)

Main.cpp (R14)

%!PluginNameAsID!%.cpp (R15)

%!PluginNameAsID!%.cpp (R14)

3 Responses

  1. Reply
    Michael Herzlich
    Jan 02, 2014 - 11:24 PM

    Thank you very much! I think I’m a solid C++ developer, but starting with new APIs and setting up projects and directories annoys me every time. You blog looks pretty professional and you know how to communicate your knowledge! Thanks again :-)

    • Reply
      André Berg
      Jan 03, 2014 - 08:42 AM

      Thanks for taking the time to write that. Much appreciated :)

Trackbacks/Pingbacks

  1. Introduction to CINEMA 4D SDK Part 2 | Iris VFX

Leave a Comment