Skip to content

Repository files navigation

FastSoftware3D 0.1.0 [ALPHA-2026-06] — High-Performance Software 3D Renderer for Java

Status License: MIT Java Platform JitPack

⚡ A micro-optimized, zero-dependency software 3D rendering pipeline for Java. Engineered for high-refresh rates, AVX2 SIMD vectorization, dynamic SSAA downsampling, and multi-level material mipmapping.

FastSoftware3D is the high-performance 3D graphics substrate of the FastJava ecosystem. It introduces a lightweight software rasterizer kernel operating completely independently of heavy graphics APIs, rendering perspective-correct textured triangles to desktop framebuffers or offscreen pixel arrays.

To achieve a completely responsive, zero-latency desktop experience, FastSoftware3D is designed to pair natively with the helper modules of the FastJava ecosystem:

  • 🎬 FastAnimation — Direct-memory frame animation and timeline synchronization.
  • 🚀 FastTerminal3D — For rendering the 3D pipeline directly into a command console viewport.

Watch Demo (YouTube) | Watch JMH Benchmark (YouTube)

FastSoftware3D Showcase


Quick Start — Desktop Demo

import fastsoftware3d.camera.Camera;
import fastsoftware3d.core.Framebuffer;
import fastsoftware3d.core.RenderPipeline;
import fastsoftware3d.rasterizer.NativeRasterizer;
import fastsoftware3d.scene.ModelNode;
import fastsoftware3d.scene.Scene;
import fastsoftware3d.scene.Renderer3D;
import fastsoftware3d.model.ObjLoader;
import fastsoftware3d.material.Material;

public class Demo {
    public static void main(String[] args) throws Exception {
        // 1. Setup Camera and Framebuffer
        Camera camera = new Camera(0, 0, -10, 0, 0, 60);
        int[] pixels = new int[800 * 600];
        Framebuffer fb = new Framebuffer(800, 600, pixels);
        
        // 2. Instantiate Render Pipeline
        RenderPipeline pipeline = new RenderPipeline(camera, fb, new NativeRasterizer());
        Renderer3D renderer = new Renderer3D(pipeline);
        
        // 3. Create Scene and load models
        Scene scene = new Scene();
        ObjLoader.ModelData model = ObjLoader.load("docs/room.obj");
        Material wallMat = Material.fromPng("docs/wall.png");
        
        scene.getRoot().addChild(new ModelNode(model, wallMat));
        
        // 4. Render Frame
        renderer.clear();
        scene.render(renderer, null);
        pipeline.postProcess();
    }
}

Table of Contents


Why FastSoftware3D?

Standard 3D rendering approaches in Java force developers to choose between slow pure-Java software engines and heavy hardware graphics wrappers:

  1. Scalar Java Loop Bottlenecks: Pure Java software renderers process triangle rasterization and depth testing pixel-by-pixel, bounded by JIT array bounds checks and lack of predictable vectorization.
  2. Devastating GC Latency Spikes: Allocating vector objects, color instances, and vertex buffers inside the per-frame render loop creates rapid JVM heap churn, causing GC pauses and stutter.
  3. Heavy Native Dependencies & GPU Failures: Hardware-accelerated APIs like OpenGL/Vulkan via LWJGL require full graphics drivers, GPU hardware contexts, and display servers—failing on headless servers, CI pipelines, and minimal cloud containers.
  4. Texture Aliasing & Artifacts: Basic CPU rasterizers lack mipmapping and anti-aliasing, producing severe moiré patterns and shimmering crawling artifacts on distant geometry.

FastSoftware3D provides a micro-optimized software pipeline pairing a clean Java scene graph with a native AVX2 SIMD rasterization kernel:

  • AVX2 8-Pixel SIMD Rasterization: Native C++ kernel tests edge functions and Z-buffer depth for 8 pixels in parallel using 256-bit vector registers.
  • Zero GC Render Loop: Pre-allocated framebuffers and reusable structures guarantee zero per-frame heap allocations.
  • Hardware-Agnostic Headless Operation: Runs anywhere without requiring GPU drivers, display servers, or OpenGL/Vulkan contexts.
  • Advanced Mipmapping & SSAA: Built-in 4-mode material mipmapping and dynamic SSAA (up to 16x) for pristine image quality.
Feature Pure Java CPU Rasterizers Heavy GPU Stacks (LWJGL / OpenGL) FastSoftware3D
Rasterization Backend Pure Java scalar bytecode GPU hardware pipeline (Shaders) Native AVX2 SIMD kernel (C++)
Rasterization Time (640x480) ~12.4 ms (Baseline 1.0x) Variable (GPU pipeline) 0.8 ms (15.5x faster)
Driver / GPU Requirement None (CPU bound) Full GPU drivers + Display server None (100% Software CPU)
Headless / Container Ready ✅ Yes (Slow) ❌ Complex (Fails without display/GPU) ✅ Full support (<1 ms render)
Render Loop Allocations High heap churn / frame Native buffer management 0 bytes GC allocations
Texture Filtering Nearest / Basic bilinear Hardware anisotropic 4 Mipmap modes + Bayer dither

