【原】Shader:Diffuse+CubeMap+LightMap

今天因为项目需求,写了个同时支持CubeMap和LightMap的Shader:
(拿坦克为例如下)有需要的童鞋可以直接拿来用。
【原】Shader:Diffuse+CubeMap+LightMap - X-droid - =六道异次元之Ω空间=
 
【原】Shader:Diffuse+CubeMap+LightMap - X-droid - =六道异次元之Ω空间=
 
【原】Shader:Diffuse+CubeMap+LightMap - X-droid - =六道异次元之Ω空间=
 

Shader "Xdroid/CubeLightmap" {
Properties {
    _Color ("Main Color", Color) = (1,1,1,1)
    _ReflectColor ("Reflection Color", Color) = (1,1,1,0.5)
    _MainTex ("Base (RGB) RefStrength (A)", 2D) = "white" {}
    _Cube ("Reflection Cubemap", Cube) = "_Skybox" { TexGen CubeReflect }
    _LightMap ("Lightmap (RGB)", 2D) = "lightmap" { LightmapMode }
}
SubShader {
    LOD 200
    Tags { "RenderType"="Opaque" }
    
CGPROGRAM
#pragma surface surf Lambert
sampler2D _MainTex;
samplerCUBE _Cube;
sampler2D _LightMap;
fixed4 _Color;
fixed4 _ReflectColor;
struct Input {
    float2 uv_MainTex;
    float3 worldRefl;
    float2 uv2_LightMap;
};
void surf (Input IN, inout SurfaceOutput o) {
    fixed4 tex = tex2D(_MainTex, IN.uv_MainTex);
    fixed4 c = tex * _Color;
    o.Albedo = c.rgb;    
    half4 lm = tex2D(_LightMap,IN.uv2_LightMap);    
    fixed4 reflcol = texCUBE (_Cube, IN.worldRefl);
    reflcol *= tex.a;
    o.Emission = lm.rgb * reflcol.rgb * _ReflectColor.rgb;
    o.Alpha = reflcol.a * _ReflectColor.a * lm.a;
}
ENDCG
}    
FallBack "Reflective/VertexLit"
}

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值