Would like to know is there a way to unity read decal with normal map? (no skill creating shaders:-?)
What would you like to achieve exactly?
I’m working on building pack…and i was counting on simple decal stuff…like cracks, wall damages…etc. Something to spice up generic wall texture.
I know for decal stuff in Unity but it has different workflow…weird one. Now idea was in the beginning to create simple plane in 3dsmax which i will texture with decal texture…import in unity, and stick that on the wall. Something like this - Video
… this is cod2 engine (very old) it was very simple… choose decal brush, choose decal texture, stick that on wall, End. Tryed that in unity and got that flickering effect like when two polygons overlapping.
You can download my Decal System. It contains a bumped decal shader which won’t flicker. You can still use your plane, just pick the bumped decal shader for it.
will try…sound awesome!
Alternatively, you can add Offset -1, -1 to your pass.
That’s what happens in the Decal System shaders too. When someone writes “no skill creating shaders”, I though it would be a lot easier like that.
Shader "Decal-Bumped" {
Properties {
_Color ("Main Color", Color) = (1,1,1,1)
_MainTex ("Base (RGB)", 2D) = "white" {}
_DecalTex ("Decal (RGBA)", 2D) = "black" {}
_DecalBumpTex ("Decal Bump", 2D) = "bump" {}
}
SubShader {
Tags { "RenderType"="Opaque" }
LOD 300
CGPROGRAM
#pragma surface surf Lambert
sampler2D _MainTex;
sampler2D _DecalTex;
sampler2D _DecalBumpTex;
fixed4 _Color;
struct Input {
float2 uv_MainTex;
float2 uv_DecalTex;
};
void surf (Input IN, inout SurfaceOutput o) {
fixed4 c = tex2D(_MainTex, IN.uv_MainTex);
half4 decal = tex2D(_DecalTex, IN.uv_DecalTex);
c.rgb = lerp (c.rgb, decal.rgb, decal.a);
half3 bump = tex2D(_DecalBumpTex, IN.uv_DecalTex).rgb;
c *= _Color;
o.Albedo = c.rgb;
o.Normal = bump;
o.Alpha = c.a;
}
ENDCG
}
Fallback "Diffuse"
}
@aubergine, the goal is to get rid of generic wall texture. It is a lot harder to do it with that kind of shader compared to a transparent decal shader.
No luck downloading Decal System to test it…there is no download button…but i can download other stuff from AssetStore.
Don’t know what is issue now… mybe my Unity 4 version is wrong to use your D-system? Do you have other download links expect asset store?
Just try it again in a few minutes and restart Unity first. This can happen with the Asset Store. There is no alternative download link. In the case that it doesn’t work later, you can write again and I’ll see what I can do.
How do you mean?
With your shader it is not possible to place decals at any position with any size. If you pick a transparent texture and use it on a plane, you can place it wherever you want.
Why not, just make the decal and bump textures clamped and offset them whereever you want them to be shown. No need to render extra vertices to place on top of existing meshes. Atleast, thats how unity decal shader is supposed to work.
You are right that works, but it is not flexible. First you loose the advantage of batching with your approach, because it is very unlikely that you can use the same offset at different places, further you can only have one decal per material.
Ok.