Hi !
The following situation:
I have a landscape created in Maya with a UV-mapped texture that is pretty detailed.
Now I want to have a second UV set on the object that is for displaying a repeating grass layer on the landscape.
I´ve managed to export the object with 2 UV sets but the useage in Unity is rather new to me.
How can I tell unity to use a specific UV set for a specific texture on the object ?
So to sum it up:
-I have 1 UV set on the object that displays a rather big and detailed texture for the complete landscape.
- I want to have a second UV set that is simply using a small 256x256 texture at some places on the landscape to form the grass.
- My object needs to have 2 UV sets and I need to be able to choose the appropriate UV set for the according texture.
How can I do such ?
Thx.
Found the answer myself. :?
It’s a good idea to post the answer, even if you find it yourself. That way, people searching the forum will be able to find it.
I know, but seriously I got a little discouraged when I found out that the answer was in the community-wiki and noone even was able to point me into that direction…while I was spending 2 days to find a solution.
Decal2UVs:
http://www.unifycommunity.com/wiki/index.php?title=Decal2UVs
Shader " Decal (2 UV sets)" {
Properties {
_Color ("Main Color", Color) = (1,1,1,1)
_SpecColor ("Spec Color", Color) = (1,1,1,1)
_Emission ("Emmisive Color", Color) = (0,0,0,0)
_Shininess ("Shininess", Range (0.01, 1)) = 0.7
_MainTex ("Base (RGB)", 2D) = "white" {}
_DecalTex ("Decal (RGBA)", 2D) = "black" {}
}
SubShader {
Material {
Diffuse [_Color]
Ambient [_Color]
Shininess [_Shininess]
Specular [_SpecColor]
Emission [_Emission]
}
Pass {
BindChannels {
Bind "Vertex", vertex
Bind "normal", normal
Bind "texcoord", texcoord0 // main uses 1st uv
Bind "texcoord1", texcoord1 // decal uses 2nd uv
}
Lighting On
SeperateSpecular On
SetTexture [_MainTex] {combine texture}
SetTexture [_DecalTex] {combine texture lerp (texture) previous}
SetTexture [_MainTex] {combine previous * primary DOUBLE, previous * constant constantColor [_Color]}
}
}
Fallback " VertexLit", 1
}
Struggling on now…
Need to modify the shader to have an additional bumpmaplayer on the second UV set.
Things are hard if you´re new to Unity and never programmed shaders before.
Anyone got an idea ?