• Unity4中的lightmap怎么在Unity5及其以上版本中使用


    Unity5的Lightmap管线与Unity4的有很大的不同了,u5不能直接使用u4的lightmap。但是u5中,可以把u4的lightmap当作光照贴图来使用,就像一张普通的贴图一样,具体可以参考 Lightmap-xxxx.shader之类的shader, 如:
    Lightmap-Bumped.shader
    Lightmap-BumpSpec.shader
    Lightmap-Diffuse.shader
    Lightmap-Glossy.shader
    Lightmap-VertexLit.shader

    具体如 :Lightmap-Diffuse.shader

    Shader "Legacy Shaders/Lightmapped/Diffuse" {
    Properties {
        _Color ("Main Color", Color) = (1,1,1,1)
        _MainTex ("Base (RGB)", 2D) = "white" {}
        _LightMap ("Lightmap (RGB)", 2D) = "black" {}
    }
    
    SubShader {
        LOD 200
        Tags { "RenderType" = "Opaque" }
    CGPROGRAM
    #pragma surface surf Lambert nodynlightmap
    struct Input {
      float2 uv_MainTex;
      float2 uv2_LightMap;
    };
    sampler2D _MainTex;
    sampler2D _LightMap;
    fixed4 _Color;
    void surf (Input IN, inout SurfaceOutput o)
    {
      o.Albedo = tex2D (_MainTex, IN.uv_MainTex).rgb * _Color;
      half4 lm = tex2D (_LightMap, IN.uv2_LightMap);
      o.Emission = lm.rgb*o.Albedo.rgb;
      o.Alpha = lm.a * _Color.a;
    }
    ENDCG
    }
    FallBack "Legacy Shaders/Lightmapped/VertexLit"
    }

    本来是Unity引擎lightmap管线自动设定的lightmap贴图以及scale offset等值,现在需要在材质中明确指定了:也就是需要显式设定 _Lightmap 和 _Lightmap_ST 了。

  • 相关阅读:
    python 约束与异常处理
    ActiveMQ
    SpringMVC项目,启动项目怎么总是报找不到log4j.properties文件
    java 字符串处理
    java面向对象学习笔记
    JSONArray遍历
    get/post方式调用http接口
    IO流认识
    Apache Mina 入门实例
    “wsimport -keep ”生成客户端报错“Use of SOAP Encoding is not supported.”
  • 原文地址:https://www.cnblogs.com/open-coder/p/13910956.html
Copyright © 2020-2023  润新知