Using Substance Painter with Corona Cinema 4D

By October 28, 2018 November 3rd, 2018 Tutorials

Creating textures in Substance Painter and bringing them into Corona for Cinema 4D is not such a straightforward process. This tutorial will hopefully clear up some of the confusion that comes along with mapping the proper texture maps into their respective slots inside Corona.

This tutorial won’t focus on building an entire texture from start to finish inside Substance Painter. We’ll just drop a pre-built “smart” texture onto a 3D model and export the corresponding texture maps. We’ll be using a scratched metal material used on a hard surface model.

Prepare your 3D model for Substance Painter

A lot of game companies use Substance Painter to build their textures for 3D models. Because of this, Substance can use a low res mesh, and a high-res mesh for painting. The low-res mesh would be what you would paint on inside Substance. The high-res mesh is used to bake out the proper normal map information. So if you were to use your model in a game, it would look like you’re using a high-res mesh, but it’s actually just a low poly model in order for the game to optimize performance. Since I’m not using my model as a game asset, I’m just going to use a high-res version inside Substance Painter. However, I’ll explain how to use the low-res version as well.

The model I’ll be using is a frame from a Glock handgun model:
frame_low_high

_high and _low Suffix Naming

Substance Painter uses a naming convention to differentiate between a high-res model and a low-res model. In the object manager, your low-res model should have _low as the suffix, and the high-res model should have _high as the suffix. For example, they should appear as:
_low_high Naming

Fix Surface Normals

You’ll want to be sure your surface normals are aligned on your model before exporting, so as not to get any weird artifacts inside Substance Painter. With your model selected, in Polygon mode, select all CMD+A (CTRL+A on PC). Then choose Mesh → Normals → Align Normals. Select your Phong tag and use these settings:
Phong Tag Settings

UV Unwrapping

In order for textures to show up properly inside Substance Painter, the model needs to be UVW unwrapped. I highly recommend RizomUV Virtual Spaces to unwrap your model. You can definitely use the tools within Cinema 4D, but they are a bit dated. Once you use RizomUV, you’ll find it’s a much easier/quicker experience.

Both the high-res and low-res mesh needs the proper UV coordinates. Once you have UV unwrapped the low-res model, this can be exported and used within Substance Painter. For the high-res model, this can be dropped into a Subdivision Surface object, then just perform a Current State to Object function in C4D. So each mesh should have it’s own set of UV coordinates:
UV Coordinates

Export as FBX

Once you have each of your meshes properly named, your surface normals cleaned up, and UV unwrapped, it’s time to export. Choose File → Export → FBX. I saved mine as frame_low.fbx and frame_high.fbx. Here are the export settings I used:
FBX Export Settings

Create your Textures inside Substance Painter

With Substance Painter open, choose File → New. For the template choose PBR – Metallic Roughness (allegorithmic). Corona actually uses the Specular Glossiness workflow, but the maps exported from Substance will work just fine. For the file, select your model you exported from Cinema 4D. If you’re using your model as a game asset, select the low-res mesh. Otherwise, just use the high-res mesh. For the Document resolution, choose 2048 (this can be increased when exporting your maps without compromising quality).

Substance Painter - New Project

Bake Mesh Maps

The next step is to bake your mesh maps for your model. Click the Bake Mesh Maps button:

Substance Painter Layout

The Baking dialog pops up. Really the only two sections we’re worried about is Common and Curvature. Under Common, change the Output Size to 2048. If you’re using a low-res mesh, import the high-res mesh by clicking the little page icon under High Definition Meshes. Otherwise you can leave this blank. Under Match, change this to By Mesh Name. This is mainly if you’re using the low-res mesh. Change Antialiasing to Subsampling 4×4. Under Curvature, change the Algorithm to Per Vertex. I’ve seemed to have better luck with less artifacting using this method. Untick Thickness, as we won’t need that map. Click the Bake Default/Material Mesh Maps button. Here are my settings:
Substance Painter Baking Parameters

It may take minute or two to bake the maps. Higher antialiasing settings will increase the time it takes to bake the maps.

Apply Smart Materials

As mentioned at the beginning, the focus of this tutorial is not explaining the process of building the actual textures in Substance Painter. A really great tutorial for creating a “used” looking metal texture is this one:

So if you follow that tutorial, it will show how to create a “Dark Coated Metal” smart material. Apply this to your model, and you’ll end up with a texture similar to this:
Substance Painter Textured Model

Export Texture Maps

It’s time to export our texture maps! Choose File → Export Textures. Substance Painter actually comes with a Corona preset. However, this preset doesn’t take into account a metallic texture vs. dialectric texture. When we set it up within Corona, we’ll need to use a blend mask in a Layered Material in order to achieve this look. Until Corona natively supports a metallic shader, this is the workflow we must use. Unfortunately the Corona preset does not include a blend mask preset, and includes some other unnecessary maps. I have created a separate export preset with the proper settings. Your Substance Painter export preset files can be found here:

  • Windows: C:\Users\*username*\Documents\Allegorithmic\Substance Painter\shelf\export-presets
  • Mac OS: Macintosh > Users > *username* > Documents > Allegorithmic > Substance Painter > shelf > export-presets

Download this preset file and put into the above directory: Corona (Matt)

