Envelope operator: replaces a costly tree by a cheap bounding proxy when the point is far enough.
More...
|
| | SDFEnvelope (SDFNode *, SDFNode *, double=1.0, bool=false) |
| | Create an envelope node.
|
| | SDFEnvelope (const QJsonValue &) |
| QJsonValue | ToJson () const |
| | Conversion to JavaScript Object Notation.
|
|
virtual | ~SDFEnvelope () |
| | Destructor.
|
| virtual double | Signed (const Vector &) const |
| | Compute the signed distance.
|
| double | BID (const Vector &) const |
| | Compute a lower bound of the signed distance.
|
| void | ComputeCostSigned (const Vector &) |
| | Compute the number of recursive calls to Signed().
|
| QString | GetShader (PrimitiveManager &, std::list< QString > &, bool &) const |
| | Compute the GLSL code to render the node.
|
| QString | GetGradientShader (PrimitiveManager &, std::list< QString > &, bool &) const |
| | Compute the GLSL code to compute the gradient the sdf.
|
| QString | GetCostShader (PrimitiveManager &, std::list< QString > &, bool &) const |
| | Compute the GLSL code to compute the cost of a call to sdf.
|
| virtual int | Memory () const |
| | Return the size of a sub-tree.
|
|
virtual SDFNode * | Copy () const |
| | Deep copy.
|
| virtual double | Cost (const Vector &p) const |
| | Cost of the evaluation of the field at a point: the cost of the node plus the costs of the two sub-trees.
|
| virtual SDFNode * | extract_proxy (int=0) |
| | Replace each sub-tree by a copy of its proxy, see SDFNode::extract_proxy().
|
| | SDFBinary (SDFNode *, SDFNode *) |
| | Create a binary node.
|
|
virtual | ~SDFBinary () |
| | Recursively destroy the sub-trees.
|
| virtual double | K (const Box &) const |
| | Return the local Lipschitz constant.
|
| virtual void | SetShaderId (PrimitiveManager &) |
| | Set up an id for generating GLSL code.
|
| virtual void | ResetShaderId () |
| | Reset the id for generating GLSL code.
|
| int | Nodes () const |
| | Compute the number of nodes in the sub-tree.
|
| SDFNode * | add_proxy () |
| | Create a copy of the node where each sub-tree is replaced by its version with proxies, then bounded by the cheapest proxy, see SDFNode::add_proxy_root().
|
|
| SDFNode () |
| | Create a generic node.
|
|
virtual | ~SDFNode () |
| | Destructor.
|
| virtual Vector | Gradient (const Vector &) const |
| | Compute the gradient of the field.
|
| virtual bool | Inside (const Vector &) const |
| | Check if a point is inside or outside.
|
| virtual Color | GetColor (const Vector &) const |
| | Computes the color.
|
| virtual double | K () const |
| | Return the Lipschitz constant of the node.
|
|
Box | GetBox () const |
| | Return the bounding box of the node.
|
| virtual double | Cost (int=10000) const |
| | Estimate the average cost of the evaluation of the field over the box of the node.
|
| virtual double | Cost (Box, int=10000) const |
| | Estimate the average cost of the evaluation of the field over a box.
|
| SDFNode * | add_proxy_root () |
| | Create a copy of the node, bounded by the cheapest proxy if there is one.
|
|
| static SDFNode * | FromJson (const QJsonValue &json) |
| | Conversion from JavaScript Object Notation.
|
| static SDFNode * | FromJson (const QByteArray &json) |
| | Create a node from its JSON description.
|
| static void | ResetrecursiveCalls () |
| | Reset the recursive call property of the tree.
|
| static int | recursiveCalls () |
| | Return the number of recursive calls counted by the ComputeCost*() functions since the last reset.
|
| static void | addrecursiveCalls (int) |
| | Add a number to the _recursiveCalls counter.
|
| static SDFNode * | Stalactite (const Vector &p, const double &h, const double &r, bool noise=true, Xoshiro256 &random=Xoshiro256::X512, const double &largeur=0.25, const double &espacement=0.61) |
| | Procedural parameterized stalactite.
|
|
static SDFNode * | SpherePieces () |
| | Sphere carved, placed on a cylinder. Nice scene for testing sharp features reconstruction.
|
|
SDFNode * | e [2] = { nullptr,nullptr } |
| | Sub-trees.
|
|
Box | box = Box::Infinity |
| | Box bounding the surface.
|
|
double | k = 1.0 |
| | Lipschitz constant.
|
|
int | cost = 1 |
| | Relative computation cost.
|
|
int | id = -1 |
| | Id to optimize the glsl code generation (avoid repetition when looking twice the same node).
|
|
static constexpr double | Epsilon = 0.01 |
| | Small constant used for bounding volumes and as finite-difference step in Gradient().
|
|
static int | _recursiveCalls = 0 |
| | Recursive calls counted by ComputeCost*().
|
Envelope operator: replaces a costly tree by a cheap bounding proxy when the point is far enough.
The node has two children: the original tree \( e_0 \) and a simplified tree \( e_1 \) (the envelope, or proxy) that englobes it. The node was formerly named SDFBEIS, and the BEIS acronym is still found in some names (useBEIS uniform of the shaders, SDFTerrainLoDContinuousBEIS). The field is
\[ f(p) = \left\{ \begin{array}{ll} e_1(p) & \mbox{if } |e_1(p)| > |o| \mbox{ and } e_1(p) \, o > 0 \\ e_0(p) & \mbox{otherwise} \end{array} \right. \]
where \( o \) is the offset. With a positive offset, the envelope is used outside of the original tree, as soon as the point is farther than \( o \) from the envelope: the (possibly expensive) tree is only evaluated close to the surface. As the envelope englobes the tree, its distance is a lower bound of the distance to the tree, so that ray marching remains safe. With a negative offset, the test is symmetric and applies to the interior (the envelope is then englobed by the tree). The discontinuity of the field when the test switches from one branch to the other is not removed on the CPU, where Signed() ignores continuous; the GLSL code generated by GetShader() uses it to blend the two fields with \( \alpha = \mathrm{smoothstep}(0, o, e_1(p)) \) (the order of the bounds is reversed for a negative offset):
\[ f(p) = \alpha \, e_1(p) + (1-\alpha) \, e_0(p) \]
In the shaders, the uniform useBEIS disables the envelope: the tree is then always evaluated.
The bounding box is that of the original tree. The gradient is that of the original tree, GetGradientShader() ignoring the envelope.
- Author
- Hubert-Brierre Pierre