zoukankan      html  css  js  c++  java
  • unity3D shader学习

    网络信息汇总
     
    unity内部阴影的使用

    阴影的投射只要有shadow caster通道即可;
    阴影接受的计算:

    方法1

    1 #pragma multi_compile_fwdbase
    2  #include “AutoLight.cginc”
    3  SHADOW_COORDS(1) // put shadows data into TEXCOORD1
    4  TRANSFER_SHADOW(o)
    5  fixed shadow = SHADOW_ATTENUATION(i);

    方法2

     #pragma multi_compile_fwdbase
    // after CGPROGRAM;
    #include "AutoLight.cginc"
     
    // in v2f struct;
    LIGHTING_COORDS(0,1) // replace 0 and 1 with the next available TEXCOORDs in your shader, don't put a semicolon at the end of this line.
     
    // in vert shader;
    TRANSFER_VERTEX_TO_FRAGMENT(o); // Calculates shadow and light attenuation and passes it to the frag shader.
     
    //in frag shader;
    float atten = LIGHT_ATTENUATION(i); // This is a float for your shadow/attenuation value, multiply your lighting value by this to get shadows. Replace i with whatever you've defined your input struct to be called (e.g. frag(v2f [b]i[/b]) : COLOR { ... ).
    

    方法3

    #pragma multi_compile_fwdbase
    #include "AutoLight.cginc"
    UNITY_LIGHTING_COORDS(6,7)
    UNITY_TRANSFER_LIGHTING(o, v.uv1);
    UNITY_LIGHT_ATTENUATION(atten, i, s.posWorld);
     
     
  • 相关阅读:
    HDU5120
    POJ 1062
    POJ 1086
    BestCoder 1st Anniversary (HDU 5311)
    HDU 5284
    Dylans loves sequence(hdu5273)
    day65 作业
    第三次小组分享 猴子补丁
    day59 csrf auth
    day58 cookie session 中间件
  • 原文地址:https://www.cnblogs.com/guilt/p/13883396.html
Copyright © 2011-2022 走看看