(文本)框

Fundamentally, a field is a function: a set of instructions that can transform an arbitrary number of inputs into a single output. A field's result can then be calculated many times with different input data. They are used all over geometry nodes to allow calculations that have different results for every element (mesh vertices, faces, etc.).

../../_images/modeling_geometry-nodes_fields_title.png

要评估的输入字段。

For example, in the figure above, the field connected to the "Set Position" node depends on two inputs, Position and Index, and transforms them into a vector using a single instruction.

现场可视化

套接字形状用于传达哪些套接字是字段,哪些是常规数据。有三种可能的套接字形状,每种形状都可视化其"现场状态" :

圆形:

套接字需要单个实际值,不能接受字段输入。对于输出套接字,这意味着节点总是输出单个值。

锐菱形:

套接字可以接受字段输入,也可以输出字段。恒定的单个值可以连接到这些插座,但每个元素的输出通常不会变化。

带圆点的钻石:

套接字可以是一个字段,但它目前是一个单一的值。这很有用,因为它允许跟踪计算单个值的位置,而不是具有许多不同结果的字段。这也意味着 插槽检视 将显示值而不是字段输入名称。

../../_images/modeling_geometry-nodes_fields_constant.png

套接字形状是一个带有圆点的菱形,这意味着字段对于每个元素具有相同的值。每个点都将向上移动5米。

../../_images/modeling_geometry-nodes_fields_varying.png

插座形状是一颗钻石,现场输入具有不同的输入。换句话说,对于每个元素,值可以是不同的。在这种情况下,位置将翻倍,因为每个点的偏移量是点的位置。

Tip

Often it is desired to extract a single value from a field. While it doesn't make sense conceptually to simply change a field into a single value, the 采样编号 or the 属性统计 can be used to retrieve a single value from a field evaluated on a geometry.

当在支持字段的两个节点套接字之间进行连接时,节点连接将被绘制为虚线。如果错误地将非现场插座连接到现场插座,则连接将被绘制为红色实线,表明存在错误。

节点类型

节点可分为两类:通常通过几何形状的数据流节点和在每个元素的数据上运行的字段节点。字段节点可以是将几何数据带入节点树中的输入节点,或在该数据上操作的函数节点。

具有几何输入和几何输出的节点几乎总是数据流节点。这意味着他们实际上更改了将从几何节点修改器输出的几何数据。

节点

Nodes with diamond socket inputs and outputs are field nodes, and resemble the instructions that will be evaluated by data flow nodes. Examples of function nodes are the math nodes and also more complex nodes like the 几何接近.

输入节点

Input nodes provide data to the field evaluation process. By themselves, they mean nothing; they must be evaluated within the context of a data flow node (geometry) to actually output a value. Examples of input nodes are the built-in attribute input nodes like Position and ID, but also selection nodes like Endpoint Selection.

字段输入也可来自处理几何形状的其他节点,如 分布点于面上 ,其形式为 匿名属性

领域背景

所有字段节点在其所连接的数据流节点的上下文中工作。上下文通常由几何组件类型和属性域组成,因此它确定从输入节点检索哪些数据。

一个常见的误解是,在多个地方使用的相同字段节点树将输出相同的数据。这并不一定是真实的,因为将针对每个数据流节点评估字段节点树,从而可能从不同或改变的几何体检索数据。

../../_images/modeling_geometry-nodes_fields_flow-1.png

Here, the Set Position node's input field is evaluated once. To evaluate the field, the node traverses backwards to retrieve the inputs from the field input nodes.

../../_images/modeling_geometry-nodes_fields_flow-2.png

当添加第二个设置位置节点时,同一个字段节点树被评估两次,每个数据流节点一次。在第二个设置位置节点处,结果将不同,因为其几何输入将已经具有与第一个节点改变的位置。

../../_images/modeling_geometry-nodes_fields_flow-3.png

但是,即使在更改几何形状后,通常也需要使用相同的字段值。 捕捉属性 评估一个字段,将结果复制到几何体上的 匿名属性

在这里,捕获属性节点存储初始位置的副本。请注意,评估捕获属性节点的字段输入是一个完全不同的步骤。之后, "设置位置" 节点的输入字段不会使用实际位置,而是使用其匿名属性副本。