1
$\begingroup$

I have an asymmetrical Mesh with sculpted bubbles on it (edit: and a Multires Modifier). I would like to use a procedural shader and color the elevated bubbly parts differently from the rest.

This is an example of what it could look like:

enter image description here

As the bubbles can have different heights and are not equally positioned along any axis or the objects origin, using a Gradient Texture or Geometry Node with Separate Z axis like for these examples does not work of course:

enter image description here enter image description here

I would need a condition based on the actual distance from the Mesh surface > 0. I found the Math Vector Node in Distance Mode which sounds promising, but I don't now how/if I could use it in my case.

Any ideas howto address the elevated areas? Can it be done by using only procedural nodes?

[using Blender 2.82]

$\endgroup$
3
  • 2
    $\begingroup$ A shader cannot show distance from the surface because in this case it is always on the surface. You could probably use Geometry node's pointiness output to achieve something like this to some extent. Or you could make the bumps with displacement so that you have a height map anyway. $\endgroup$ Apr 20, 2020 at 17:39
  • 1
    $\begingroup$ You could work out something if you keep the base mesh without the bubbles and a dynamic paint setup with a canvas / brush set to "Proximity" but as Martynas stated, you won't be able to do it fully procedurally in the shader editor since the vertices are unaware of the entirety of the mesh they are a part of. $\endgroup$
    – Gorgious
    Apr 20, 2020 at 18:59
  • $\begingroup$ Ok .. I thought maybe as the Multires isn't applied there could be a way to access the original surface data / calc the geo height or sth., so my answer to this task is, it is not possible to achieve by just using nodes or Modifiers if the bubbles are sculpted as in my file. Thanks for your comments. $\endgroup$
    – ho.s
    Apr 20, 2020 at 19:37

2 Answers 2

3
$\begingroup$

This is rather easy to do with an object that has a MultiResolution modifier as you mentioned. Such a mesh offers the possibility to bake the displacement from the base mesh to the subdivided one into a 32bit displacement map, and re-use that input for color ramps to drive the material color. Such a workflow also allows you to clearly distinguish between indentations and elevations as a bonus.

First, create your mesh as usual, and make sure there is a proper UV map to it. This UV map is critical for baking, so the better the layout, the better the displacement quality. Sculpt your detail into the MultiResolution modifier.

Next, create a texture of a reasonable size (I chose a 2K image in this example), and make sure it uses 32bit Float. This will make sure that there is enough image depth available to avoid banding artefacts in the texture, making it perfectly smooth:

enter image description here

Now create a material on the object, and use the image in the node tree, connecting it with the UV map. It doesn't matter yet where you connect the texture to, but you can already pipe it into a color ramp and the result of that into the Shader:

enter image description here

Now make sure that the image texture node in the Shader Node Tree is the active node (white highlight frame around it):

enter image description here

You are now ready to bake the displacement. The mode we will use records the difference between the Preview level of the modifier and the highest sculpt level, so in general you will set the preview level to 0 before baking:

enter image description here

Go to the Render Properties tab in the Properties Editor, and open the Bake Panel. Set the options as follows to bake the Multires Displacement data into a map:

enter image description here

By now, your object should look like this:

enter image description here

And after re-enabling the Preview subdivision levels to the max, like this:

enter image description here

$\endgroup$
1
  • $\begingroup$ Thanks for your detailed, well explained answer! Although I solved the original work in the meantime with the Vertex Paint approach I'll accept your answer bcs. it solves the original task best (plus I learned a lot, didn't know of this possibility) $\endgroup$
    – ho.s
    May 27, 2020 at 15:52
0
$\begingroup$

As the comments state, there does not seem to be a solely procedural shading solution for the purpose to address the elevated areas of the sculpted Mesh.

But as I did not want to make a whole different approach to generate bubbles, I tried to find a solution being abled to work with the present Mesh. I used Vertex Paint and am happy with the result:

enter image description here

Steps:

  1. Apply the Multiresolution Modifier
  2. Add a new Vertex Color Slot in the Object Data Properties Panel (I named it BubbleCol)
  3. In Vertex Paint Mode paint the elevated areas
  4. In Shader / Node Editor add an Attribute Node and put the (exact!) name of the Vertex Color Slot in
  5. Now you can use either the color output directly or as I did: Use the factor output of the Attribute Node to Mix two different shaders. This way it could be a different shader material too instead of only a different color.
$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .