add
This commit is contained in:
31
Assets/CoolapeFrame/3rd/NGUI_Enhance/DepthMask/DepthMask.mat
Normal file
31
Assets/CoolapeFrame/3rd/NGUI_Enhance/DepthMask/DepthMask.mat
Normal file
@@ -0,0 +1,31 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: DepthMask
|
||||
m_Shader: {fileID: 4800000, guid: cc1322ee3ca944285a41159a04969657, type: 3}
|
||||
m_ShaderKeywords:
|
||||
m_LightmapFlags: 5
|
||||
m_EnableInstancingVariants: 0
|
||||
m_DoubleSidedGI: 0
|
||||
m_CustomRenderQueue: -1
|
||||
stringTagMap: {}
|
||||
disabledShaderPasses: []
|
||||
m_SavedProperties:
|
||||
serializedVersion: 3
|
||||
m_TexEnvs:
|
||||
- _MainTex:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Floats: []
|
||||
m_Colors:
|
||||
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
--- !u!1002 &2100001
|
||||
EditorExtensionImpl:
|
||||
serializedVersion: 6
|
||||
@@ -0,0 +1,4 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bf642064f6d6442e093c7bd84748dc16
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
@@ -0,0 +1,10 @@
|
||||
Shader "Depth Mask" {
|
||||
SubShader {
|
||||
Tags {"Queue" = "Geometry-10" }
|
||||
Lighting Off
|
||||
ZTest LEqual
|
||||
ZWrite On
|
||||
ColorMask 0
|
||||
Pass {}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cc1322ee3ca944285a41159a04969657
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fd494b640d3d8429c99e83d06c010957
|
||||
folderAsset: yes
|
||||
timeCreated: 1484616171
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
1255
Assets/CoolapeFrame/3rd/NGUI_Enhance/DepthMask/Examples/Demo.unity
Normal file
1255
Assets/CoolapeFrame/3rd/NGUI_Enhance/DepthMask/Examples/Demo.unity
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,4 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 50eeccc78c7da46cf88c33e6c31ac259
|
||||
DefaultImporter:
|
||||
userData:
|
||||
40
Assets/CoolapeFrame/3rd/NGUI_Enhance/DepthMask/readMe.txt
Normal file
40
Assets/CoolapeFrame/3rd/NGUI_Enhance/DepthMask/readMe.txt
Normal file
@@ -0,0 +1,40 @@
|
||||
Unity3D 用Depth Mask实现的遮罩技术
|
||||
|
||||
Unity3D 用Depth Mask实现的遮罩技术
|
||||
遮罩技术是一个基本的技术方法,有很多很多中用法.你可以在Flash中经常看到遮罩的使用,
|
||||
它可以另一些视觉元素更加惊艳.当我看到Unity中没有包含任何几何体和图片的遮罩技术
|
||||
很不爽,不过,幸运的我找到了解决方案,就是"Depth Mask"着色器.
|
||||
|
||||
先看看着色器的代码,没错,非常短.
|
||||
|
||||
Shader "Depth Mask" {
|
||||
|
||||
SubShader{
|
||||
ColorMask 0
|
||||
Pass {}
|
||||
}
|
||||
}
|
||||
|
||||
如果用了多维材质,你需要像下面这样写:
|
||||
|
||||
Shader "Depth Mask Complex"
|
||||
{
|
||||
SubShader
|
||||
{
|
||||
Tags {"Queue" = "Background"}
|
||||
Blend SrcAlpha OneMinusSrcAlpha
|
||||
Lighting Off
|
||||
ZWrite On
|
||||
ZTest Always
|
||||
Pass
|
||||
{
|
||||
Color(0,0,0,0)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
如果你想更改任何一个物体材质的特性座遮罩(纹理,颜色等等)将是失败的,
|
||||
除非你用SetPass()去设置着色器,关于这个方法的文档在这
|
||||
(http://unity3d.com/support/documentation/ScriptReference/Material.SetPass.html).
|
||||
|
||||
示例项目下载:http://pixelplacement.com/wp-content/uploads/2011/02/Masking.zip
|
||||
@@ -0,0 +1,4 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f41b9042f18254384bff34c0e4f9db96
|
||||
TextScriptImporter:
|
||||
userData:
|
||||
Reference in New Issue
Block a user