What & How & Why

差别

这里会显示出您选择的修订版和当前版本之间的差别。

到此差别页面的链接

两侧同时换到之前的修订记录前一修订版
后一修订版
前一修订版
vfx:houdini:concepts:geo:geo_attr [2019/02/19 11:03] – [Geometry] codingharevfx:houdini:concepts:geo:geo_attr [2021/11/11 08:07] (当前版本) codinghare
行 2: 行 2:
 Houdini 中的几何属性相关知识点。\\ Houdini 中的几何属性相关知识点。\\
  
-===== ===== +----
  
 +====属性不是本地变量====
 +必须要明确的是,Houdini 中的 //Attribute// 和 //Variable// 是两回事。从 Programming 的角度来说, //Attribute// 更像是全局变量,存在于整个 cooking 的过程。而 //Variable//(Local Variable)则正如其名,本地变量。一般本地变量的生存周期应该与节点相关联,而如果将每一个节点看做一个函数,那么每一个 节点可以使用的本地变量也是不一样的。
 +\\
 +\\
 +===属性与本地变量的区分===
 +我们一般从下面的几个特点来区分属性与本地变量:
 +==获取方式不同==
 +  * 属性通过函数获取(比如 ''prim()''、''point()'' 等等),新版本 Houdini 可以通过 ''@'' 获取
 +  * 本地变量通过操作符 ''$'' 获取
 +==表现形式不同==
 +  * 所有的本地变量都是**大写**(Uppercase)的。
 +  * 除非特别指定,属性一般都是**小写**的。
 +==存在域不同==
 +  * 属性存在于 //cooked// 的场景中
 +  * 本地变量的存在域为**节点**
 +===关联属性和本地变量===
 +属性和变量可以关联起来指向同一个数据。一般来说,属性和变量的关联有两种途径:
 +  - Mapping:''Attribute Create'' 使用了这种方法。如果不指定本地变量的名字,那么该节点将自动把属性名**大写化**,并作为本地变量的名字
 +  - 手动创建:指定属性的名字。
 ====Attributes==== ====Attributes====
  
行 24: 行 42:
   * //Detail// 属性是以整个几何体为单位的。   * //Detail// 属性是以整个几何体为单位的。
 ===几何体属性的优先级=== ===几何体属性的优先级===
-需要注意的是,以上几种属性是有**优先级**的;也就是说,**高等级的属性会覆盖掉低等级的属性**。//Houdini// 默认的优先级是://Vertex// > //Point// > //Primitive// > //Detail//+需要注意的是,以上几种属性是有**优先级**的;也就是说,**高等级的属性会覆盖掉低等级的属性**。//Houdini// 默认的优先级是://Vertex// > //Point// > //Primitive// > //Detail//。属性的覆盖通常出现在 Merge 中,两个几何体 Merge, 若没有对应的属性则创建对应的属性,有对应的属性则按照上述优先级覆盖
 \\ \\
 \\ \\
行 34: 行 52:
 \\ \\
 \\ \\
-我们同时还可以使用 ''Attribute Cast'' 节点对属性进行精度的控制(参考 [[vfx:houdini:sop:attribute:attr_cast|Attribute Cast]])。+我们同时还可以使用 ''Attribute Cast'' 节点对属性进行精度的控制(参考 [[vfx:houdini:sop:node:attribute:attr_cast|Attribute Cast]])。 
 ====Intrinsic attributes==== ====Intrinsic attributes====
 在 ''geometrysheet'' 的列表中,如果点开 ''primitive'' 或者 ''detail'' 选项,会发现有上有一个 ''Intrinsics'' 的选项。 在 ''geometrysheet'' 的列表中,如果点开 ''primitive'' 或者 ''detail'' 选项,会发现有上有一个 ''Intrinsics'' 的选项。
行 53: 行 72:
     * Inspect tool     * Inspect tool
 ==使用 Intrinsic attributes == ==使用 Intrinsic attributes ==
