Jump to content

Recommended Posts

Posted

1. Does not work on current beta build (invisible). Can be fixed with new Lighting.glsl shader which was not yet added to build.

2. On one side normal looks correct like scratch and on other like "vein":image.thumb.png.07e17ab047997e80c8ab92056b7715c5.png

3. If surface have normal map, decal looks wrong by having different color and visible borders. Most likely it's happens due full "rewrite" of surface normal map.

Can be decal normal map be just "above" or something like that to prevent it?

 image.thumb.png.720041aa3c06613d94234948c1a5637a.png

Map, mats, shader:

DecalNormals.zip

Check out Slipgate Tactics demo, which is made with Ultra Engine:

https://www.leadwerks.com/community/topic/61480-slipgate-tactics-demo/

  • 1 month later...
Posted

I just had to change the normal argument for RenderLighting to inout and it fixed the problem I think:

screenshot652.thumb.jpg.f1d22e863f6d50ef015364088fd15611.jpg

My job is to make tools you love, with the features you want, and performance you can't live without.

Posted
On 3/14/2025 at 10:10 PM, Dreikblack said:

2. On one side normal looks correct like scratch and on other like "vein":

3. If surface have normal map, decal looks wrong by having different color and visible borders. Most likely it's happens due full "rewrite" of surface normal map. Can be decal normal map be just "above" or something like that to prevent it?

2. This looks correct. On the right side, most of the light come from the sun from the side, so the left side of the crack is lit. On the left face, the only light is coming from the diffuse skybox, so the bottom edge of the crack is lit. It can be helpful to set IBL lighting to zero when testing these things, to better see what is happening.

3. You can use an opacity map to control the alpha weight of the normal and other maps, when a base color texture is not in use.

My job is to make tools you love, with the features you want, and performance you can't live without.

Posted
7 hours ago, Josh said:

2. This looks correct. On the right side, most of the light come from the sun from the side, so the left side of the crack is lit. On the left face, the only light is coming from the diffuse skybox, so the bottom edge of the crack is lit. It can be helpful to set IBL lighting to zero when testing these things, to better see what is happening.

It's not light.

0 IBL, only sun light:

image.thumb.png.40040fd06845897b6f47e28b01f51320.png

And everything same, but decal rotated by 90:

image.thumb.png.dfee22d950db97277d1f7ca5d5fdac45.png

It looks like normal map is reverted or something for some of decal "faces"

7 hours ago, Josh said:

3. You can use an opacity map to control the alpha weight of the normal and other maps, when a base color texture is not in use.

Opacity map does exactly nothing. Same effect if it's full red or black.

Check out Slipgate Tactics demo, which is made with Ultra Engine:

https://www.leadwerks.com/community/topic/61480-slipgate-tactics-demo/

Posted

Okay, this seems to be the magic formula:

if (dot(decalnormalmatrix[axis], facenormal) < 0.0f) decalnormalmatrix[axis] *= -1.0f;// flip if facing wrong way
//if (dot(decalnormalmatrix[2], facenormal) < 0.0f) decalnormalmatrix = -decalnormalmatrix;// flip if facing wrong way

 

My job is to make tools you love, with the features you want, and performance you can't live without.

Posted

The shader reads the red channel of the opacity texture:

if (mtl.textureHandle[TEXTURE_OPACITY] != uvec2(0))
{
	color.a = texture(sampler2D(mtl.textureHandle[TEXTURE_OPACITY]), decalcoords).r;
}

 

My job is to make tools you love, with the features you want, and performance you can't live without.

Posted
9 minutes ago, Dreikblack said:

Is there a way to change total opacity for specific decal instance in runt time btw?

I updated the shader so it will consider the entity alpha as well.

if (mtl.textureHandle[TEXTURE_OPACITY] != uvec2(0))
{
	color.a *= texture(sampler2D(mtl.textureHandle[TEXTURE_OPACITY]), decalcoords).r;
}

 

  • Like 1

My job is to make tools you love, with the features you want, and performance you can't live without.

  • Solution
Posted

Perhaps the original normal map is wrong? You can see in my screenshot above that the decal normals match the object with that material applied to it.

+red should point to the right
+green should point up

My job is to make tools you love, with the features you want, and performance you can't live without.

Posted

You can see it appears the scratches are sticking out of the surface with this normal map, when applied to a box.

screenshot660.thumb.jpg.00b6d6a4ebe0d2ad992f35ebcf642780.jpg

When I flip the normal map vertically it appears as expected.

screenshot661.thumb.jpg.0404299cbba1b321a7703e8a661f594f.jpg

My job is to make tools you love, with the features you want, and performance you can't live without.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...