看板 GameDesign 關於我們 聯絡資訊
大家好 最近在嘗試寫custom surface shader 目前透過surf內的o.Alpha可以調整透明度 這樣會讓整個一起material一起變透明 但我希望能讓個別的vertex有自己的透明度 奇怪的是在vert裡面(appdata_full)可以動態調整顏色 但是卻調整不了透明度 請問大家有可能做到這種效果嗎? (unity 內建的Legacy Shader/Transparent/Diffuse 就可以利用改變material的color來動態調整透明度) -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 1.163.164.76 ※ 文章網址: https://www.ptt.cc/bbs/GameDesign/M.1507496432.A.81C.html
Ninja5566: 你vertex如果有送vertex color進去應該是沒問題吧 10/09 05:38
cjcat2266: 記得要寫alpha blending的blend mode 10/09 07:02
Ninja5566: 試著surface shader 輸出顏色改成alpha值, 看是不是 10/09 10:38
Ninja5566: 你想要的 10/09 10:38
planetoid: 我改變appdata_full的color rgb有作用 但第四個channel 10/09 14:31
planetoid: 卻沒有 不知道是不是少設定了什麼 10/09 14:33
planetoid: blend mode是Blend SrcAlpha OneMinusSrcAlpha 10/09 14:46
cjcat2266: 有沒有 "Queue" = "Transparent" ? 10/09 15:37
planetoid: 有耶"Queue"="Transparent""RenderType"="Transparent" 10/09 15:44
cjcat2266: 那就想不太到別的了,原始檔貼上來比較清楚 10/09 15:46
cjcat2266: Hm..這個人好像有一樣的問題 http://bit.ly/2xth6uK 10/09 15:52
cjcat2266: 這樣咧? http://bit.ly/2kzQRSv 10/09 15:54
cjcat2266: 之前提到的方法是vert + frag shader 10/09 15:55
cjcat2266: 如果要用surf shader的確有可能要用不同方法 10/09 15:55
cjcat2266: 畢竟是Unity內建pipeline,有時一般作法不適用 10/09 15:56
cjcat2266: Sorry,不該說一般作法,該說全套very+frag作法 10/09 16:09
cjcat2266: 畢竟Unity建議沒必要vert或frag時,使用surf shader 10/09 16:10
planetoid: https://codeshare.io/ary18Y 10/09 16:34
planetoid: 72那裡lerp _Color跟_Color2再assign給v.color 10/09 16:38
planetoid: 但_Color1跟2的alpha channel卻沒作用@@ 10/09 16:38
planetoid: 反倒是需要用81那裡修改 10/09 16:39
planetoid: 其實是想嘗試將https://goo.gl/pyZN4k裡的particles做 10/09 16:43
planetoid: fade in/out的效果 10/09 16:43
chowleft: 81行把 IN.color.a 帶進去算不行嗎? 10/10 00:15
chowleft: 像是 o.Alpha = IN.color.a * c.a; 10/10 00:16
chowleft: https://i.imgur.com/A9PH9oC.png 10/10 00:43
planetoid: 喔喔喔喔 大感謝chowleft大大 可以了>< 10/10 01:03
cjcat2266: 喔~原來如此,我以為原po的意思是in.color.a沒用 10/10 03:30