One small drawback with Substance is that you cannot export different file types for different maps. Generally PNG files will work for most maps, but if your texture contains displacement, you’ll want to use an EXR file as this contains 32-bit data. So for now, choose your export path, set as png 8bit, then choose Export. You can change the output size as well. I chose 4096×4096. Substance Painter will up-convert your maps without compromising quality. Here are my settings:
Substance Painter Export Settings

This will give you the following texture maps:

  • BlendMask.png
  • Diffuse.png
  • Displacement.png
  • Glossiness.png
  • MetalColor.png
  • Normal.png

Displacement Map

If you do not need displacement, you can ignore this section. Delete the Displacement.png file. Bring up the Export Textures dialog again, but this time, set the file type to exr. Export your maps into a separate directory, and delete all of them except for Displacement.exr.

Hopefully in the future, Substance Painter will have the ability to export different file types for certain maps. The other workaround is creating a separate Corona export preset with just the displacement map.

Create & Apply Corona Materials inside Cinema 4D

We are finally ready to create our Corona materials inside Cinema 4D! Start by importing your high-res mesh inside Cinema.

Lighting the Scene

We want to use the same lighting environment as was used inside Substance Painter. By default, Substance uses an HDR file called panorama.hdr. You can find these HDRs here:

  • Windows: C:\Program Files\Allegorithmic\Substance Painter\Resources\shelf\allegorithmic\environments\Exterior
  • Mac OS: Macintosh > Applications > Substance Painter > Contents > Resources > shelf > allegorithmic > environments > Exterior

Create two Sky objects. One will be used as the background of our scene, and the other will be used as the actual lighting for our scene.

First create a standard Corona material to be used as the background. Name it BG. For the Diffuse color, just use a value of 14% in the V slot of HSV:
Background Material

Now create a Corona Light Material. Name it HDRI. Use panorama.hdr for the Texture under Emission:
HDRI Material

Apply the the BG material to one of the Sky objects and rename that object BG as well. Apply the HDRI material to the other Sky object and rename that Sky object HDRI:
Scene Setup

Create Corona Compositing tags for both BG and HDRI objects. For the BG tag, uncheck everything, except for Seen by camera. For the HDRI compositing tag, check all except for Seen by camera.

Layered, Metallic, & Dialectric Materials

Start by creating a Corona Layered Material. We’ll set this up later in the Node Editor.

We now need to create separate Metallic and Dialectric materials and use our Blend Mask to blend between the two on our Layered material. So create two new standard Corona materials. Name one Metallic, and the other Dialectric.

A dialectric material is basically the non-metallic portions of our texure. In my case, the black portion that doesn’t reflect anything. The metallic portions are all the scratched areas that are reflective. Corona can’t do both of these in one material, hence the need to create a Layered Material and use a mask to blend between them.

Metallic Material Properties

In the Metallic material, only enable Reflection, Bump, and Displacement (if you used displacement). Under the Reflection channel, choose our MetalColor.png for the Texture. Make sure the Color profile is set to Embedded.

Any place we use a texture map (exported from Substance), I use a Corona bitmap shader. I’m not completely sure if it matters, but I’ve been told materials render quicker this way.

Set the Fresnel IOR value to 999. This makes the material 100% reflective.

In the Bump channel set the Strength to 100%.

If you have a Displacement texture, set the Min level to 0 and Max level to 2.5.

You may need to play with the displacement settings in the Corona Render Settings dialog. It can be found under the Performance settings tab.

Displacement Settings

Dialectric Material Properties

In the Metallic material editor, only enable Diffuse, Reflection, Bump, and Displacement (if you used displacement). Under the Diffuse channel, choose our Diffuse.png for the texture. Make sure Color profile is set to Embedded.

Under the Bump channel, set the Strength to 100%.

Under the Displacement channel, set the Min level to 0 and Max level to 2.5.

Node Material Editor Setup

Open the Corona Node material editor. Drag the Layered, Metallic, and Dialectric materials into the editor. Everything should be set up as follows:
Corona Node Material Editor

I labeled each of the bitmaps with the color profile that should be used. Color/Diffuse textures in most cases must be loaded with embedded (sRGB) gamma. Glossiness, IOR, displacement, bump, anisotropy should always be loaded in linear. In some cases the gamma may need to be corrected by adjusting it to 0.4545 via a Cinema Filter Shader.

If the map represents color that you can see (diffuse reflected color), such as the color tint of a metal or the green color of grass, then it should be interpreted as sRGB. If the map represents surface attribute data, such as roughness, glossiness, metallic and height, then it should be interpreted as linear.

Wes McDermott, The PBR Guide, Substance Academy

The blend mask colors need to be inverted, so I used a standard Fusion Shader to do this. Another option would be to just use the Dialectric material as the Base material, and Metallic material as Layer 1. I guess in my mind, the Base material should be the Metallic, and the Dialectric would go over top of it, so that’s why I went with this setup 😀

That’s pretty much it! Once everything is all set up, you should have a very similar result to what was inside Substance Painter:

Corona Render

As always, feel free to shoot me an email if you have any questions!

2 Comments

Leave a Reply

 

This site uses Akismet to reduce spam. Learn how your comment data is processed.