Fixed Function Shader

本文深入探讨Unity Shader中'Previous'值的理解与实际应用,通过实例代码演示其作用,帮助初学者清晰掌握Shader中纹理混合的关键概念。

1基本公式:

SetTexture [TexturePropertyName] { Texture Block }All the src properties can be either one of previous, constant, primary or texture.Previous is the the result of the previous SetTexture官方的解释 初学者看了很萌。本文主要证明Previous的值。首先举例:1。SubShader {                       Pass {                          // Apply base texture                        SetTexture [_MainTex] {                              combine texture                         }                     // Blend in the alpha texture using the lerp operator                       SetTexture [_BlendTex] {                                 combine texture lerp (texture) previous                      }                }            }以上shander代码中 previous很好理解 就是前一个SetTexture  combine完的结果2、SetTexture [_MainTex] {
    constantColor (1,1,1,1)
    combine constant lerp(texture) previous
}
// Multiply in texture
SetTexture [_MainTex] {
    combine previous * texture
}
第一个previous 该如何理解呢?它之前没有SetTexture喽!于事 本人就开始了大胆的各种猜想,假设previous 默认值为(0,0,0,0)测试1、没有灯 没有material的前提下测试2、   贴的是一张全透图片  alpha值为0 最终颜色为previous颜色 所以目前不是很确认previous的默认值为(0,0,0,0) 因为在有material和light on的时候 情况有变化  所以有待高手继续讨论 探究

转载于:https://www.cnblogs.com/U-tansuo/archive/2013/03/20/unity3d_shader2.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值