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 🙏

© 2025 – Pkg Stats / Ryan Hefner

react-not-shader

v0.0.5

Published

Effortless .glsl components in React

Readme

glsl-app-test

A minimal React Three Fiber demo that lets you render custom GLSL shaders on a full-screen canvas or mapped onto 3D text geometry. Comes with a <ShaderCanvas> component that you can drop into any Next.js or Create React App project.


Table of Contents


Features

  • Full-screen shader canvas: Renders a plane filling the viewport with your GLSL fragment + vertex shaders.
  • 3D text support: Render any string as centered 3D text with the same shader material.
  • Mouse & time uniforms: Built-in uTime, uResolution, and uMouse uniforms.
  • Hot-load from files or strings: Pass shader code directly or via .glsl/.frag/.vert file paths.
  • Zero dependencies outside R3F & Drei: Leverages @react-three/fiber, @react-three/drei, and three-custom-shader-material.

Demo

Shader Demo


Installation

  1. Clone the repo

    git clone https://github.com/your-username/glsl-app-test.git
    cd glsl-app-test
  2. Install dependencies

    npm install
    # or
    yarn
  3. Run locally

    npm run dev
    # or
    yarn dev

Usage

Import and wrap your content in <ShaderCanvas>. Any string child will be rendered as shader-mapped 3D text; non-string children will be rendered via <Html> on top of your shader canvas.

// app/page.tsx (Next.js) or App.tsx (CRA)
import React from 'react';
import ShaderCanvas from 'glsl-app-test';
import { vertexShader, fragmentShader } from 'glsl-app-test/shader';

export default function App() {
  return (
    <ShaderCanvas
      vertexShader={vertexShader}
      fragmentShader={fragmentShader}
      fontPath="/fonts/Syne_Regular.json"
      textOptions={{ size: 2, depth: 0.2 }}
    >
      Hello, Shader!
    </ShaderCanvas>
  );
}

Props

| Prop | Type | Default | Description | | ---------------- | ---------- | --------------------------------- | ------------------------------------------------------------------------------------ | | children | ReactNode | — | If a string/number, renders as centered 3D text; otherwise rendered via <Html>. | | vertexShader | string | built-in vertex shader | GLSL code or path to .vert/.glsl file. | | fragmentShader | string | built-in fragment shader | GLSL code or path to .frag/.glsl file. | | fontPath | string | /fonts/Syne_Regular.json | Path to a Three.js font JSON for TextGeometry. | | textOptions | object | {} | Options for TextGeometry: | | | | | – size (default 1) | | | | | – depth (default 0) | | | | | – curveSegments (default 12) | | | | | – position (default [0,0,0.1]) | | | | | – renderOrder (default 1) |


Shaders

The default shaders are available from the package:

// vertexShader (three-custom-shader-material expects csm_PositionRaw)
varying vec2 vUv;
uniform float uTime;
uniform vec2 uResolution;
uniform vec2 uMouse;

void main() {
  vUv = uv;
  csm_PositionRaw = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
}
// fragmentShader
varying vec2 vUv;
uniform float uTime;
uniform vec2 uResolution;
uniform vec2 uMouse;

void main() {
  float r = abs(sin(uTime + vUv.x * 10.0));
  float g = abs(sin(uTime + vUv.y * 10.0));
  float b = abs(sin(uTime));
  csm_FragColor = vec4(r, g, b, 1.0);
}

Customization

  • Load from file:
    <ShaderCanvas
      vertexShader="/shaders/my.vert.glsl"
      fragmentShader="/shaders/my.frag.glsl"
    />
  • Hot-reload: Changing the vertexShader or fragmentShader prop will reload the code automatically.
  • Uniforms:
    • uTime: elapsed time in seconds
    • uResolution: vec2(window.innerWidth, window.innerHeight)
    • uMouse: normalized mouse coords (−1…+1)
  • Fonts & Text: Drop any Three.js font JSON in /public/fonts/ and update fontPath.

Examples

// Overlay HTML on top of the shader
<ShaderCanvas>
  <div style={{ color: 'white', fontSize: '2rem' }}>Overlay HTML</div>
</ShaderCanvas>
// Floating 3D text
<ShaderCanvas textOptions={{ size: 1.5, position: [0, 1, 0.2] }}>
  Floating Text
</ShaderCanvas>

Development

  • Dependencies: @react-three/fiber, @react-three/drei, three-custom-shader-material.
  • TypeScript + Hooks: Fully typed, functional components.
  • Linting & Formatting: Configure ESLint/Prettier as desired.

License

MIT © notzambajr