Dreikblack Posted March 15 Posted March 15 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": 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? Map, mats, shader: DecalNormals.zip Quote Check out Slipgate Tactics demo, which is made with Ultra Engine: https://www.leadwerks.com/community/topic/61480-slipgate-tactics-demo/
Josh Posted May 14 Posted May 14 I just had to change the normal argument for RenderLighting to inout and it fixed the problem I think: Quote My job is to make tools you love, with the features you want, and performance you can't live without.
Dreikblack Posted May 15 Author Posted May 15 What was fixed? I still have 2 and 3 issues with latest update and shader Quote Check out Slipgate Tactics demo, which is made with Ultra Engine: https://www.leadwerks.com/community/topic/61480-slipgate-tactics-demo/
Josh Posted May 15 Posted May 15 Will take another look tomorrow. Quote My job is to make tools you love, with the features you want, and performance you can't live without.
Josh Posted May 15 Posted May 15 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. Quote My job is to make tools you love, with the features you want, and performance you can't live without.
Dreikblack Posted May 16 Author Posted May 16 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: And everything same, but decal rotated by 90: 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. Quote Check out Slipgate Tactics demo, which is made with Ultra Engine: https://www.leadwerks.com/community/topic/61480-slipgate-tactics-demo/
Josh Posted May 16 Posted May 16 Looks like the tangent / bitangent might be flipped on some mapping axes... normaltest.zip Quote My job is to make tools you love, with the features you want, and performance you can't live without.
Josh Posted May 16 Posted May 16 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 Quote My job is to make tools you love, with the features you want, and performance you can't live without.
Josh Posted May 16 Posted May 16 Opacity map works as expected. Imperfections.zip Quote My job is to make tools you love, with the features you want, and performance you can't live without.
Josh Posted May 16 Posted May 16 (Crosses fingers) Quote My job is to make tools you love, with the features you want, and performance you can't live without.
Dreikblack Posted May 16 Author Posted May 16 11 minutes ago, Josh said: Opacity map works as expected. So it's RGB channels and not just red? Now i have effect. Is there a way to change total opacity for specific decal instance in runt time btw? Quote Check out Slipgate Tactics demo, which is made with Ultra Engine: https://www.leadwerks.com/community/topic/61480-slipgate-tactics-demo/
Josh Posted May 16 Posted May 16 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; } Quote My job is to make tools you love, with the features you want, and performance you can't live without.
Josh Posted May 16 Posted May 16 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; } 1 Quote My job is to make tools you love, with the features you want, and performance you can't live without.
Dreikblack Posted May 18 Author Posted May 18 Now lightning is wrong and depends on decal rotation. y = 0: y = 90: And if i make full white ambient light dark sides are still dark 1 Quote Check out Slipgate Tactics demo, which is made with Ultra Engine: https://www.leadwerks.com/community/topic/61480-slipgate-tactics-demo/
Josh Posted May 18 Posted May 18 Okay, I got it all worked out. This normal map and scene were very useful for testing. DecalTest.zip Quote My job is to make tools you love, with the features you want, and performance you can't live without.
Dreikblack Posted May 19 Author Posted May 19 Now all faces are flipped for imperfection decal bump: Quote Check out Slipgate Tactics demo, which is made with Ultra Engine: https://www.leadwerks.com/community/topic/61480-slipgate-tactics-demo/
Solution Josh Posted May 19 Solution Posted May 19 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 Quote My job is to make tools you love, with the features you want, and performance you can't live without.
Dreikblack Posted May 19 Author Posted May 19 I used this one https://www.leadwerks.com/community/files/file/2664-scratches005/ Quote Check out Slipgate Tactics demo, which is made with Ultra Engine: https://www.leadwerks.com/community/topic/61480-slipgate-tactics-demo/
Josh Posted May 19 Posted May 19 You can see it appears the scratches are sticking out of the surface with this normal map, when applied to a box. When I flip the normal map vertically it appears as expected. Quote My job is to make tools you love, with the features you want, and performance you can't live without.
Dreikblack Posted May 19 Author Posted May 19 I guess i will just flip normal textures then. Maybe some of them made for renderers with flipped values or something Quote Check out Slipgate Tactics demo, which is made with Ultra Engine: https://www.leadwerks.com/community/topic/61480-slipgate-tactics-demo/
Recommended Posts
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.