【Compile shader networks for efficiency–编译材质网络 – 材质模块 – Houdini帮助文档中文版】
You can pre-compile a material as a digital asset to speed up shader compilation at render time.
—你可以预编译一个材质(作为数字资产文件)来加速在渲染时材质的编译。
Material (shader builder) networks are easy to set up and flexible without the extra work of managing digital asset versions. However, converting a material to a digital asset has two benefits:
–材质网络很容易创建而且也灵活(不需要额外的管理数字资产)。但是,将材质转为数字资产文件有两个优势:
Only one copy of the VOP network.
–只有一个VOP网络副本
With a plain material network, copying the network to create a variation duplicates the network inside, increasing the compilation time and requiring more memory.
和普通材质网络相比,拷贝一个网络来创建一个变化的副本,会增加编译时间和需要更多内存。
Once you have converted a shader or material to a digital asset, you can create instances of the SHOP type or digital asset and edit each instance’s parameters to create variations. The underlying network will not be duplicated between instances, as it is with copies of material networks.
一旦你将一个材质转变为数字资产文件,你可以创建SHOP或数字资产的替换文件,并且编辑替换文件来创建一个变体材质。在其下面的网络不会被复制,因为它是材质网络的一个副本。
Pre-compile VEX code for faster renders.
—预编译VEX代码用于快速渲染
When the Save cached code option on the Basic tab of the operator type properties for the digital asset is on, Houdini automatically pre-compiles the VEX code for the material whenever the asset’s network changes.
–当操作类型属性窗口的Basic选项卡中的保存缓存的代码选项开启时,Houdini会自动预编译材质的VEX代码(当数字资产网络有变化时)。
This means the renderer doesn’t have to load the asset’s node network and compile it before it can render the material.
–这意为着渲染器在可以渲染材质前都不需要加载数字资产的节点网络,并编译它。
How to
To… | Do this |
Convert a Material Shader Builder into a digital asset 转换一个Material Shader Builder材质到数字资产中 | Right-click the material builder node and chooseCreate digital asset. Fill in the information on where to store the asset and click Accept. –右击材质构建节点,选择创建数字资产。填写在何处存储数字资产的信息,点击接受。 Once you have converted a network to a digital asset, you can create nodes of the new type in a shader network (such as /shop). —一旦你将一个网络转为数字资产文件,你可以在材质网络中创建这个新类型的节点。 |
Have a material asset pre-compile its VEX code automatically –让一个材质资产文件自动预编译VEX代码 | Turn on the Save cached code option on the Basictab of the operator type properties for the digital asset. –开启操作类型属性窗口的Basic选项卡中的保存缓存的代码选项。 |
Make the material run in the viewport (OpenGL context) 使材质在视图中运行 | By default, the compiled asset’s Render Mask is set toVMantra, so it only renders in Mantra. You can addOGL to the render mask to have the viewport attempt to shade the objects using the material’s parameters. —默认编译的资产文件的渲染遮罩参数是 VMantra方式,因此它只可以在Mantra中渲染。你可以添加OGL到渲染遮罩中,使视窗视图使用材质参数来着色物体。 Right-click the compiled asset node and chooseType Properties. –右击编译的数字资产节点,选择类型属性。 On the Basics tab, change the Render Mask toVMantra OGL. –在Basic选项卡中,改变渲染遮罩参数为 VMantra OGL方式。 |