1
$\begingroup$

So basically what I have done is made a high poly bake in blender, now using said bake, I want to add edge wear. That is have procedural texture detect the height in the maps and shade the maps "edges". [For reference : This feature is found in substance painter]

$\endgroup$
2
  • 2
    $\begingroup$ Normal maps only contain light reflection angles, not height information. If you're going to attempt an edge detect on an image texture, at least start with a height/displacement/curvature map. $\endgroup$ Commented Aug 26, 2020 at 0:29
  • $\begingroup$ @ChristopherBennett so there's absolutely no way to use normal map? ok cool...i'll edit the question, so can you show me how to use a height map instead? $\endgroup$
    – Tejas
    Commented Aug 26, 2020 at 0:34

2 Answers 2

2
$\begingroup$

The only way I know to do anything like this is to take the heightmap into the Compositor (I connected it as an emission, aligned the camera and rendered to get it this way - choose whatever method works best for you). The next step is to take the difference between a blurred version of the image and the original. Anywhere with a "sharp cutoff" will be highlighted (assisted by a ColorRamp). It isn't perfect, as you can see from the photos. I picked a "noisy" texture on purpose to how many non-edges I could eliminate, but it's still rather noisy. The success will depend on the "cleanliness" of the original heightmap.

Here is my node setup in the compositor. The original heightmap image is on the left.

Nodes1

Here are just the nodes (for easier viewing). You will have to adjust the ColorRamp to your needs (it can be rather finicky finding the correct range).

Nodes2

From here, it's just a matter of saving your image and using it as a mask for your material. Here's my original material without and with the whites of a Noise Texture added to the "edges" using the mask I made (color channel only).

Without "edge wear" mask: Edges1

With "edge wear" mask: Edges2

As you can see, it's not perfect. It's still a bit "noisy", however it is obeying the "rules", so to speak. The areas that are highlighted are the ones that have the harshest cuttoffs, it's just that I picked a "bumpy" texture to begin with. Hopefully your heightmap will be a bit cleaner (as I said, I picked the noisiest one I could find), and you will have more success.

Here's an example with a "clean" heightmap (keyboard):

Key1

Again, here is final material without "edge wear":

Key2

And here it is with the edge wear. Note- I know noise is not a great texture to emulate wear - I just used it as a quick way to get some distortion to the white.

Key3

$\endgroup$
0
$\begingroup$

I'm not sure if this answer your question, but since typing "edge wear" moves us here I'm thinking this solution may be interesting to some (note also that it works with normals baked from another high-poly).

Basically, just compute the dot product (in "vector math") between bevel and the normal (geometry). If you get your normals from an external file, replace the geometry node with your image as shown in the above video.

Warning: you must use cycle for that (EEVE does not have a working bevel). If you plan to use it later on EEVE, bake it to an image first using cycle and then import it from EEVE.

enter image description here

$\endgroup$
4
  • $\begingroup$ Interesting ... Hmmm... If I may asks question on your solution, what exactly does the dot product node do? Better yet, what's the difference between dot product and cross product nodes? $\endgroup$
    – Tejas
    Commented Apr 21, 2021 at 13:22
  • $\begingroup$ So first, note that it's not my creation, as I explained I took it from the video. Now, I think I can explain how it works: the "bevel" node will bevel (i.e. smooth the corners of) the shape. Now, when you take the normals of the bevelled shape and compare it with the actual normals of the body, you can easily see that they always match when the shape is flat because the bevel did not change anything (so the dot product will be maximum since the dot product quantifies how close/aligned are two vectors: when the vectors have norm 1, the dot product is just the cosinus of the angles). $\endgroup$
    – tobiasBora
    Commented Apr 21, 2021 at 13:48
  • $\begingroup$ Now, when you are at an edge, the bevel normals will not be aligned anymore with the normals of the object since the edge has been flattened, so the dot product is smaller. The "invert" node is just used to turn into white the small changes and black the large numbers. $\endgroup$
    – tobiasBora
    Commented Apr 21, 2021 at 13:52
  • $\begingroup$ Finally, about your question on cross product nodes, cross products are quite differents (cf wikipedia for precise definition), notably the cross product between two vectors is a vector, not a scalar like for dot product. Moreover, the length of the cross product vector is the sinus of the angle between the two angles, i.e. it is small when both vectors are close, and large when they are far (which is the opposite of the dot product). $\endgroup$
    – tobiasBora
    Commented Apr 21, 2021 at 13:52

You must log in to answer this question.

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