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

texgenjs

v1.1.0

Published

A lightweight procedural texture generation library using GLSL.

Downloads

83

Readme

TexGen - Procedural Texture Generator

TexGen is a powerful, web-based procedural texture generator that leverages GLSL shaders to create high-quality textures in real-time. It features a built-in shader editor, a vast library of examples, and a Physically Based Rendering (PBR) previewer to visualize how textures will look in a modern 3D engine.

🚀 Recent Updates

  • Mobile First: All 3D and physics examples now feature touch-friendly on-screen controls.
  • Adaptive Display: Automatic scaling for high-DPI (Retina) screens and dynamic window resizing.
  • Improved Precision: Library now defaults to highp precision, fixing heightmap artifacts on mobile GPUs.
  • TypeScript Support: Full .d.ts definitions and a browser-ready TypeScript gallery.

📦 Installation

Install via npm:

npm install texgen

Usage

ES Modules:

import TexGen from 'texgen';
import Words from 'texgen/words';

const tg = new TexGen();
const parser = new Words();

CommonJS:

const TexGen = require('texgen');
const Words = require('texgen/words');

CLI Tool:

# Compress a shader to Base64
npx texgen compress my_shader.glsl

# Bake a shader to a PNG file (requires gl and canvas)
npx texgen bake my_shader.glsl 1024 1024 output.png

Features

  • Live GLSL Editor: Write and compile shaders instantly with real-time feedback.
  • Vast Example Library: Over 50 built-in examples ranging from natural elements (island, water, grass) to industrial materials (bricks, rusted hull) and sci-fi effects.
  • PBR Previewer: Visualize your textures with realistic lighting, including albedo, roughness, metallic, and normal mapping.
  • Dynamic Sliders: Add @slider annotations to your GLSL uniforms to create interactive controls for your shaders.
  • Shader Compression: Easily share your creations using built-in URL-based sharing (via shader compression).
  • Visualization Modes: Toggle between Albedo, Normal, Roughness, Metallic, and Ambient Occlusion views.
  • Export Capabilities: Save your generated textures directly from the browser as PNG or raw pixel data.

Getting Started

Prerequisites

  • A modern web browser with WebGL support.
  • Node.js (optional, for local development/testing).

Running Locally

  1. Clone the repository:

    git clone <repository-url>
    cd texgen
  2. Install dependencies:

    npm install
  3. Start the local server:

    npm start

    The application will be available at http://localhost:8080.

Usage

Interactive Sliders

You can define interactive sliders for your uniforms by adding a special comment to your shader code:

uniform float u_scale; // @slider 1.0, 10.0, 5.0

This will automatically generate a slider in the UI ranging from 1.0 to 10.0 with a default value of 5.0.

Baking Modes

Use the UI to switch between different visualization passes:

  • Full PBR: Combined material with lighting.
  • Albedo: Base color.
  • Normals: Surface orientation.
  • Roughness/Metallic: Material properties.

Development

Running Tests

The project uses vitest for unit and UI testing.

npm test

Build Pipeline

The project includes a Makefile for synchronizing versions and generating distribution files.

make build

License

This project is licensed under the ISC License.