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

minecraft-pbr-converter

v1.0.0

Published

Convert Minecraft Bedrock RTX/RenderDragon textures to LabPBR format

Readme

PBR Workflow Converter

A TypeScript Node library for bidirectional conversion between Minecraft Bedrock RTX/RenderDragon PBR textures and LabPBR textures for Minecraft Java Edition shaders.

Features

  • Bidirectional Conversion: Convert textures in both directions:
    • Bedrock MER → LabPBR specular/glossy
    • LabPBR specular/glossy → Bedrock MER
  • Automatic Format Detection: Automatically detect texture format and convert accordingly
  • Normal Map Processing: Handle normal maps with proper channel reconstruction
  • Heightmap Extraction: Extract heightmaps from LabPBR normal textures
  • Ambient Occlusion Handling: Option to bake AO into base color textures
  • Batch Processing: Convert entire directories of textures at once

Installation

# Clone the repository
git clone https://github.com/yourusername/pbr-converter.git

# Install dependencies
cd pbr-converter
npm install

Usage

Command Line Interface

The library provides several commands for different conversion scenarios:

Convert Bedrock to LabPBR (Original functionality)

node dist/cli.js convert path/to/texture_mer.png -c path/to/color.png -o output/dir

Convert LabPBR to Bedrock (New functionality)

node dist/bidirectional/bidirectionalCli.js convert-to-bedrock path/to/texture_s.png -n path/to/texture_n.png -c path/to/color.png -o output/dir

Automatic Format Detection and Conversion

node dist/bidirectional/bidirectionalCli.js convert-auto path/to/any_texture.png -o output/dir

Convert All Textures in a Directory

node dist/bidirectional/bidirectionalCli.js convert-dir path/to/textures/dir -o output/dir

Options

  • -o, --output <dir>: Output directory
  • -f, --format <format>: Output format (png, jpg, tga)
  • -q, --quality <level>: Compression level (1-10)
  • -b, --bake-ao: Bake ambient occlusion into base color texture
  • -e, --extract-height: Extract heightmap from normal texture
  • -d, --direction <direction>: Force conversion direction (auto, to-labpbr, to-bedrock)

Programmatic Usage

import { BidirectionalConverter } from './dist';

// Automatic format detection and conversion
const result = await BidirectionalConverter.convertAuto(
  'path/to/texture.png',
  'output/dir',
  {
    bakeAO: true,
    extractHeightMap: true
  }
);

// LabPBR to Bedrock conversion
const result = await BidirectionalConverter.convertLabPBRToBedrock(
  'path/to/texture_s.png',
  'path/to/texture_n.png',
  'path/to/color.png',
  'output/dir',
  {
    bakeAO: true,
    extractHeightMap: true
  }
);

Texture Format Details

Bedrock MER Format

  • Red Channel: Metallic map (0-255)
  • Green Channel: Emissive level map (0-255)
  • Blue Channel: Roughness map (0-255)
  • Alpha Channel: Subsurface scattering level (optional)

LabPBR Format

  • Specular Texture (_s):

    • Red Channel: Perceptual smoothness (0-255)
    • Green Channel: F0/reflectance (0-229) or predefined metals (230-255)
    • Blue Channel: Porosity (0-64) or subsurface scattering (65-255)
    • Alpha Channel: Emissive level (0-254, 255 is reserved)
  • Normal Texture (_n):

    • Red/Green Channels: Normal map in DirectX format (Y-)
    • Blue Channel: Ambient Occlusion (0 = 100% AO, 255 = 0% AO)
    • Alpha Channel: Height map (0 = depth, 255 = height)

License

GPL


Made with Manus