在 Renderman 中渲染实体
Rendering entities in Renderman
这是关于没有 Maya(或任何此类 GUI)界面的 Renderman Pro Server 19。
Renderman 文档清楚地解释了如何定义实体:https://renderman.pixar.com/forum/docs/RPS_19/ribBinding.php#rib-entity-file-example,
但它没有定义如何在我们的主代码中包含实体。
由于link将来可能会死掉,我将在此处引用文档的一部分:
A RIB Entity File contains a single User Entity. RIB Entity Files are
incomplete since they do not contain enough information to describe a
frame to a renderer. RIB Entity Files depend on Render Management
services for integration into "legal," or complete, RIB Files. These
files provide the mechanism for 3-D "clip-art" by allowing Render
Managers to insert objects into preexisting scenes.
RIB Entity Files must conform to the User Entity Conventions described
in the User Entities section. To summarize, a User Entity must be
delimited by an attribute block, must have a name attribute, and must
be completely contained within a single attribute block. Three
additional requirements must also be met:
The header hint: ##RenderMan RIB-Structure 1.1 Entity must be included
as the first line of the file.
The Entity must be built in an object coordinate system which is centered about the origin.
The Entity must have a RIB bound request to provide a single bounding box of all geometric primitives in the User Entity
并附上以下实体示例代码:
##RenderMan RIB-Structure 1.1 Entity
AttributeBegin #begin unit cube
Attribute "identifier" "name" "unitcube"
Bound -.5 .5 -.5 .5 -.5 .5
TransformBegin
# far face
Polygon "P" [.5 .5 .5 -.5 .5 .5 -.5 -.5 .5 .5 -.5 .5]
Rotate 90 0 1 0
# right face
Polygon "P" [.5 .5 .5 -.5 .5 .5 -.5 -.5 .5 .5 -.5 .5]
# near face
Rotate 90 0 1 0
Polygon "P" [.5 .5 .5 -.5 .5 .5 -.5 -.5 .5 .5 -.5 .5]
# left face
Rotate 90 0 1 0
Polygon "P" [.5 .5 .5 -.5 .5 .5 -.5 -.5 .5 .5 -.5 .5]
TransformEnd
TransformBegin
# bottom face
Rotate 90 1 0 0
Polygon "P" [.5 .5 .5 -.5 .5 .5 -.5 -.5 .5 .5 -.5 .5]
TransformEnd
TransformBegin
# top face
Rotate -90 1 0 0
Polygon "P" [.5 .5 .5 -.5 .5 .5 -.5 -.5 .5 .5 -.5 .5]
TransformEnd
AttributeEnd #end unit cube
现在,在主 RIB 文件中一次又一次地包含同一段代码真的很麻烦(需要抽象),因此实体似乎是一个不错的选择。
那么,我应该如何将这些实体包含在我的主文件中?
这可以通过使用 Archive
指令来完成。假设,我想将上面的代码包含在另一个文件中,比如说main.rib,我会简单地说:
# main.rib
# other_stuff
ReadArchive "unitcube.rib"
就好像 rib
代码写在 main.rib 文件中一样。
这是关于没有 Maya(或任何此类 GUI)界面的 Renderman Pro Server 19。
Renderman 文档清楚地解释了如何定义实体:https://renderman.pixar.com/forum/docs/RPS_19/ribBinding.php#rib-entity-file-example, 但它没有定义如何在我们的主代码中包含实体。
由于link将来可能会死掉,我将在此处引用文档的一部分:
A RIB Entity File contains a single User Entity. RIB Entity Files are incomplete since they do not contain enough information to describe a frame to a renderer. RIB Entity Files depend on Render Management services for integration into "legal," or complete, RIB Files. These files provide the mechanism for 3-D "clip-art" by allowing Render Managers to insert objects into preexisting scenes.
RIB Entity Files must conform to the User Entity Conventions described in the User Entities section. To summarize, a User Entity must be delimited by an attribute block, must have a name attribute, and must be completely contained within a single attribute block. Three additional requirements must also be met:
The header hint: ##RenderMan RIB-Structure 1.1 Entity must be included as the first line of the file.
The Entity must be built in an object coordinate system which is centered about the origin.
The Entity must have a RIB bound request to provide a single bounding box of all geometric primitives in the User Entity
并附上以下实体示例代码:
##RenderMan RIB-Structure 1.1 Entity
AttributeBegin #begin unit cube
Attribute "identifier" "name" "unitcube"
Bound -.5 .5 -.5 .5 -.5 .5
TransformBegin
# far face
Polygon "P" [.5 .5 .5 -.5 .5 .5 -.5 -.5 .5 .5 -.5 .5]
Rotate 90 0 1 0
# right face
Polygon "P" [.5 .5 .5 -.5 .5 .5 -.5 -.5 .5 .5 -.5 .5]
# near face
Rotate 90 0 1 0
Polygon "P" [.5 .5 .5 -.5 .5 .5 -.5 -.5 .5 .5 -.5 .5]
# left face
Rotate 90 0 1 0
Polygon "P" [.5 .5 .5 -.5 .5 .5 -.5 -.5 .5 .5 -.5 .5]
TransformEnd
TransformBegin
# bottom face
Rotate 90 1 0 0
Polygon "P" [.5 .5 .5 -.5 .5 .5 -.5 -.5 .5 .5 -.5 .5]
TransformEnd
TransformBegin
# top face
Rotate -90 1 0 0
Polygon "P" [.5 .5 .5 -.5 .5 .5 -.5 -.5 .5 .5 -.5 .5]
TransformEnd
AttributeEnd #end unit cube
现在,在主 RIB 文件中一次又一次地包含同一段代码真的很麻烦(需要抽象),因此实体似乎是一个不错的选择。
那么,我应该如何将这些实体包含在我的主文件中?
这可以通过使用 Archive
指令来完成。假设,我想将上面的代码包含在另一个文件中,比如说main.rib,我会简单地说:
# main.rib
# other_stuff
ReadArchive "unitcube.rib"
就好像 rib
代码写在 main.rib 文件中一样。