Adding support for a random attribute to the sampling node exposed the problem of attribute evaluation ignoring the calculated curve. This design variant is intended to treat the sampling of values from calculated curves as a new attribute-based сontext.
| {F13329459} | {F13329406} {F13329445} {F13329439} |
The crux of the problem is that a random attribute, when sampled, must be able to have a position behavior. Other behaviors are not covered yet, but may be added later.
Sampling attributes do not belong to the curve and have their own size. Their interpolation may not be linear, but based on the type of curve, which increases the speed for large objects.
Example: sampling a random vector from curve points. You want the vector to keep its length. But even the original implementation of normals kept the length just because of the normalization. Nonlinear interpolation in spline space for a vector has the ability to rotate it without loss of length and incorrect deformations.
Or you want to sample a color. You can set the color for the breakpoints and... Whoa, those are just linear transitions! Handles cannot be used. They are not a domain and this design does not violate that. Simply by sampling an attribute, you can sample it not only from breakpoints, but from handles!
Also, in addition to entering an attribute as the domain of the sampled curve, a segment data node is offered. This low-level node is for primary access to cache data. The sampled attribute input node uses this as its signature. But it can also be useful for the user to be able to use this data, for example, to visualize the operation of a bezier curve.
Also sampling futures:
1. The option of sampling a vector in normal/target space + sample position can be used as a variant of the curve mesh deformation
2. Sampling at an arbitrary point creates freedom to obtain information about the curvature of the surface.
---
Curve Input:
- Spline type (Select current type curves / index of type)
- Select Spline By Type (By type index)
---
Changed Nodes:
- Sample Curve
- Input:
- Curve
- Factor / Length
- Curve (Index)
- Attribute (Random type) (use SampleCurveContext)
- Output:
- Value (Random type)
- Position:
- In SampleCurveContext return evaluated_positions
- Normal:
- Same Position
- Curve Tangent:
- Move TangentFieldInput to Fields Input and add it in SampleCurveContext same position
- Index:
- Same position. Index in sampling input index of current curve
- ID:
- Same Index. ID is index of current sample. Sampling no has order ad id make sence only for random and same things
- Spline Length, Parameter, Resolution, Cyclic:
- Data of spline same changed. Data of point internolated by sampling
- Context Add:
- Sample Signature Input:
- Curve Index
- Curve Type
- First Point
- First Factor
---
Add Nodes (Valid only in SampleCurveContext):
- Sample Attribute on Curve:
- Input:
- Attribute (Random type)
- Hadles type ? left/right position : Weight
- Output:
- Value (Random type)
- Sample Segment:
- Output:
- Previous Point of original curve
- Factor for interpolatin in current segment
First test version: https://developer.blender.org/P3114