npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@gov.nasa.jpl.honeycomb/mixin-shaders

v0.0.6

Published

Mixin functions for building custom three.js materials.

Downloads

8

Readme

mixin-shaders

Set of mixin function and shader composition utilities for to extending and modifying three.js materials.

Use

import { ShaderLib } from 'three';
import { Mixins, ExtendedShaderMaterial } from '@gov.nasa.jpl.honeycomb/mixin-shaders';

const TopoStandardMaterial =
    ExtendedShaderMaterial.createClass(
        ShaderLib.standard,
        [
            Mixins.SteepnessShaderMixin,
            Mixins.TopoLineShaderMixin,
        ]
    );
const material = new TopoStandardMaterial();
material.ENABLE_TOPO_LINES = 1;
material.topoLineColor.set( 0xff0000 );

API

Mixins

Set of functions that modify existing shader definitions to add in effects. Every mixin adds shader uniforms and a DEFINE keyword that defaults to 0 to toggle and change the effect.

GridClipMixin

GridClipMixin( shader : Shader ) : Shader

Clips the material into a grid.

Define

ENABLE_GRID_CLIP

Uniforms

{
    // the width of one grid cell in world units
    gridSize = 1 : number,

    // the thickness of grid lines in world units
    gridThickness = 0.1 : number,

    // where the "center" of the grid should begin
    gridOffset = 0, 0, 0 : Vector3
}

ClipPlaneMixin

ClipPlaneMixin( shader : Shader ) : Shader

Discards fragments on the positive side of the plane.

Define

ENABLE_CLIP_PLANE

Uniforms

{
    // a vector representing the plane where the xyz component is
    // the normal and w is the distance
    clipPlane = 0, 1, 0, 0 : Vector4,
}

SteepnessShaderMixin

SteepnessShaderMixin( shader : Shader ) : Shader

Colors fragments that are above a certain slope relative to the "up" vector. Works best when flatShading is enabled.

Define

ENABLE_STEEPNESS_VISUALIZATION

Uniforms

{
    // the color to tint the fragments
    steepnessColor = 0, 0, 0 : Color,

    // the threshold above which to color the fragments where
    // 1 is up (or down) and 0 is horizontal
    maxSteepness = 0.5 : number
}

SteepnessClipShaderMixin

SteepnessClipShaderMixin( shader : Shader ) : Shader

Clips fragments that are above a certain steepness threshold relative to a provided vector.

Define

ENABLE_STEEPNESS_CLIP

Uniforms

{
    // the threshold below which to color the fragments where
    // 1 is along the steepnessClipVector and 0 is perpendicular
    steepnessClip = 0.001 : number,

    // the vector along which to check the steepness
    steepnessClipVector = 0, 1, 0 : Vector3
}

TopoLineShaderMixin

TopoLineShaderMixin( shader : Shader ) : Shader

Effect that adds topographic lines to the surface of a material.

Define

ENABLE_TOPO_LINES

Uniforms

{
    // the color to make the lines
    topoLineColor = 0, 0, 0 : Color,

    // the thickness factor for the lines. This does not correspond
    // to world units.
    topoLineThickness = 0.005 : number

    // how far apart to space the lines in world units.
    topoLineSpacing = 0.1 : number

    // how far to offset the topo lines from 0.
    topoLineOffset = 0 : number

    // how often to emphasize a topographic line. Non-emphasized lines
    // will disappear once the camera tracks too far away.
    topoLineEmphasisMod = 10 : number
}

ColorRampShaderMixin

ColorRampShaderMixin( shader : Shader ) : Shader

Effect that adds a color gradient from one y position to another.

Define

ENABLE_COLOR_RAMP

Uniforms

{
    // the color to use for the color ramp
    rampColor = 0, 0, 0 : Color,

    // the world y position to start the ramp at
    rampMin = 0 : number

    // the world y position to end the ramp at
    rampMax = 1 : number
}

DitheredTransparencyShaderMixin

DitheredTransparencyShaderMixin( shader : Shader ) : Shader

Effect that adds clip transparency to avoid transparent object overdraw and draw order artifacts.

Define

ENABLE_DITHER_TRANSPARENCY

Uniforms

{
    // texture used compare alpha to and discard pixels. Defaults to a
    // dither pattern texture.
    ditherTex : Texture
}

PerturbedFilterShaderMixin

PerturbedFilterShaderMixin( shader : Shader ) : Shader

TODO

BinnedPointsMixin

BinnedPointsMixin( shader : Shader ) : Shader

Effect that bins and renders points as cubes in a voxelized fashion. This shader expects that the geometry is being rendered is an instanced cube with instance_position being provided for point positions.

Define

BINNED_POINTS

Uniforms

{
    // The size of the voxelized space and width of the cubes
    binnedPointsScale = 1 : number,

    // the offset of the voxelized space
    binnedPointsOffset = 0, 0, 0 : Vector3
}

ExtendedShaderMaterial

extends ShaderMaterial

A ShaderMaterial wrapper that exposes are uniforms as member variables of the material instance and defines is a Proxy object that will automatically mark the material as needing an update when one changes.

.createClass

static

createClass( base : Shader, mixinList : Array<Function> ) : Class

Takes a shader and a list of mixin functions to apply to the shader. A class definition based on ExtendedShaderMaterial is returned to instantiate the material. The returned class defintion has a constructor that only takes options.

constructor

constructor( definition : Shader, options : Object )

Takes a shader definition to use for the shader as definition and a set of default shader options as options.