
Company News
Socket Has Acquired Secure Annex
Socket has acquired Secure Annex to expand extension security across browsers, IDEs, and AI tools.
glsl-sdf-sphere
Advanced tools
GLSL SDF function for generating a sphere. Determines the distance between a point and the surface of a sphere at the origin.
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:
#pragma glslify: sphere = require('glsl-sdf-sphere')
vec2 doModel(vec3 p) {
float id = 1.0;
float radius = 0.5;
float dist = sphere(p, radius);
return vec2(dist, id);
}
Note that you can move the sphere around in this case by offsetting the
position vector, for example:
uniform float iGlobalTime;
#pragma glslify: sphere = require('glsl-sdf-sphere')
vec2 doModel(vec3 p) {
vec3 offset = vec3(sin(iGlobalTime), 0, 0);
float id = 1.0;
float radius = 0.5;
float dist = sphere(p - offset, radius);
return vec2(dist, id);
}
See stackgl/contributing for details.
MIT. See LICENSE.md for details.
FAQs
GLSL SDF function for generating a sphere.
The npm package glsl-sdf-sphere receives a total of 4 weekly downloads. As such, glsl-sdf-sphere popularity was classified as not popular.
We found that glsl-sdf-sphere demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Socket has acquired Secure Annex to expand extension security across browsers, IDEs, and AI tools.

Research
/Security News
Socket is tracking cloned Open VSX extensions tied to GlassWorm, with several updated from benign-looking sleepers into malware delivery vehicles.

Product
Reachability analysis for PHP is now available in experimental, helping teams identify which vulnerabilities are actually exploitable.