Key Features

  • 🚀 AVX2 SIMD Vectorization — Native C++ core parallelizes edge-function overlap testing and Z-buffer depth comparisons across 8 pixels concurrently using 256-bit vector registers.
  • 🗺️ Material Mipmapping — Eliminates high-frequency texture aliasing/flickering noise on distant surfaces with four selectable modes:
    • None: Samples exclusively from raw full-resolution textures.
    • Tweaked Discrete: Point samples nearest level with pushed depth thresholds.
    • Dithered Mipmapping: Blends mipmap levels using a screen-space 4x4 Bayer dither matrix for zero color interpolation overhead.
    • Bilinear Level Blend: Seamlessly interpolates colors between the two nearest mipmap levels.
  • đźš« Zero GC Allocations — Zero allocations inside the main rendering loops, preventing GC pause spikes.
  • 🎨 Anti-Aliasing (SSAA) — Dynamic Super-Sample Anti-Aliasing (SSAA) supporting 1x, 2x, 4x, 8x, and 16x downscaled rendering factors.
  • đź”® Camera Post-Effects — Integrated barrel/pincushion lens distortion and linear depth fog shaders.

Interactive Keyboard Shortcuts (HUD)

Use these dynamic keys inside the desktop demos to experiment with parameters at runtime:

Key Action Details
1 - 5 Select SSAA Factor Set anti-aliasing to 1x, 2x, 4x, 8x, or 16x.
G Cycle Mipmap Mode Switch between: None, Tweaked Discrete, Dithered, or Bilinear Level Blend.
K Toggle Lens Distortion Enable or disable Barrel/Fisheye post-processing.
U / I Modify Lens Strength Adjust lens distortion coefficient from barrel (+) to pincushion (-).
C Toggle Collisions Enable or disable player collision boxes.

Performance Benchmarks

Measured on a standard desktop window rendering the textured Wolfenstein level at 640x480 resolution (SSAA 1x):

Rasterization Implementation Frame Time Relative Speedup
Pure-Java Fallback 12.4 ms 1.0x (Baseline)
JNI C++ Rasterizer (Scalar) 2.1 ms 5.9x
JNI C++ Rasterizer (AVX2 SIMD) 0.8 ms 15.5x

API Quick Reference

Class Method Description
RenderPipeline renderModel(...) Transforms, projects, frustum-culls, and queues triangles for rasterization.
NativeRasterizer drawTriangles(...) Entry point for pinned array passing to the JNI library.
Material fromPng(...) Loads a source image and generates downscaled box-filtered mipmap pyramid levels.

Installation

Option 1: Maven (Recommended)

Add the JitPack repository and the library dependency to your pom.xml:

<repositories>
    <repository>
        <id>jitpack.io</id>
        <url>https://jitpack.io</url>
    </repository>
</repositories>

<dependencies>
    <dependency>
        <groupId>com.github.andrestubbe</groupId>
        <artifactId>FastSoftware3D</artifactId>
        <version>main-SNAPSHOT</version>
    </dependency>
    <dependency>
        <groupId>com.github.andrestubbe</groupId>
        <artifactId>FastCore</artifactId>
        <version>0.1.0</version>
    </dependency>
</dependencies>

Option 2: Gradle

Add JitPack to your repositories and include the library dependency:

repositories {
    maven { url 'https://jitpack.io' }
}

dependencies {
    implementation 'com.github.andrestubbe:FastSoftware3D:main-SNAPSHOT'
    implementation 'com.github.andrestubbe:FastCore:0.1.0'
}

Technical Examples & Hero Demos

Ready-to-run batch scripts located in the root directory:

  • run-demo.bat — Launches the interactive Swing desktop 3D window.

Documentation

  • COMPILE.md: Full compilation guide (Maven Build Setup).
  • REFERENCE.md: Exhaustive catalog of API methods and engine architecture.
  • PHILOSOPHY.md: Zero-allocation and low-overhead processing designs.
  • ROADMAP.md: Planned milestone features and performance extensions.
  • CHANGELOG.md: Version history and engine updates.

License

MIT License — See LICENSE for details.


Related Projects

  • FastTerminal — Direct, low-latency raw console renderer and keyboard hooks
  • FastANSI — Micro-optimized ANSI escape sequence builder and parser
  • FastMouse — Precise hardware-level and virtual console-mode input tracking
  • FastJSON — Zero-allocation JSON parser
  • FastFileScrape — High-throughput file scraping utility
  • FastGLOB — Native performance glob matching
  • FastCore — Native JNI Loader and Utilities

Part of the FastJava Ecosystem — Making the JVM faster. Small package. Maximum speed. Zero bloat. 🚀📋

About

🎮 High‑performance software 3D renderer for Java — AVX2‑accelerated rasterization, dynamic SSAA, mipmapped materials, and zero‑GC rendering loops for ultra‑smooth real‑time graphics.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages