shader 4 杂 一些和函数名词、数据结构
Normal:? 法線
Normao mapping: 法線貼圖
Lighting mapping: 光照貼圖
Bump mapping:???? 凹凸貼圖;模擬粗糙外表面的技術。 FX-Water simple.shader中即用到了。模擬波浪效果。
Rim lighting: 邊緣光照; 在對象的邊緣部分增加亮度。
Base Texture, 基礎紋理。
Detail Texture,細節(jié)紋理。與base texture使用相同的uv,但是在material中的Tiling值不同。
Cubemap:立方圖
Cubemap reflection,立方圖反射。
cg函數(shù):數(shù)學、幾何、紋理映射、偏導、調(diào)試幾大類。
from?? wenku.baidu.com/link?url=5lj1AuzFz6YEZDt72eHEIooI42GhwA_hL0_YO6N827tmzqYV85kNqL7WXmvZZ5JJv7GZiYXaIZKAKSY2Rnaf8IdpL2HiwzsiCydgdOcUfWu
tex2D:? Tex2D(sampler2D?tex,?float2?s),二維紋理查詢。 返回四元向量值。? 紋理映射函數(shù)都返回四元向量值。
mul: 矩陣乘法
UnpackNormal: U3D的標準法線解壓函數(shù); 在UnityCG.cginc中。
surfaceFunction -表示Cg函數(shù)中有表面著色器(surface shader)代碼。這個函數(shù)的格式應該是這樣:void surf (InputIN,inout SurfaceOutput o),Input是你自己定義的結(jié)構(gòu)。Input結(jié)構(gòu)中應該包含所有紋理坐標(texturecoordinates)和和表面函數(shù)(surfaceFunction)所需要的額外的必需變量。
lightModel-在光照模式中使用。內(nèi)置的是Lambert (diffuse)和 BlinnPhong(specular)。
from
http://hi.baidu.com/stupidboys1027/item/e6ac3cbb4faccbd684dd799a
語意輸入,語意輸出, uniform
根據(jù)語意將參數(shù)與頂點的信息綁定。
http://blog.sina.com.cn/s/blog_63507a56010115gr.html
from cg users manual
float2 * float2; 對應分量相乘后得到的向量。 不是叉乘。
dot, 點乘, 得到的是標量。 對應分量相乘后的和值。
標量與向量相乘, 是將向量的每個分量乘以標量后得到的新向量。 (向量放縮了。)
mul, 矩陣乘法; 矩陣乘以向量、 或者矩陣相乘。
Swizzle operator:
-------float3(a,b,c).zyx yields float3(c, b, a)
-------float4(a,bc,d).xxyy yields float4(a,a,b,b)
Texture Lookups 需要兩個參數(shù): Texture sampler, texture coordinate
--------texture sampler:?? sampler, sampler1D, sampler2D, sampler3D, samplerCUBE, sampleRECT.
--------tex2D/RECT/CUBE, nonprojective
--------text2D/RECT/CUBEproj, projective texture lookup
float, 32bit浮點數(shù), s23e8 + 1bit
halft, 16bit,??????????????? s10e5
int, 32 bit integer
fixed, 12bit
bool,
sampler*, texture object的HANDLE。
string
向量、矩陣。
mul(MVP, pos)---->將vertex的postion轉(zhuǎn)化為屏幕上的坐標
tex2D(texture, texcoordinate)--------->Output the color taken from our texture
vertex的輸出 是 fragment的輸入
屏幕繪制過程:
1) 屏幕繪制到temporary texture中; 而不是通常的screen buffer
2) temporary texture 會經(jīng)過filter的處理。
3) 處理結(jié)果放到screen buffer中準備繪制到屏幕上顯示給用戶
總結(jié)
以上是生活随笔為你收集整理的shader 4 杂 一些和函数名词、数据结构的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: shader 3 rendering
- 下一篇: 3D图形学概念