Unity 3D多个UV集 [英] Unity 3D multiple UV sets
本文介绍了Unity 3D多个UV集的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我创建了一个具有纹理和AO的对象,它们在maya(具有分层纹理)中的不同UV集合上,并且在maya中,混搭看起来还可以.
I have created an object that has the texture and an AO , they are on different UV sets in maya(with Layered Texture) and in maya the mash looks ok.
我如何在Unity3D中达到相同的效果?
How do i achive the same effect in Unity3D?
我无法统一使用第二个UV装置.
I can not make unity use the 2nd UV set.
推荐答案
您需要编写一个可实现此目的的着色器.这是一个非常简单的示例,但是您可能需要对镜面反射等进行更精细的设置.
You'll need to write a shader that does this. Here's a very minimal example, but you'd probably need to have a more elaborate setup for things specular, etc.
Shader "Custom/twotex" {
Properties {
_MainTex ("Base (RGB)", 2D) = "white" {}
_AoTex ("AO (RGB)", 2D) = "white" {}
}
SubShader {
Tags { "RenderType"="Opaque" }
LOD 200
CGPROGRAM
#pragma surface surf Lambert
sampler2D _MainTex;
sampler2D _AoTex;
struct Input {
float2 uv_MainTex : TEXCOORD0;
float2 uv_AoTex : TEXCOORD1;
};
void surf (Input IN, inout SurfaceOutput o) {
half4 c = tex2D (_MainTex, IN.uv_MainTex.xy);
half4 ao = tex2D (_AoTex, IN.uv_AoTex.xy);
o.Albedo = c.rgb * ao.rgb;
o.Alpha = c.a;
}
ENDCG
}
FallBack "Diffuse"
}
这篇关于Unity 3D多个UV集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文