unity如何讓cg語言支持的metal和vulkan?
12-16
unity說支持metal和vulkan,但是shader只用cg去寫。unity自己寫的cg編譯器嗎?或者unity把cg翻譯成了metal/vulkan?
HLSLcc了解一下。
https://github.com/Unity-Technologies/HLSLcc?github.com
目前我了解到的:在Unity3D引擎中寫shader經歷過三個階段,
第一個階段
1:表面著色器(surface shaders)
2:可編程著色器(vertex and fragment shaders )
3:固定著色器(fixed function shaders)
Unity shader編寫教程(一) - Unity原生技術 - Unity聖典社區?www.ceeger.com第二個階段
Unity3D已經不支持fixed function shaders這種寫法,樓上說的只用CG寫,其實只是Unity的vertex and fragment shaders,實際上Unity一直想要別人用它的sufface shader
ShaderLab Syntax?docs.unity3d.com第三個階段
加入Compute Shader
Unity - Manual: Compute shaders?docs.unity3d.com我理解的Metal和Vulkan是render pipeline的改變,這個光靠shader怕是不夠了,實際上Unity3D在推另一項技術:
Unity-Technologies/ScriptableRenderPipeline?github.com(翻譯一下:我不管了,你們自己去玩吧)
以上:
推薦閱讀: