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:
Here is a better distribution of polygons. Still a primitive sphere:
Let’s apply a checkerboard pattern for a quick glimpse at the UVs:
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:
Okay, no more texture tiling. Not great but good enough. I will just swap the checkerboard pattern for a height map of some rocks:
So this is how it looks:
Doesn’t look horrific at firs glance. Don’t be fooled though, that’s still a spherical projection – top and bottom are horrific:
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:
You should see something like that:
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:
Looking cool in the Live Viewer:
And again, don’t bother trying to displace this, it’s not happening:
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:
Next, change the camera type to “Baking” and match that Bake ID number we just set in the Object tag:
The Live Viewer should automatically restart to render the unwrapped, baked Diffuse channel. No pinching, no stretching. How nice!:
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:
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”:
Looking at the rendered pass in the Live Viewer – things are looking much better. Nice even distribution of values:
Cool, set the desired output resolution and hit render:
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:
Rendered image should remain the same:
What we have now is a single texture map, that flows along the surface of the mesh. Time to turn on displacement again:
Yikes! Adjusting parameters..:
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:
And we are done!
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:
Here’s another one, this time with a torus:
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.