Variable Data with the Cineware for Illustrator 3D plugin
Note: this article is complex due to the mix of added variable-data workflows in addition to using the Cineware Illustrator plugin. To see the magnificent results, please feel free to scroll to the bottom and view the output files.
Oct 17, 2017 - At the time of this writing, it's been just about a week after the free plugin was announced to the public.
With the initial release of the free Cineware for Illustrator 3D plugin from Maxon, Illustrator enters a new dimension in creative power. Surely it will be ever so useful to vehicle wrap designers, packaging designers, people who make textures, interior designers, gaming and animation workflows, etc. I wanted to test the plugin in the context of variable data, though: how would the plugin handle an advanced variable data workflow where variable Illustrator assets are brought in as well as recolored?
The subject
In order to test whether it is truly possible to batch-output variable 3D-mapped art documents with dynamic colorization while utilizing source editable documents, I wanted to choose a subject where an editable document has its colors changed also and is then mapped to the 3D object. From the available free 3D models, I downloaded the hat template and determined that its "logo area" could contain a changeable piece of art which would serve as the 'applique'. For this project, the goal is to output preview baseball cap graphics.
Installing and using the plugin
Installation
To install the free plugin, I downloaded it from the Cineware website and ran my Mac installer. After a restart, my Illustrator showed a new menu item 'Cineware' in the Window file menu. Inside this menu item, you will find the various modules of the plugin.
Workflow time management notice
Setting up the template is a time numbers-game, as any edits to mapped surfaces will cause a re-render. Therefore it's useful to keep most work in Draft rendering mode and have the automatic mapped image updating disabled.
Mapping an art object to a surface
First of all, make sure to keep handy a bookmark to the Cineware Documentation site.
To map an art object to a 3D model's surface, two of the Cineware modules are used: the Cineware Attributes panel and the Cineware Scene Structure panel. In the Scene Structure the breakdown of the model is listed as a tree-view with all of the components shown as list items.
Next to the mappable items there is a square icon with an orb inside. This icon is clickable, and will cause the Attributes (not the regular Attributes, but the Cineware one) panel to redraw, showing the properties of the selected 'material'.
In the newly presented Attributes view, the item of importance is the "Texture" list item. This is precisely where art can be dragged on to, right from the document, and it will cause the Cineware plugin to draw the artwork on the 3D surface.
The Attributes panel helps set model scaling and other 3D transformations, the position of the camera as well as the lights in the 3D scene - when the model's components are selected in the Scene Structure. There are also settings for other kinds of art mappings as well as the Rasterization setting, which apparently control the resolution of a particular material's texture rendering.
What kinds of art can be mapped? It appears that any Illustrator artwork object can. One of the fastest ways to change a complex piece of art, with minimal rendering time, is to simply use a variable linked image file as the mapped object.
Getting familiar with mapping the 2D art
While it may be possible to construct 3D models such that the resulting UV Maps more closely match up to some 'real-life' counterpart such as cut-&-sew apparel patterns, this would be impractical. The necessary burden in this 3D workflow is to work with the uv maps which are provided, placing the artwork to be oriented and aligned to the proper map area.
Here the uv map appears to have a distorted stitch pattern, by flat standards, but these map to nice straight lines in the 3D model surface texture.
Getting a working file
Creating new texture maps
The downloaded archive contains a folder which has an .ai file as well as a Links folder with various images as well as a .c4d file. In Illustrator, the .ai file appears to contain three artboards: one for the Front Logo area, one for the Tag label and one for the 3D view object. Unlike the free t-shirt 3D model, the hat model does not come with all of its surface area mapped to an area in the document which would make it easy to quickly assign the art. All is not lost, as the Links folder contains these files: "hat_normal1.png", "hat_normal2.png" and "hat_normal3.png", and they provide the key to mapping the rest of the hat.
By placing the purple-looking art files in Illustrator and tracing their 'edges' of garbled purple-green colors vs the static purple background, the texture map can be obtained. Having traced the shapes and grouped them inside a clear square path to match the boundaries of those placed files, I could now drag the group into the Cineware Attributes panel to map it to the corresponding surface material. Of course, the correct properties have to be showing inside this Attributes panel, so first it is necessary to select the little square material icon of the desired model piece inside the Scene Structure panel.
Masking off the applique art
The sample hat template contains a "Front Logo" raster image which is mapped to the area in the 3D model on the front of the hat, above the visor. I made sure that all mapped art groups had a background uncolored rectangle which would set the boundary of the texture art, so the expectation was that if some art is transparent in that area, it will just show the underlying hat surface through. However it was not so, and the Front Logo area would cut a peculiar shape out of the main hat body's texture.
In order to stop this behavior, I had to use the Alpha attribute of the texture material which is mapped to the Front Logo surface. Using this feature turned out to be exactly like using the map-artwork feature: by dragging art into the Alpha list item in the Attributes panel, the affected surface becomes clipped off to the shape of this art. In the case of achieving the desired effect of showing the underlying hat, the transparency shape is vital.
To mask off the surface just to the edges of the applique, an exact copy of the applique needs to be used in separate art which needs to be mapped to the Alpha attribute of a given material. In this project, this would require Illustrator actions to paste an extra copy of the asset-imported logo into another group which is dedicated to creating this transparency shape.
Because the Alpha feature works with black color being completely transparent and white being completely opaque, an appearance-added white-color fill is added to the art group to ensure the contained imported logo is colored completely white.
Increasing the resolution
At first, I tried to use the highest quality render settings as well as setting 300+ ppi in the resolution settings of the attributes of the texture materials.
Still, exporting the file or viewing it only produced a really pixellated result. To fix this, I revealed the hat group in the Attributes panel by clicking it in the Scene Structure panel and scaled the entire thing up by 200% (changing the 1.0 to 2.0 in the x, y and z inputs).
Then back in the Scene Structure, I used the camera button at the very top to switch to the camera structure display, and revealed the main camera inside the Attributes panel. There, I could change the camera position to bring the model back into view.
Now, the product resolution appeared more acceptable. It may even be so that scaling and moving the camera even more would result in even higher resolution.
The workflow
In this batch processing workflow, a variable-data technique to bring in an art asset is used to paste in entire contents of referenced Illustrator documents and the Recolor.jsx script is invoked by the processing action to colorize all art in the document, including those newly pasted objects. Not only will the imported logo art be aligned to the proper location, but a second copy of it will need to be placed into an art group mapping to the Alpha of the "Front Logo" material. This will produce a series of dynamically-styled files where swatch squares are colorized to reflect the colors being used in the current colorway. Mapped 2D artwork groups will transmit their changes to the 3D plugin object and create a 3D preview as part of the output document.
In this project for simplicity, process color data is used as opposed to named swatch data. Every art shape chosen for recoloring gets its own hex color from the .csv file, and this color is also written out in a variable text box below the swatch shape.
Setting the template up for variable data
Adding instructions to the template, color map .csv and CreateCommandLayer.jsx generation script
The Recolor.jsx script works by means of being executed by a batch action process when the batch is processing datasets, after the document is populated with a new record. When it runs, it gathers special instructions from art items inside a layer named 'COMMAND', and what's more, those instructions further inform the script which text frames to read for color information, and what note an art item must contain to be recolored by it. This could get very tedious and error-prone, so I made a quick generation script called "CreateCommandLayer.jsx" to help create the entire COMMAND layer with all of the instructions as well as a 'Recoloring Variable Text' layer which has all of the named text frames created so that you don't have to.
It works by ingesting a specially-formatted "color map" .csv file and creating the layers and text frames inside an Illustrator document. The .csv file needs to have at least 4 columns with these names: "source text name", "target note", "method" and "parameter" . The 'Color Map' .csv file has the purpose of listing each of the instructions and parameters in a grid. The 'source text name field' will represent the name of the text frame in your document which will be populated with variable color text data. If using the most common way to bind variables with the VariableImporter script, by name, the name of the source text frame will also match the name of that color data variable in the data .csv file.
The 'target note' will contain the text strings to be searched for among all of the document's art objects to see if they match the attribute note, at which point the given artwork will be colorized according to the color data. The 'method' and 'parameter' deal with the kinds of actions Recolor.jsx is capable of (please see that article for list of all parameters), and in this project it is APPLYCOLOR with FILL and one instance of STROKE for the stitches.
In this picture, the COMMAND and Recoloring Variable Text layers are made visible and the text frames inside them are filled with White to make their contents plainly visible.
After the COMMAND layer and variable text layers are made, it is okay to hide them in the layers panel and not think of them ever again unless there's a big change needed in the template. Thus, when using the color map csv file with this script, you almost don't have to worry at all about how data goes from the source text to the target notes, and the entire coloring scheme is visible in one easy-to-read and edit grid spreadsheet view.
At the end of crafting the template, it looked like this. Notice the differently-colored logo at the bottom middle of the picture: it is a placed file which the batch action will open via Edit Original command and paste it inside the current file.
Setting up a source logo folder
A folder of logo files is pre-made, and each file inside has been edited so that art shapes are separated into distinct compound paths. This will make it easier for the Recolor script to apply a color to each logo, as it will have to process less shapes. To get the attention of the script, the compound paths are set with (native) Attribute notes with "color_1", "color_2", etc. In this sample project 4 different sports logos are used, each one is made sure to contain 4 colors and the respective notes. These logos will be brought into the document via the copy/paste 'bring in asset' action technique.
Putting the data together
In order to quickly get some hex-color schemes, I went to www.colorhunt.co (notice the lack of the 'm', it's not a '.com') and pasted some of the colorways into the data csv file. For this sample, I put in all kinds of arbitrary colors together without any particular direction, except for the necessity to contrast them in order to at least differentiate to illustrate the fact that they are indeed changeable. There is one linked file variable, it will be used by the Illustrator actions to open that file and paste its contents into the template document, thereby bringing in a new sports logo.
Importing the data
Calling on the services of the VariableImporter.jsx script, the data can be imported almost effortlessly. In my import I made sure to prepend the folder path to the logo assets folder and had my dataset names include the logo name variable and the colorway name variable.
To make sure all variable text is present, the Test tab of VariableImporter dialog box provides a quality-check opportunity. The importer is finding two copies of some text frames named the same name, and this is just fine. Because one of those text frames was created by the CreateCommandLayer.jsx script, and the other one is present in the artboard to display the color where it was manually placed, these text frames will be bound to the same variable. Technically, this duplicate variable can be removed from the auto-generated Variable Text layer, but it's not inhibiting anything while being present.
Making the processing Action
The note-selection mechanism
While the easiest and quickest method to change mapped artwork with variable data is to simply use a linked variable image file, in this workflow I wanted to test out the challenge of bringing in an editable asset and using a subsequent run of the Recolor.jsx script to change not only the art colors in the template document, but also in these imported .ai file logos. The issue then becomes, how can a group of Illustrator artwork that has been freshly copied from its document (with that Edit Original command) be also pasted into a specific place within the stacking order of the 3D-mapped art group.
Illustrator's limited Actions give us a gift of the rudimentary selection mechanism whereby an art object can be selected based on the attribute note it contains. There's also an ability to record the setting of the attribute note, too. This means, having a constant piece of art in the document with a certain note will allow actions to select this item at a given time and invoke a 'paste in front' command to insert the copied art into a designated spot in the stacking order.
As setting notes is also available as an action event, therefore it is also possible to record a sequence which sets a note to a new pasted object, cut it, select a placeholder object by its note, paste in front, select and delete the placeholder object and select the new pasted object by its new note assigned to it after it was pasted at the start of the action, and assign it a note identical to the just-deleted placeholder object. This effectively replaces one art group with another one, and leaves the document in the same state as it was started, note-wise. At this point there's going to be a placeholder-noted item available for selection by the next action cycle.
Action Structure
Using the note-selection mechanism to paste in external illustrator file art the following action was constructed:
Here is what it does:
- Select the "replace_image_group" note object: it is a group which contains as its sole occupant, the placed file which is linked to variable data. As an effect of this event, the linked file is activated. (This must be like this because when a linked file is changed by a variable, its notes just disappear)
- Edit Original: the placed .ai file is now opened in Illustrator
- Select All: the opened file's selectable contents are selected
- Copy: copies all the art to the clipboard
- Close: closes the opened document, returning the view back to the variable template
- Paste In Front: pastes the art in front of whatever is selected in the template document which is now active
- Align: align the pasted art to the center of the active artboard
- Cut: removes the art from the document, but copies it to the clipboard with its new aligned location
- Select the "placeholder" note object: the previous logo which is being mocked up is now selected
- Paste In Front: pastes the new logo art in front of the placeholder logo, in the stacking order of the mapped art group.
- Set Note: sets a note "new logo"
- Select "placeholder" note object: select the placeholder again
- Clear: delete the placeholder
- Select "new logo" note object: now the new logo is selected
- Set Note: set note "placeholder", now the previous logo is changed with the new one
- Select "new transparency" note object: in the mapped art group which maps to the Alpha of the hat's Front Logo surface, the placeholder art group is selected
- Clear: the placeholder art group is deleted
- Select "logo area transparency" note object: in the Alpha mapped art group, I placed a couple of tiny ellipses, the bottom one of which has the 'logo area transparency' note. Now the bottom ellipse is selected.
- Paste In Front: the new 'imported' applique logo is still in the clipboard, now it is pasted again in front of the shape selected in the last step.
- Set Note: the pasted logo gets a new note "new transparency", it now becomes the new placeholder for the transparency shape art.
- Play Recolor.jsx script: Using the Insert Menu item, the Recolor.jsx script was recorded into the action from the File > Scripts menu. Now it plays and recolors any artwork specified in the COMMAND layer.
- Save a Copy: This is where saving or export is performed, in this case a pdf is saved.
Warning: when recording actions, it may be tempting to quickly duplicate and drag around the various action events to change their order inside the Actions panel. There is nothing wrong with doing this, but make sure to periodically save the action set .aia file and not have any important files open: I have experienced an Illustrator crash at random times when moving action items like so.
Another Warning: using the 'bring in editable asset' technique means that the Actions playback mode must be set to Pause for at least 0.1 seconds so that the Edit Original command would work properly.
Running the action
To test the action, some variable data has to exist in the document in order for color-data text boxes to populate with the color hex data. Once the template is complete, new VariableImporter data can be brought in at any time, it will just overwrite existing variable data in the document..
Before doing the entire batch, I made sure to test the action by simply playing it on the active document and seeing if the logos were properly being replaced and recolored. With the Cineware rendering mode being set to Draft, the rendering of the various items still takes a while.
Once it was established that the logo-swapping mechanism worked, it was time to do the batch! This is the realm of 3D rendering, so I knew that times would be somewhat long. With the ultimate test of processing all 6 records on High Quality render setting, this reality became even more clear. Here are my test results:
- Draft: 12:40
- Low Quality: 16:43
- High Quality: 42:00
Rendering observations
It seemed that the major sticking point was due to how many re-renders the plugin had to perform based on all the manipulations of the Illustrator Actions. In the action the imported applique logo is aligned to center before it is pasted into the mapped group- even so, the act of pasting in new art and deleting existing art causes two separate re-renders. Same goes for even less 'artsy' events, such as the setting of an attribute note- it causes a complete re-render. Because of the 'editable asset' workflow in this project, the action causes several redundant and time-consuming re-renders. I expect this not to be as bad when this bonus workflow is not being used.
Advantages of scripting
One observation about the rendering behavior of the plugin is that the recoloring performed by the Recolor.jsx script appears to run as one single action event - although it may be individually editing the color of multiple items. This leads me to believe that scripting activity is consolidated to one user event within Illustrator's way of thinking, and that this batch process would likely run much faster if all of the artwork manipulation done via actions would be instead done by script.
Other glitches
After running several batches and fiddling with more materials settings inside the Cineware panels, on one of the batches I've encountered these errors:
After an Illustrator restart, it was fine again.
The Result
I tried several colorways, tweaked them and tried them again, to produce these files. Check them out!
Conclusion
The ability to use genuine 3D models inside of Illustrator is going to undoubtedly bring new dimension (yes, I said this a few times, but it's so true!) to the graphics workflows of many industries. I'm curious if, and how vehicle wrap artists, interior and fashion designers may benefit.
One thing is for sure: this is the domain of 3D and it definitely benefits from having the best computer for this kind of processing. To process my mere 6 records on High Quality, I went out for some quick grocery shopping and came back to the last of the batch being saved. Perhaps with a really powerful computer, this would be less of a pain. Another issue is of course this particular logo-swapping workflow. I envision a less gregarious workflow where mockup art is simply a linked file.
Last but not least, scripting has the potential to really speed up a custom variable workflow for these kinds of 3D mockups because of how Illustrator treats multiple script operations as just a single user operation (unlike Actions).
All in all, I'm quite excited for the potential of using this or similar techniques in workflows of any graphics-driven organization where such needs exist.
CGI & Motion Graphics Artist at Resolution Studio
6yReally good article, the same issue appeared to me too, "port 5040 is not available" but I changed the port and did a restart and it worked. maybe I just needed to restart. Thanks for your detailed descriptive article.
Comics, Sci-Fi/Fantasy Writer and 3D Art Maker.
7yYeah you weren't kidding, man, it is complex lol! But once again, great work. If I'm understanding this correctly, you have to have a .c4d file? You can't work with a .obj or a .collada file? I was looking to try out Cinema 4D Lite, but I couldn't actually find it. I think it only comes with After Effects? The Cineware site is a bit cagey on how to get this, if it is indeed possible without an After Effects license. But still, it looks good. I wonder if there's a way to set it up to work with any of the various render farm services to speed things up? Maxon and Adobe together certainly have enough pull and users to make it worthwhile for rendering services to include a plugin that sends the job to their site for rendering. Those purple/green files are 'normal maps'. Whereas 'bump maps' are grayscale textures that trick the camera into believing the surface of an object is either raised (values above 50% gray) or lowered (values below 50% gray), normal maps user RGB color to do this same thing. A bit trickier to create, but provide superior results and make fast rendering of video game assets possible. Yes it is complex, but far superior results to Illustrator's built-in 3D offerings.
Designer
7yI wish I could like this twice