Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
display-sdf
Advanced tools
Helper library for displaying SDFs, supports rendering "straight" from GPU, or meshing with surface-nets and displaying as a mesh.
npm install display-sdf --save
const { displayRaw } = require("display-sdf");
// generate shaderCode
displayRaw(shaderCode);
In combination with hiccup-sdf
:
const { displayRaw } = require("display-sdf");
const { compileShader, glslHelpers } = require("hiccup-sdf");
const tree = ["box"]
const { inject, model } = compileShader(tree);
const shader = glslHelpers.createShaderFull(model, inject);
displayRaw(shader);
Sometimes working with "straight" GPU rendering is not ideal, so display-sdf
provides an option to mesh the SDF using surface-nets, and display afterwards:
const { displayRaw } = require("display-sdf");
// generate shaderCode
displayMesh(shader, { size: 128 });
All options are optional.
displayRaw(shaderCode, [options])
shaderCode
- stringified SDF GLSL codeoptions.textures
- custom data textures to pass to the shader, used by hiccup-sdf
map
function to work over large amounts of datadisplayMesh(shaderCode, [options])
shaderCode
- stringified SDF GLSL codeoptions.size
- size of the surface-nets field (uniform box, so 128
becomes [128, 128, 128]
)options.textures
- custom data textures to pass to the shader, used by hiccup-sdf
map
function to work over large amounts of dataoptions.refine
- should refine-mesh
be executed after meshing, this usually makes the output look nicer (true
/false
)options.refineOptions
- custom options to pass to refine-mesh
This project was developed in part at Laboratory, an artist residency for interactive arts: https://laboratoryspokane.com.
FAQs
simple fullscreen SDF shader visualizer
The npm package display-sdf receives a total of 0 weekly downloads. As such, display-sdf popularity was classified as not popular.
We found that display-sdf 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.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.