Decalmachine "under the hood"

I have a question i cant get an answer to on any of the blender forums i have asked on. I am interested in learning how an add like decalmachine works under the hood.

I am trying to create the kind of decals you get in addons like decalmachine. Some of them have been quite achievable with some work, while others are not working at all. I have added a video by Josh Gambrell to ilustrate what i am trying to do. At 24 minutes into the video, he adds a decal that looks like it is going at least a centimeter into the mesh. At 32.10 in the video he fixes the colour so it looks decent. Oh well, he says it is abit jagged on the edges but from afar it looks ok. Also, just before 31 minutes he adds a couple of decals that looks like it cuts pretty deep into the mesh looking pretty awesome.

I have tried to reproduce this in blender but i am having a really hard time. My method is to create textures with height and/or normal maps. One issue i am facing is that it is dificult to produce a displacement free of artifacts. I have got abit further on this after getting some help but i am not quite there. But if i manage to fix taht completely i will stil be stuck with a more troublesome issue, that the displaced decal will intersect with the mesh i use it on. That way most of the displacement will be hidden on the backside of the mesh, and the ilusion of depth is broken, Now, i dont know if this is the correct method, or if i am doing it the wrong way around or what! Maybe the way i have percieved that this works is wrong? What i do now is that decalmachine utilizes tools and actions that are in blender already so i believe it should be possible to do this with blender alone, though of course through a more complicated process.

So this is more than one single question on how to fix the spesific issue i am having right now. All you can throw at me on this issue is welcomed. Also, if you know of any good learning resources on the topic please link them. Payed as well as free ones! I know some will say that it is not possible in blender and that might hold some truth. But for a large part, decalmachine utilizes tools and functions that are already in blender. So i believe it is posible to at least create a result not far from what you get from decalmachine. Of course in a much more complicated way though.

I have added two images. One shows how the displaced mesh looks. This is a gradient created in gimp with a smooth transition from white to black. It is not good enough so i am looking for other methods. Maybe procedurally in blender?

The other inage shows what i mean when the displacement is broken because it intersects with the mesh. Is the way i percieve this to work completely wrong? Anyway, everything you can throw at me to get me in the right direction is welcome. Even though this is an issue i am facing right now, information to face similar issues later could be useful.

And finally, thank you for reading through the whole thing:)


Josh Gambells video:

Do a search on Parallax Mapping in Blender. All of the Decals work with Decal Machines own Parallax Shader Nodes…and yes this is all in Blender.

2 Likes

Thanks, i did some research on it and it is some really technical stuf. But getting this from you confirms that i am on the right path:)

1 Like
3 Likes

Oh thank you. I will look into it.

I asume there are diferent setups that produce diferent results, and that they do not work for any kind of use. I have tried a few setups but they dont give my texture a good result. I get tiling and really obscure results.

It has to be duplicated per object, because the height map image texture is inside a node group, and to this day this can’t just be made a switchable input. So you have to duplicate the nodes and switch out all the texture images.

Per decal/texture you mean, or per image texture used in the node setup?

Per decal.

I see.Well, that node setup probably works well. There is alot of stretching on the stones but the depth is definetly there. all. But it is all very confusing for me to wrap my head around so i need to ask a few more questions. I hope you dont mind.
Like i said, i have tried a few setups i got from diferent sources. They all give rather bad result, like the one that was tiling the texture. And they appear to work best on the textures already inplemented in the node setup. When i switch them with my own they give a much worse result, and dont look good at all.
So i am thingking that the diferent node trees have pros and cons, and cant be used with any texture?

No, the setup stays the same, only the images and UVs change. I.e. DECALmachine basically reuses the same node setup and just replaces images for you. PMO works with UV mapping (in that it both needs input UVs and it modifies the UVs to pass along to other textures). So long as that is understood, any texture combination for that specific UV map should work fine. But you’ll need at least both height and normal maps, and ideally all the other maps too (color, roughness, etc). If any of them don’t match the UV layout you won’t get particularly good results.

When yoy say “any texture combination” are you referring to the node setup or the diferent texture maps in it?

I don’t say “any texture combination”. I say “any texture combination for that specific UV map” :slight_smile: But yes, texture maps, not the whole setup.

1 Like

Alright, i guess i need to learn more basic node stuf so that i can get it working. Also i didnt have all the maps for the setup, so i had to reuse some in order to not get the pink missing texture color on the decal. It turned out showing a pretty good depth, but i couldnt change the color and i had to reroute the transparancy from another node.