AlbertPRoss wrote:Here is the old Unity shader. I've used it for vegetation and hair in mobile games.
- Code: Select all
// Compiled shader for PC, Mac & Linux Standalone
//////////////////////////////////////////////////////////////////////////
//
// NOTE: This is *not* a valid shader file, the contents are provided just
// for information and for debugging purposes only.
//
//////////////////////////////////////////////////////////////////////////
// Skipping shader variants that would not be included into build of current scene.
Shader "Legacy Shaders/Transparent/Cutout/Soft Edge Unlit" {
Properties {
_Color ("Main Color", Color) = (1.000000,1.000000,1.000000,1.000000)
_MainTex ("Base (RGB) Alpha (A)", 2D) = "white" { }
_Cutoff ("Base Alpha cutoff", Range(0.000000,0.900000)) = 0.500000
}
SubShader {
Tags { "QUEUE"="AlphaTest" "IGNOREPROJECTOR"="true" "RenderType"="TransparentCutout" }
// Stats for Vertex shader:
// d3d11: 9 math
// Stats for Fragment shader:
// d3d11: 3 math, 1 texture
Pass {
Tags { "QUEUE"="AlphaTest" "IGNOREPROJECTOR"="true" "RenderType"="TransparentCutout" }
Cull Off
//////////////////////////////////
// //
// Compiled programs //
// //
//////////////////////////////////
//////////////////////////////////////////////////////
No keywords set in this variant.
-- Hardware tier variant: Tier 1
-- Vertex shader for "d3d11":
// Stats: 9 math, 2 temp registers
Uses vertex data channel "Vertex"
Uses vertex data channel "Tangent"
Uses vertex data channel "TexCoord"
Constant Buffer "$Globals" (80 bytes) on slot 0 {
Vector4 _MainTex_ST at 32
}
Constant Buffer "UnityPerDraw" (160 bytes) on slot 1 {
Matrix4x4 unity_ObjectToWorld at 0
}
Constant Buffer "UnityPerFrame" (368 bytes) on slot 2 {
Matrix4x4 unity_MatrixVP at 272
}
Shader Disassembly:
//
// Generated by Microsoft (R) D3D Shader Disassembler
//
//
// Input signature:
//
// Name Index Mask Register SysValue Format Used
// -------------------- ----- ------ -------- -------- ------- ------
// POSITION 0 xyzw 0 NONE float xyz
// COLOR 0 xyzw 1 NONE float xyzw
// TEXCOORD 0 xy 2 NONE float xy
//
//
// Output signature:
//
// Name Index Mask Register SysValue Format Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_POSITION 0 xyzw 0 POS float xyzw
// COLOR 0 xyzw 1 NONE float xyzw
// TEXCOORD 0 xy 2 NONE float xy
//
vs_4_0
dcl_constantbuffer CB0[3], immediateIndexed
dcl_constantbuffer CB1[4], immediateIndexed
dcl_constantbuffer CB2[21], immediateIndexed
dcl_input v0.xyz
dcl_input v1.xyzw
dcl_input v2.xy
dcl_output_siv o0.xyzw, position
dcl_output o1.xyzw
dcl_output o2.xy
dcl_temps 2
0: mul r0.xyzw, v0.yyyy, cb1[1].xyzw
1: mad r0.xyzw, cb1[0].xyzw, v0.xxxx, r0.xyzw
2: mad r0.xyzw, cb1[2].xyzw, v0.zzzz, r0.xyzw
3: add r0.xyzw, r0.xyzw, cb1[3].xyzw
4: mul r1.xyzw, r0.yyyy, cb2[18].xyzw
5: mad r1.xyzw, cb2[17].xyzw, r0.xxxx, r1.xyzw
6: mad r1.xyzw, cb2[19].xyzw, r0.zzzz, r1.xyzw
7: mad o0.xyzw, cb2[20].xyzw, r0.wwww, r1.xyzw
8: mov o1.xyzw, v1.xyzw
9: mad o2.xy, v2.xyxx, cb0[2].xyxx, cb0[2].zwzz
10: ret
// Approximately 0 instruction slots used
-- Hardware tier variant: Tier 1
-- Fragment shader for "d3d11":
// Stats: 3 math, 2 temp registers, 1 textures
Set 2D Texture "_MainTex" to slot 0
Constant Buffer "$Globals" (80 bytes) on slot 0 {
Float _Cutoff at 48
Vector4 _Color at 64
}
Shader Disassembly:
//
// Generated by Microsoft (R) D3D Shader Disassembler
//
//
// Input signature:
//
// Name Index Mask Register SysValue Format Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_POSITION 0 xyzw 0 POS float
// COLOR 0 xyzw 1 NONE float
// TEXCOORD 0 xy 2 NONE float xy
//
//
// Output signature:
//
// Name Index Mask Register SysValue Format Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Target 0 xyzw 0 TARGET float xyzw
//
ps_4_0
dcl_constantbuffer CB0[5], immediateIndexed
dcl_sampler s0, mode_default
dcl_resource_texture2d (float,float,float,float) t0
dcl_input_ps linear v2.xy
dcl_output o0.xyzw
dcl_temps 2
0: sample r0.xyzw, v2.xyxx, t0.xyzw, s0
1: mad r1.x, cb0[4].w, r0.w, -cb0[3].x
2: mul r0.xyzw, r0.xyzw, cb0[4].xyzw
3: mov o0.xyzw, r0.xyzw
4: lt r0.x, r1.x, l(0.000000)
5: discard_nz r0.x
6: ret
// Approximately 0 instruction slots used
}
// Stats for Vertex shader:
// d3d11: 9 math
// Stats for Fragment shader:
// d3d11: 3 math, 1 texture
Pass {
Tags { "QUEUE"="AlphaTest" "IGNOREPROJECTOR"="true" "RenderType"="TransparentCutout" "RequireOption"="SoftVegetation" }
ZWrite Off
Cull Off
Blend SrcAlpha OneMinusSrcAlpha
//////////////////////////////////
// //
// Compiled programs //
// //
//////////////////////////////////
//////////////////////////////////////////////////////
No keywords set in this variant.
-- Hardware tier variant: Tier 1
-- Vertex shader for "d3d11":
// Stats: 9 math, 2 temp registers
Uses vertex data channel "Vertex"
Uses vertex data channel "Tangent"
Uses vertex data channel "TexCoord"
Constant Buffer "$Globals" (80 bytes) on slot 0 {
Vector4 _MainTex_ST at 32
}
Constant Buffer "UnityPerDraw" (160 bytes) on slot 1 {
Matrix4x4 unity_ObjectToWorld at 0
}
Constant Buffer "UnityPerFrame" (368 bytes) on slot 2 {
Matrix4x4 unity_MatrixVP at 272
}
Shader Disassembly:
//
// Generated by Microsoft (R) D3D Shader Disassembler
//
//
// Input signature:
//
// Name Index Mask Register SysValue Format Used
// -------------------- ----- ------ -------- -------- ------- ------
// POSITION 0 xyzw 0 NONE float xyz
// COLOR 0 xyzw 1 NONE float xyzw
// TEXCOORD 0 xy 2 NONE float xy
//
//
// Output signature:
//
// Name Index Mask Register SysValue Format Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_POSITION 0 xyzw 0 POS float xyzw
// COLOR 0 xyzw 1 NONE float xyzw
// TEXCOORD 0 xy 2 NONE float xy
//
vs_4_0
dcl_constantbuffer CB0[3], immediateIndexed
dcl_constantbuffer CB1[4], immediateIndexed
dcl_constantbuffer CB2[21], immediateIndexed
dcl_input v0.xyz
dcl_input v1.xyzw
dcl_input v2.xy
dcl_output_siv o0.xyzw, position
dcl_output o1.xyzw
dcl_output o2.xy
dcl_temps 2
0: mul r0.xyzw, v0.yyyy, cb1[1].xyzw
1: mad r0.xyzw, cb1[0].xyzw, v0.xxxx, r0.xyzw
2: mad r0.xyzw, cb1[2].xyzw, v0.zzzz, r0.xyzw
3: add r0.xyzw, r0.xyzw, cb1[3].xyzw
4: mul r1.xyzw, r0.yyyy, cb2[18].xyzw
5: mad r1.xyzw, cb2[17].xyzw, r0.xxxx, r1.xyzw
6: mad r1.xyzw, cb2[19].xyzw, r0.zzzz, r1.xyzw
7: mad o0.xyzw, cb2[20].xyzw, r0.wwww, r1.xyzw
8: mov o1.xyzw, v1.xyzw
9: mad o2.xy, v2.xyxx, cb0[2].xyxx, cb0[2].zwzz
10: ret
// Approximately 0 instruction slots used
-- Hardware tier variant: Tier 1
-- Fragment shader for "d3d11":
// Stats: 3 math, 2 temp registers, 1 textures
Set 2D Texture "_MainTex" to slot 0
Constant Buffer "$Globals" (80 bytes) on slot 0 {
Float _Cutoff at 48
Vector4 _Color at 64
}
Shader Disassembly:
//
// Generated by Microsoft (R) D3D Shader Disassembler
//
//
// Input signature:
//
// Name Index Mask Register SysValue Format Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_POSITION 0 xyzw 0 POS float
// COLOR 0 xyzw 1 NONE float
// TEXCOORD 0 xy 2 NONE float xy
//
//
// Output signature:
//
// Name Index Mask Register SysValue Format Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Target 0 xyzw 0 TARGET float xyzw
//
ps_4_0
dcl_constantbuffer CB0[5], immediateIndexed
dcl_sampler s0, mode_default
dcl_resource_texture2d (float,float,float,float) t0
dcl_input_ps linear v2.xy
dcl_output o0.xyzw
dcl_temps 2
0: sample r0.xyzw, v2.xyxx, t0.xyzw, s0
1: mad r1.x, cb0[4].w, r0.w, -cb0[3].x
2: mul r0.xyzw, r0.xyzw, cb0[4].xyzw
3: mov o0.xyzw, r0.xyzw
4: lt r0.x, -r1.x, l(0.000000)
5: discard_nz r0.x
6: ret
// Approximately 0 instruction slots used
}
}
}
You can find some more here.
https://forum.unity.com/threads/cutout- ... ar.150145/
Greetings,
Thank you for the additional information, we really appreciate it. For future examples, please send the original shader.
Unfortunately, what you are looking for is actually a multi-pass shader that requires a custom template in ASE. Luckily, we're actually building one along the lines of what you're looking for.
Do you intend to use it with hair? I don't recommend using something like this for vegetation.
We'll register your interest and contact you as soon as we have any developments.
Thanks!