• 3D
  • Apply Mask Texture to Spatial Material

Hello,

I try to explain the problem I have as good as possible.

I'm using a Spatial Material for my Meshes, what works fine. Now I have a Texture that represents blood splatters and I want to lay it over the Albedo texture within my material. The mask texture is black and white. How can I handle this and if possible without the use of shaders? If it's only possible with shaders, where I have to start?

Cheers Z3R0PTR

I have not used it myself, but I believe you can accomplish this through a second material pass, like the cartoon/outline effect in the Material Test in the Godot Demo repository. I believe you need to input the lbakc and white mask texture to the Detail field (documentation) of the second material. That should make it where the second material only appears where the mask texture tells it to.

Hi TwistedTwigleg,

thanks for your reply. I played around with the detail section before, but without success. Unfortunately the "Detail" settings won't work for me and the example with the materials didn't help (maybe I didn't see the solution). But anyway it's a good example for the different material related things. It'll be very usefull for me.

I figured out a way that seems to work. At the image below you can see how it looks before (left) and after the changes (right). Now the blood decals are visible.

I simply created a seconds material with albedo color red and no texture. The blend mode is set to "Add" and the ambient occlusion activated with the mask image as texture and applied on UV2. This second material I put into the "Next Pass" of the first material.

I'm sure this isn't the right way (or is it?), but for now it works. I'll wait a little and if nobody else has a better solution, I'll mark this thread as answered.

Again, many thanks to you.

Cheers Z3R0PTR

EDIT: After reading you post again, I read your hint about the second pass. You've pointed me in the right direction, but I looked over the solution. :D

Ok. I played around with the settings and come along as follows.

It definitely looks better. I changed the second (blood decal) material as follows:

Blend Mode: Add Albedo Color: Red Albedo Texture: The same texture as the main material. Ambient Occlusion: DEACTIVATED (and cleared)

Detail ENABLED with following settings: Detail Mask: Empty Blend Mode: Sub Uv Layer: UV2 Albedo: Blood Decal Texture

But why it looks so good at the skin (green circles) and so dark at the clothes (yellow circles)?

Any suggestions to get a better result?

My guess is the issue is the blend mode. on the blood material/decal Is there a mix option? I think a mix blend mode may be fix the issue, based on the limited information I know about shaders and color mixing.

Well, I can only think that the subtractive blend mode must be the one causing the black, since I don't think add would result in black.

Hello,

thanks for your replies. I'll try to give some more information.

Here is a part of the mask (blood decal) texture:

Here a view of the default texture with the most important settings. There is a normal map and an emission texture on it, nothing else. This is without the blood material as second pass:

Here is the blood applied as next pass and the important settings for the blood material are visible:

Here the rest of the blood material settings:

If I change the "Blend Mode" within the "Parameters" to anything other than "Add", for example to "Mix", it will look like this:

If i change the "Blend Mode" within the "Detail" settings to anything other than "Sub", for example to "Mix", it'll look like this:

I try to understand the issue, but I don't know where to start. Maybe the base (the blood decal mask) is wrong, so try and error will never lead to success.

Cheers Z3R0PTR

Maybe set the texture in the Albedo to the mask texture? Or maybe make the texture in the Albedo transparent where you do not want the details to show up? I dunno right off, but that's what I'd try, since changing the blend modes are not giving desired results.

The detail settings work fine, but with this kind of mask/blood decal texture and the different blend modes, I only got the results as in the posts above. The blending is not the problem, but to get the red color to the blended areas.

I became aware of the idea with transparency at the beginning, but I hoped it would work via masking. Now you mentioned the transparency too, so I finally decided to give it a try.

I edited the blood decal texture and converted the black color to transparency and colored the white parts in red (I took the blood color from the base texture which is an atlas texture).

Now I have the following setup for the main material:

And the result looks like this:

The blood splatter at the womens head bandage is the original color from the base texture, not from the details (only for comparison).

This will work for me at the moment (and worked with a dirt detail texture too that I used for other things). Now it is an already precolored simple overlay texture.

Again many thanks for your help.

Cheers Z3R0PTR