三張貼圖通過改變主材質及修飾材質的uv重複次數,實現不同的效果。如下:
圖中的房子和圍牆只用了三張貼圖就實現了完全不同的建築,厲害吧~~~
shader如下:
properties_coloru(
"coloru
", float) = 1.0
//主紋理x軸重複次數
_colorv("
colorv
", float) = 1.0
//主紋理y軸重複次數
_detailtex("
detailtex
", 2d) = "
white"{}
_detailu(
"detailu
", float) = 1.0
//修飾紋理x軸重複次數
_detailv("
detailv
", float) = 1.0
//修飾紋理y軸重複次數
}
subshader
blend srcalpha oneminussrcalpha
pass
;float4 _detailtex_st;
half4 frag(v2f i):color
endcg}}
簡單紋理複製
有時候美術給的圖只有一部分,需要程式去重複拼接,如地板,鐵柵欄等,而在程式中直接進行縮放會失真,如下圖 這個時候要實現如下這個效果有兩種方式 一 在程式中複製物件並修改每一段的座標,使之拼接起來,這種方式效率太低,也不夠聰明 第二種就是使用uv複製,以下為具體shader shader custom...
Unity建立紋理及紋理濾波
unity3d中建立紋理使用的是unity中的texture2d的建構函式。texture2d int width,int height texture2d int width,int height,textureformat format,bool mipmap texture2d int wid...
Perlin Noise變種及無縫紋理生成
一 perlin noise變種 通過前面幾篇文章,我們已經成功實現了1d,2d,3d,4d perlin 雜訊,perlin雜訊實現不是很複雜,但是我們也應該注意到,隨著維度的增多,實現的複雜度也在大幅度增加,包括permutation表的檢索和插值都會變得越來越難以控制,而且效能瓶頸表現得也是越...