- Tools  ^  Usage  ^  +^Tools  ^  Usage  ^  
-  VEX    |  以 <color #900>intrinsic:xxxx</color> 的形式直接读取,no ''@'',use <color #900>primintrinsic()</color> 、<color #900>detailintrinisc()</color>   | +| VEX    |  以 <color #900>intrinsic:xxxx</color> 的形式直接读取,no ''@'',use <color #900>primintrinsic()</color> 、<color #900>detailintrinisc()</color>   | 
- Python  |  <color #900>hou.Geometry.intrinsicNames()</color>、<color #900>intrinsicValue()</color> 、<color #900>.intrinsicValueDict()</color>                | +|Python  |  <color #900>hou.Geometry.intrinsicNames()</color>、<color #900>intrinsicValue()</color> 、<color #900>.intrinsicValueDict()</color>                | 
- Group    <color #900>@ + intrinsic:xxx + //condition// </color>,E.g.: @intrinsic:indexorder<100         |+|Group    <color #900>@ + intrinsic:xxx + //condition// </color>,E.g.: @intrinsic:indexorder<100         |
 ====不同精度的存储==== ====不同精度的存储====
 存储属性有高精度 / 低精度 两种方式存储。 存储属性有高精度 / 低精度 两种方式存储。
行 69: 行 88:
  
 ===Geometry=== ===Geometry===
- Name  ^  Type  ^  What  ^  Where  ^  Tips  ^ +^Name  ^  Type  ^  What  ^  Where  ^  Tips  ^ 
- <color #900>P</color>  |  vector  |  Point Position  |  Points  |  PTA, 不唯一 +|<color #900>P</color>  |  vector  |  Point Position  |  Points  |  PTA, 不唯一 
- <color #900>N</color>  |  vector  |  Normal direction  |   | +|<color #900>N</color>  |  vector  |  Normal direction  |   | 
- <color #900>v</color>  |  vector  |  Velocity  |  Motion blur, particle Dop  |  可用 ''Trail'' 计算 +|<color #900>v</color>  |  vector  |  Velocity  |  Motion blur, particle Dop  |  可用 ''Trail'' 计算 
- <color #900>id</color>  |  int  |  unique element ID  |  particle Dop  |  唯一, 和  P 这类的 element number 不同 +|<color #900>id</color>  |  int  |  unique element ID  |  particle Dop  |  唯一, 和  P 这类的 element number 不同 
- <color #900>name</color>  |  string  |   primitive name  |  packed primitives, volumes  |  可通过寻找 name 来选中几何体 +|<color #900>name</color>  |  string  |   primitive name  |  packed primitives, volumes  |  可通过寻找 name 来选中几何体 
- <color #900>piece</color>  |  int  |   broken pieces    Dop     独立碎块的编号,碎片的面共享该编号  |+|<color #900>piece</color>  |  int  |   broken pieces    Dop     独立碎块的编号,碎片的面共享该编号  |
 ===Sizes / Rotations=== ===Sizes / Rotations===
- Name  ^  Type  ^  What  ^  Where  ^  Tips  ^ +^Name  ^Type  ^  What  ^  Where  ^  Tips  ^ 
- <color #900>pscale</color>  float  |  Uniform scaling factor  |  Rendering  |  控制点和粒子的大小、instancing 的几何体大小 +|<color #900>pscale</color>  |float  |  Uniform scaling factor  |  Rendering  |  控制点和粒子的大小、instancing 的几何体大小 
- <color #900>scale</color>  vector  |  <color #2c7ba5>Axis</color> scaling factor  |  Rendering  |  在坐标轴方向上**分别**缩放 +|<color #900>scale</color>  |vector  |  <color #2c7ba5>Axis</color> scaling factor  |  Rendering  |  在坐标轴方向上**分别**缩放 
- <color #900>width</color>  float    Open curve width  |   Rendering  |  PTA,调整渲染时曲线的宽度(世界坐标系下)| +|<color #900>width</color>  |float    Open curve width  |   Rendering  |  PTA,调整渲染时曲线的宽度(世界坐标系下)  
- <color #900>lod</color>  float    Level of detail  |  Instanting  |  PRA, DA   | +|<color #900>lod</color>  |float    Level of detail  |  Instanting  |  PRA, DA   | 
- <color #900>spritescale</color>   vector  |  sprint scaling factor  |  sprint image  |  PTA,  Default(1,1,1) +|<color #900>spritescale</color>|vector  |  sprint scaling factor  |  sprint image  |  PTA,  Default(1,1,1) 
- <color #900>spriterot</color>  float  |  sprite rotation factor  |  sprint image  |  PTA, Default 0  |+|<color #900>spriterot</color>  |float  |  sprite rotation factor  |  sprint image  |  PTA, Default 0  |
  
 ====参考资料==== ====参考资料====
   * [[http://www.sidefx.com/docs/houdini/model/attributes|Geometry attributes]]\\   * [[http://www.sidefx.com/docs/houdini/model/attributes|Geometry attributes]]\\
 +  * [[https://www.sidefx.com/forum/topic/11090/|attribute name rule?]]: check symek's answer