zoukankan      html  css  js  c++  java
  • 让Surface Shader不受光照的明暗影响

    直接上码

     1 Shader "Custom/3DVideo" {
     2     Properties {
     3         _Color ("Color", Color) = (1,1,1,1)
     4         _MainTex ("Albedo (RGB)", 2D) = "white" {}
     5         _Glossiness ("Smoothness", Range(0,1)) = 0.5
     6         _Metallic ("Metallic", Range(0,1)) = 0.0
     7         _x("x", Range(0.1, 1)) = 1
     8         _y("y", Range(0.1, 1)) = 1
     9     }
    10     SubShader {
    11         Tags { "RenderType"="Opaque" }
    12         LOD 200
    13         Cull Front 
    14         Lighting Off
    15 
    16         CGPROGRAM
    17         // Physically based Standard lighting model, and enable shadows on all light types
    18         // #pragma surface surf Standard fullforwardshadows
    19         #pragma surface surf Unlit noambient
    20 
    21         // Use shader model 3.0 target, to get nicer looking lighting
    22         #pragma target 3.0
    23 
    24         half4 LightingUnlit (SurfaceOutput s, half3 lightDir, half atten) {
    25            return fixed4(s.Albedo, s.Alpha);
    26         }
    27 
    28         sampler2D _MainTex;
    29         float _x;
    30         float _y;
    31 
    32         struct Input {
    33             float2 uv_MainTex;
    34         };
    35 
    36         half _Glossiness;
    37         half _Metallic;
    38         fixed4 _Color;
    39 
    40         // Add instancing support for this shader. You need to check 'Enable Instancing' on materials that use the shader.
    41         // See https://docs.unity3d.com/Manual/GPUInstancing.html for more information about instancing.
    42         // #pragma instancing_options assumeuniformscaling
    43         UNITY_INSTANCING_BUFFER_START(Props)
    44             // put more per-instance properties here
    45         UNITY_INSTANCING_BUFFER_END(Props)
    46 
    47         // void surf (Input IN, inout SurfaceOutputStandard o) {
    48         void surf (Input IN, inout SurfaceOutput o) {
    49             float2 uv_XY = IN.uv_MainTex;
    50             float2 uv_MainTex2 = float2(uv_XY.x * _x, uv_XY.y * _y);
    51             // Albedo comes from a texture tinted by color
    52             fixed4 c = tex2D (_MainTex, uv_MainTex2) * _Color;
    53             o.Albedo = c.rgb;
    54             // Metallic and smoothness come from slider variables
    55             // o.Metallic = _Metallic;
    56             // o.Smoothness = _Glossiness;
    57             o.Alpha = c.a;
    58         }
    59         ENDCG
    60     }
    61     FallBack "Diffuse"
    62 }
  • 相关阅读:
    直接插入排序
    希尔排序
    堆排序
    红黑树
    hashMap原理
    JAVA随笔4
    JAVA随笔3(集合框架,流)
    Linux环境下如何生成core文件
    Centos6 升级glibc-2.17,解决Requires: libc.so.6(GLIBC_2.14)(64bit)错误解决方法
    MediaWiki搭建步骤
  • 原文地址:https://www.cnblogs.com/linxmouse/p/9762049.html
Copyright © 2011-2022 走看看