Seamless Displacement in OctaneRender for Cinema 4D

Seamless Displacement in OctaneRender for Cinema 4D

Seamless Displacement in OctaneRender for Cinema 4D

Seamless Displacement in OctaneRender for Cinema 4D

Hey, guys! In this blog post I’d like to share a displacement workflow which I’ve been using for quite some time now. The advantages of this approach is that we kind of bypass UVs (well, not completely true but you will see what I mean in a bit) and the notoriously nasty tears and artifacts often seen around UV seams.

Octane’s Displacement node, as I am sure you know by now, is very much UV based. However, the way we gonna do this depends on Octane’s own projection methods. This means mesh UVs and seams are gonna be of minor importance. So, here we go!

A couple of prerequisites for successful displacement – relatively even distribution of polygons and no overlapping UV islands. Both of these are common sense I guess.

Let’s start with a default, primitive sphere. No need to make it editable. As you can see, the topology here is really not gonna work for us – nasty poles on top and bottom:

Seamless Displacement OctaneRender Image 01

Seamless Displacement OctaneRender Image 01

Here is a better distribution of polygons. Still a primitive sphere:

Seamless Displacement OctaneRender Image 02

Seamless Displacement OctaneRender Image 02

Let’s apply a checkerboard pattern for a quick glimpse at the UVs:

Seamless Displacement OctaneRender Image 03

Seamless Displacement OctaneRender Image 03

Tiling.. Not good. That’s basically 6 identical UV islands, stacked on top of each other. Let’s force a spherical projection via the texture tag, applied in object manager:

Seamless Displacement OctaneRender Image 04

Seamless Displacement OctaneRender Image 04

Okay, no more texture tiling. Not great but good enough. I will just swap the checkerboard pattern for a height map of some rocks:

Seamless Displacement OctaneRender Image 05

Seamless Displacement OctaneRender Image 05

So this is how it looks:

Seamless Displacement OctaneRender Image 06

Seamless Displacement OctaneRender Image 06

Doesn’t look horrific at firs glance. Don’t be fooled though, that’s still a spherical projection – top and bottom are horrific:

Seamless Displacement OctaneRender Image 07

Seamless Displacement OctaneRender Image 07

Easiest way to fix this would be via a triplanar node, right? Right! However, and this is important – we are now stepping into “Octane Projections” land as the triplanar node is gonna override that spherical projection set on the texture tag. This means the Displacement shader will not be able to work with this texture – its mapping is no longer UV based! Still, we gonna do it and move forward.

Alright, so we need to fix that bad mapping on the top and bottom. I will create a simple mask by using triplanar. Connect a float node with a value of 1 to +Y/-Y and a float set to 0 to the remaining directions. Increase the “Blend angle” some, I’ve set mine to a value of 40:

Seamless Displacement OctaneRender Image 08

Seamless Displacement OctaneRender Image 08

You should see something like that:

Seamless Displacement OctaneRender Image 09

Seamless Displacement OctaneRender Image 09

Now that we have this mask, put it aside for a bit. Duplicate the rock texture and apply another triplanar node to it. Make sure you enable “Single texture” on that one. Use the mask we made as mixing factor between the original texture and the triplanar-ed duplicate. This will effectively apply triplanar mapping to the top and bottom areas only, the rest will remain as they were. See the image bellow for clarification:

Seamless Displacement OctaneRender Image 10

Seamless Displacement OctaneRender Image 10

Looking cool in the Live Viewer:

Seamless Displacement OctaneRender Image 11

Seamless Displacement OctaneRender Image 11

And again, don’t bother trying to displace this, it’s not happening:

Seamless Displacement OctaneRender Image 12

Seamless Displacement OctaneRender Image 12

Seamless Displacement OctaneRender Image 11

Seamless Displacement OctaneRender Image 11

So this is what we gonna do – we will use the baking features of Octane to capture the current state of the Diffuse channel. Think of it like a snapshot, of a sort. Start by adding an Octane object tag to the parametric sphere. Under “Object layer” set the “Bake ID” to 2. By default, all meshes are assigned a Bake ID of 1. In order to isolate the object we are interested in, we need a different number:

Seamless Displacement OctaneRender Image 13

Seamless Displacement OctaneRender Image 13

Next, change the camera type to “Baking” and match that Bake ID number we just set in the Object tag:

Seamless Displacement OctaneRender Image 14

Seamless Displacement OctaneRender Image 14

The Live Viewer should automatically restart to render the unwrapped, baked Diffuse channel. No pinching, no stretching. How nice!:

Seamless Displacement OctaneRender Image 15

Seamless Displacement OctaneRender Image 15

What’s left to do is save this out as a regular image texture which can easily drive the Displacement node. But wait, that’s not entirely true. If you are still looking at the image viewer, you may notice that the Diffuse channel has light information baked into it. See the obvious highlight? We need to get rid of this:

Seamless Displacement OctaneRender Image 15a

Seamless Displacement OctaneRender Image 15a

Luckily, Octane’s multi-pass system allows us to export the Diffuse channel exactly as we need it – as an albedo map, no light contribution. Enable the functionality in render settings and choose an output path, format, depth and color space. In my case I am saving out a 16 bit EXR in linear color space. “Multi-layer” file is disabled. Finally, enable the pass we are after – “Diffuse filter”:

Seamless Displacement OctaneRender Image 16

Seamless Displacement OctaneRender Image 16

Looking at the rendered pass in the Live Viewer – things are looking much better. Nice even distribution of values:

Seamless Displacement OctaneRender Image 17

Seamless Displacement OctaneRender Image 17

Cool, set the desired output resolution and hit render:

Seamless Displacement OctaneRender Image 18

Seamless Displacement OctaneRender Image 18

Once the export is complete you can change the camera type back to “Thin lens” and disable the multi-pass system. In the material editor, swap the procedural node tree for the freshly baked image texture. Mind you, my output file was a linear EXR thus the gamma parameter in the image node has been set to 1. Yours may be different:

Seamless Displacement OctaneRender Image 19

Seamless Displacement OctaneRender Image 19

Rendered image should remain the same:

Seamless Displacement OctaneRender Image 20

Seamless Displacement OctaneRender Image 20

What we have now is a single texture map, that flows along the surface of the mesh. Time to turn on displacement again:

Seamless Displacement OctaneRender Image 21

Seamless Displacement OctaneRender Image 21

Seamless Displacement OctaneRender Image 22

Seamless Displacement OctaneRender Image 22

Yikes! Adjusting parameters..:

Seamless Displacement OctaneRender Image 23

Seamless Displacement OctaneRender Image 23

Seamless Displacement OctaneRender Image 24

Seamless Displacement OctaneRender Image 24

Oh yeah! No tears, no black artifacts. Let’s add some high-frequency noise in the Bump channel to counteract that Gaussian blur in the Displacement node:

Seamless Displacement OctaneRender Image 25

Seamless Displacement OctaneRender Image 25

And we are done!

Seamless Displacement in OctaneRender for Cinema 4D

Seamless Displacement in OctaneRender for Cinema 4D

Here is another example that is mixing a couple of Octane noises. No triplanar here. Projection has been set to “XYZ to UVW”. 100% clean:

Seamless Displacement OctaneRender Image 26

Seamless Displacement OctaneRender Image 26

Seamless Displacement in OctaneRender for Cinema 4D v02

Seamless Displacement in OctaneRender for Cinema 4D v02

Here’s another one, this time with a torus:

Seamless Displacement OctaneRender Image 27

Seamless Displacement OctaneRender Image 27

Seamless Displacement in OctaneRender for Cinema 4D v03

Seamless Displacement in OctaneRender for Cinema 4D v03

Thank you for reading. That’d be all! 🙂


Hey, hopefully you enjoyed this post. If you did and think that the work I do is somewhat decent, chances are you may want to join the mailing list.
I keep it clean and on topic. No spam. Just saying.