First of all, hello guys 8)
I am new to this community(I got the trial indie) and I want to apologize for my bad English.
So, I am trying to apply a 3rd UV to my mesh using a shader script or java-c# script.
I’ve tried two methods, the first is with 2 shader, one "I started making a mine shader that represent the 3rd UV:
Shader "multiUV" {
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" {}
_MultiTex ("Multi (RGB)", 2D) = "white" {}
}
SubShader {
Material {
Diffuse [_Color]
Ambient [_Color]
Shininess [_Shininess]
Specular [_SpecColor]
Emission [_Emission]
}
Pass {
Name "MULTI"
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 [_MultiTex] {combine texture lerp (texture) previous}
SetTexture [_MainTex] {combine previous * primary DOUBLE, previous * constant constantColor [_Color]}
}
}
Fallback " VertexLit", 1
}
And I’ve modified the “Lightmapped/Bumped Specular” shader in this way:
Shader "Lightmapped/Bumped Specular Overlay" {
Properties {
_Color ("Main Color", Color) = (1,1,1,1)
_SpecColor ("Specular Color", Color) = (0.5, 0.5, 0.5, 1)
_Shininess ("Shininess", Range (0.01, 1)) = 0.078125
_MainTex ("Base (RGB) Gloss (A)", 2D) = "white" {}
_MultiTex ("Multi (RGB)", 2D) = "white" {}
_BumpMap ("Bump (RGB)", 2D) = "bump" {}
_LightMap ("Lightmap (RGB)", 2D) = "black" {}
}
SubShader {
UsePass "Lightmapped/VertexLit/BASE"
UsePass "Bumped Specular/PPL"
UsePass "multiUV/MULTI"
}
FallBack "Lightmapped/Specular", 1
}
Using three “UsePass” is someway forbidden. It’s a bit hard to start with shader scripting for the first time trying to resolve that problem.
So I tried to use the “transfer UVs” script ( http://www.unifycommunity.com/wiki/index.php?title=UVTransfer ).
Now I got two identical meshes one with bumped specular shader and one with diffuse fast. What I’ve to do is to alter the first mesh after post-processing with the 3rd UV.
I’ve tried to use SetTexture function but is useless because it replaces the old tex with the one coming from the second mesh. Does exist another function that uses something like a projector instead of copying a new tex in the old one?
I am a newbie and I am trying to learn.
Thanks.