
roundedRectangleSdf2d
sdf2d
roundedRectangleSdf2d
RayTK
v0.36
SDF for a 2D rectangle with optionally rounded corners.
Each corner has a separate roundness setting, which can be used to make some corners round and others sharp.
See ShaderToy for example.
Parameters
-
Scale
: The size of the rectangle along the X and Y axes. -
Roundness
: The distance of rounding for each of the four corners. When the roundness exceeds half the `Scale`, the rectangle will have discontinuities along the axes. -
Roundness Unit
:-
Distance
: -
Ratio of Scale
:
-
Inputs
-
Scale Field
: (optional)- Coordinate Types:
vec2
- Context Types:
Context
MaterialContext
CameraContext
LightContext
RayContext
ParticleContext
- Return Types:
float
vec4
- Coordinate Types:
-
Roundness Field
: (optional)- Coordinate Types:
vec2
- Context Types:
Context
MaterialContext
CameraContext
LightContext
RayContext
ParticleContext
- Return Types:
float
vec4
- Coordinate Types: