glsl-sdf-sphere
GLSL SDF function for generating a sphere. Determines the distance between a point and the surface of a sphere at the origin.
Usage
float sphere(vec3 position, float radius)
Returns the signed distanced between position
and a sphere at the origin
with a given radius
. For example, to draw a sphere in a raytracing shader:
# sphere = require('glsl-sdf-sphere')vec2
Note that you can move the sphere around in this case by offsetting the
position
vector, for example:
uniform float iGlobalTime;# sphere = require('glsl-sdf-sphere')vec2
Contributing
See stackgl/contributing for details.
License
MIT. See LICENSE.md for details.