?/????
????????????????????????????????Shader??????????????????????????????????????????????????????????????????????????????????????????????
?????????????????
??????????????????????????????????????????????????
???????????????????????????????
?????????????????????????????
????
? ???????
? ???????
? ???????
? ???????
??
????????????????????????????????????????????????????????????????????
????????????
????????????????????????????????????????
?????????????
???
? ??????????
? ??????????
? ????
????????????????????????UV???????????????(0.11,0.51)????(0.12, 0.50)???(0.23,0.15)????(0.22,0.17)???????????????????????????????????????????????????????????????
????????????????????????????????????????????????????????????????????????????(NoiseTexture)??
? ??????
??????????????????????????????????
?????????"??"???????????????????????????????????????????????????
? Ps??????(??????????????)
? ????????????
??????
?????????????????????????
1??????????Repeat???????????????????
2???????????????UV???????????????-1~1???????UV???????????????0.005???????????????????????????????????????
3??????????????????????????????????????R???(??????????(G)????(B)??)???????????????????????????????????????????????
4?????????????????????????????????????45???1????????????5~10???
???????????????????????????????????????????????????????????????????????????????
??
??????????????????????????UV????????????????? * ????????????
? ????????
? U?????????????????
Shader???????????
?????????
1???????????
2????????
??
???????????X?Y???2D????Z????????? * ????????????????????????????????UV????????????????
????????
?????
?????????????????????????????????????????????(????????????????????)?
Shader???????????
?????????
1???????????
?????Repeat??????????
2????????
3??????
??????????????????(0,0)?????????
??(0,0)??????
???????
??????? + ?? or ?? + ??
?????????????
?????????
???????????
??????????
? ???shader
???????
?????????????????(???????)??????????
??????
???????????????shader??Blend???Blend??????????????????????????????????????????????????????????????(???)?????????????????????(???????)????????????????
?????????
???????????BLEND?ADD??????(??BLEND???????...)????????
BLEND?
???????? = ??????? * ?????Alpha + ??????? * (1 - ?????Alpha)
ADD?
???????? = ??????? + ???????
???????????????Shader?Blend????????????
Blend SrcAlpha OneMinusSrcAlpha
? Blend One One
????????????????????????????????????Shader??????????????????????
?????????
1?????????????????????????
2???Alpha????????????????Alpha?????????Alpha????Unity???????Alpha???????????
3?????RGB?????Alpha??????????
4??????????????????????????????
??
?????????? = ???? op ??1 op ??2 op ??3
??x = ????? * ????? * ???????
????? = tex2D(???, uv + ??? + ???)
?????????Shader??????????????????????????????????????????????????????????????????????
???
??????????????????????????????
??????????????????????????????????????
???????????????Motion?????uv??????PS????????????
??????????????????????????????UV?????(0~1)??????????????????
?????Motion?????????????????????????????????Point???????????UV???PhotoShop????????UV????????
????????????????????????????????????????????????????????????????????????????
????????
????????????????????Inspector??????????????????????????????????????????????? -- ???
? ????????????
? ???????????
????????????
? ??Editor.cs????Editor?????
? ?????Editor?????
? ?Shader???????????????
? ?Editor?????OnInspectorGUI???
????????????????OnInspectorGUI????????????????????????OnInspectorGUI?????Inspector??????????
? ?????Inspector??
?????????????
???????????????????Properties ? Keywords?
Properties
Properties - ??????Shader???Properties???Properties????Inspector????????.mat?????????mat??????Draw??????????shader?
Keywords
Keywords - ??????????Shader???????????????
?????????????????Unity Shader Lab??????????????.shader(GPU???shader)?????(????)?
????????Shader????????????????????????????????????????????????shader???????????????
????Keywords??Unity???Keywords?????????multi_compile?shader_feature?????shader??????????Keyword???????????????.shader???????
???shader_feature?multi_compile??????????(????Making multiple shader program variants)???????????
OnInspectorGUI????????
??shader??Properties?Keywords
?
????????keyword???keyword??GUI???????
?
???????????
?
???????keyword
?
???????????
? ??shader??Properties?Keywords?
? ????????keyword???keyword??GUI????????
? ?????????????
???????MaterialProperty??????????????Shader??Properties????????
???????keyword ?????????????
?????????API
public Color ColorProperty(MaterialProperty prop, string label);//????
public float FloatProperty(MaterialProperty prop, string label);//?????
public Vector4 VectorProperty(MaterialProperty prop, string label);//????
public Texture TextureProperty(MaterialProperty prop, string label);//????
...
??API?????????MaterialEditor???
?????????????????????????????????????????...
????
? ?????????YouTube??????????????????????????????
https://www.youtube.com/watch?v=OYjMnMZe1Vg
? ???????????????Unity Shader Lab????????????????????????????????????????????
???????????????????????????????????
? ????????????????????TCG?????????????
????
via?????by??????
|