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"
}
详细解决方案
【原】Shader:Diffuse+CubeMap+LightMap
热度:10 发布时间:2023-12-08 08:39:53.0
今天因为项目需求,写了个同时支持CubeMap和LightMap的Shader:
(拿坦克为例如下)有需要的童鞋可以直接拿来用。
相关解决方案
- 求Unity3D shader lab可能shader model的资料(语言不限)
- 求Unity3D shader lab或者shader model的资料(语言不限)解决方案
- 模模糊糊 shader
- shader 画图出现“位错”解决方案
- Unity3D Shader 入门第一天
- {UE4]Game files required to initialize the global shader library are missing from
- unity 之 Shader
- Unity Editor -Cubemap
- NaN and infinity literals not allowed by shader model 错误解决方法
- 【原】Shader:Diffuse+CubeMap+LightMap
- Vertex Shader Pixel Shader 介绍
- Shader编写中遇到的BUG--Shader error in 'First': Parse error: syntax error, unexpected $undefined, expectin
- 【bug修复】低版本工程导入Unity2018 Shader 报错
- shader 入门 《顶点(vertexs) 图元(primitives) 片元(fragments片断) 像素(pixels)》