Close Menu

    Subscribe to Updates

    Get the latest creative news from FooBar about art, design and business.

    What's Hot

    Sales data indicates Sony’s PS5 ports are increasingly losing audience share on PC, but only because of release timing

    GDC Awards 2026 to recognise Don Daglow and Rebecca Heineman

    How Steam changes and a China strategy helped TinyBuild’s The King is Watching hit 500k sales

    Facebook X (Twitter) Instagram
    • Artificial Intelligence
    • Business Technology
    • Cryptocurrency
    • Gadgets
    • Gaming
    • Health
    • Software and Apps
    • Technology
    Facebook X (Twitter) Instagram Pinterest Vimeo
    Tech AI Verse
    • Home
    • Artificial Intelligence

      What the polls say about how Americans are using AI

      February 27, 2026

      Tensions between the Pentagon and AI giant Anthropic reach a boiling point

      February 21, 2026

      Read the extended transcript: President Donald Trump interviewed by ‘NBC Nightly News’ anchor Tom Llamas

      February 6, 2026

      Stocks and bitcoin sink as investors dump software company shares

      February 4, 2026

      AI, crypto and Trump super PACs stash millions to spend on the midterms

      February 2, 2026
    • Business

      Google releases Gemini 3.1 Flash Lite at 1/8th the cost of Pro

      March 4, 2026

      Huawei Watch GT Series

      March 4, 2026

      Weighing up the enterprise risks of neocloud providers

      March 3, 2026

      A stolen Gemini API key turned a $180 bill into $82,000 in two days

      March 3, 2026

      These ultra-budget laptops “include” 1.2TB storage, but most of it is OneDrive trial space

      March 1, 2026
    • Crypto

      Banks Respond to Kraken’s Federal Reserve Access as Trump Sides with Crypto

      March 4, 2026

      Hyperliquid and DEXs Break the Top 10 — Is the CEX Era Ending?

      March 4, 2026

      Consensus Hong Kong 2026: The Institutional Turn 

      March 4, 2026

      New Crypto Mutuum Finance (MUTM) Reports V1 Protocol Progress as Roadmap Enters Phase 3

      March 4, 2026

      Bitcoin Short Sellers Caught Off Guard in New White House Move

      March 4, 2026
    • Technology

      UK government delays AI copyright rules amid artist outcry

      March 6, 2026

      We Might All Be AI Engineers Now

      March 6, 2026

      GPL upgrades via section 14 proxy delegation

      March 6, 2026

      Anthropic says it will challenge Defense Department’s supply chain risk designation in court

      March 6, 2026

      House of Lords urges UK government to protect IP against AI misuse

      March 6, 2026
    • Others
      • Gadgets
      • Gaming
      • Health
      • Software and Apps
    Check BMI
    Tech AI Verse
    You are at:Home»Technology»Palette lighting tricks on the Nintendo 64
    Technology

    Palette lighting tricks on the Nintendo 64

    TechAiVerseBy TechAiVerseMay 17, 2025No Comments6 Mins Read8 Views
    Facebook Twitter Pinterest Telegram LinkedIn Tumblr Email Reddit
    Share
    Facebook Twitter LinkedIn Pinterest WhatsApp Email

    Palette lighting tricks on the Nintendo 64

    This article is a continuation to my Bluesky thread from April.

    We made a Nintendo 64 demo for Revision 2025!



    It has baked lighting with normal mapping and real-time specular shading, ahem, well sort of.
    More on that later.
    The beautiful song was made by noby with guitar performed by Moloko (https://soundcloud.com/sou_andrade).

    Below I have some notes on the directional ambient and normal mapping techniques I developed.
    They are both pretty simple in the end but I haven’t seen them used elsewhere.

    But wait, normal mapping on the N64?

    I knew normal mapping on the N64 was possible due to earlier experiments by fellow homebrew developers WadeTyhon and Spooky Iluha. I had also done some emboss bump mapping hacks myself.

    The approach explained in this article is not new: the renderer computes lighting directly to textures at runtime.
    It’s great because no specialized hardware support is needed and you can run arbitrary shading code on the CPU.
    Too bad it’s so slow…

    Shading a palette instead

    So the idea is to do texture-space shading on the CPU.
    But what if it’s a palette texture we’re shading?
    Those are very common on the N64 anyway.
    In that case it’s enough to update only the palette and the texture will respond as if we computed lighting for each texel.
    Instant savings!

    The original palette is replaced with a shaded palette and the palette texture is applied as a regular texture to an object.
    With just a diffuse “dot(N,L)” lighting the results look pretty good:

    In the above example I also did shading in linear space by undoing the gamma correction of the color texture 🙂 In the final demo it wasn’t possible because I split the ambient and direct light terms to be combined by N64’s RDP unit in hardware.

    Object-space normal mapping

    Usually normal mapping is done in tangent space.
    This is way you can use repeating textures and the fine normals can modulate smoothly varying vertex normals.
    A tangent-space normal map of a single color represents a smooth surface.

    An object-space normal is simpler but more constrained.
    Now the normal map’s texels don’t represent deviations from the vertex normals but absolute surface normals instead.
    The runtime math becomes simpler – just read a color from a texture – but all surface points now need a unique texel, like in lightmaps.

    The objects have both a diffuse texture (basecolor * ao) and a normal map.
    Both textures actually share the same palette indices that I generated with scikit-learn’s K-means clustering.
    The images were interpreted as a single six-channel image for that to work.

    Below is an example how the compression looks with a tangent-space normal map.

    At shading time, which can happen on load or on each frame, each palette color is processed in a for loop.
    A single index is used to fetch a normal and a surface diffuse color.
    The CPU-side shader code then produces a new RGB color for that index.
    The result of the loop is a new palette but with shading applied.

    Unfortunately this approach only really works with directional lights.
    It’s also difficult to represent any kind of shadows with just the palette alone.
    That’s why I started looking into how baked lighting could fit in the to the equation.

    Baked directional ambient and sun light

    I wanted the demo to have a building with realistic lighting.
    Perhaps it was a bit too ambitious😅
    After a lot of deliberation, I put ambient and direct sun lighting in vertex color RGB and alpha channels, respectively.
    The ambient term is further split into a directional intensity (a greyscale environment map) and color (vertex RGB with a saturation boost).
    The sun is a directional light whose visibility is transmitted in vertex alpha.

    The shading formula is therefore this:

    ambient = vertex_rgb      * grey_irradiance_map(N) 
    direct  = vertex_alpha    * sun_color * dot(N, sun_dir)
    color   = diffuse_texture * (ambient + direct)

    Here’s how the different terms look:

    Note how the messy “Sun visibility” vertex colors get neatly masked out by the sun (N.L) computation in the bottom right corner.
    In the end the ambient and direct terms are summed to get the shaded result below.

    The thing about directional ambient is that even the baked lighting is rough, the details in the textures still make it look pretty high end.
    Consider this scene that has just a colored blurred environment map and per-vertex ambient occlusion:

    It really pops!
    I love image-based lighting.

    For the blurred environment maps, I used an equirectangular projection for simplicity.
    Polyhaven’s HDRIs already use the projection.
    Since I precomputed the shading at load time, the complex sampling math wasn’t an issue.

    Shading a larger model with repeating textures

    I designed the original shading algorithm for single objects and only tested it with the potato_rock.obj you saw in the beginning.
    For the demo, the castle mesh’s repeating textures posed a problem.
    As a workaround, I split the large mesh into submeshes that each conceptually share the same object-space normal map.

    The task was done primarily by yours truly manually in Blender, by grouping geometry by material and surface direction.
    The computer did its part by calculating a world-to-model matrix based on polygon normals for each group.
    That is a pretty much an approximate tangent space.
    So I couldn’t escape them in the end!

    Each of these groups shares a palette so as a whole their lighting will be correct only in the average sense.

    The tangent spaces are not interpolated at runtime, which shows up as faceted lighting.
    This is perhaps the biggest downside of this technique.

    Specular shading

    Since many surface points now share the same shaded color, computing point light or specular shading correctly is not possible.
    The “palette-space” approach only really works for diffuse directional lights because the shading formulas don’t need a “to camera” vector V, which depends on the position of the shaded surface point.
    Yet still I tried to hack it for the speculars 🙂

    If we approximate the object to be shaded as a sphere, then the point p being shaded is simply p=radius*normal.
    We must also accept that the result will look faceted since many surface points share the same palette index.

    In the demo, the specular highlights looked a bit funny but still they seemed to fool most people. I count this as a success.

    Is this the future?

    In the demo I tried to hide the main limitations of the technique: shading discontinuities, only greyscale textures supported (!), no point lights.
    So it really only works with elaborate preprocessing.
    I’d love to see the shading discontinuity issue solved somehow (Spooky Iluha’s techniques don’t have it) without losing support for both ambient and direct lighting.
    I don’t know if it’s possible but that’s what makes this hobby so fun 🙂

    A PAL-compatible N64 ROM is available but note that it crashes a lot.


    I’m also thinking of writing a book. Sign up here if you’re interested.

    Share. Facebook Twitter Pinterest LinkedIn Reddit WhatsApp Telegram Email
    Previous ArticleSteepest Descent Density Control for Compact 3D Gaussian Splatting
    Next Article UKRI must do more to drive innovation agenda and avoid fraud
    TechAiVerse
    • Website

    Jonathan is a tech enthusiast and the mind behind Tech AI Verse. With a passion for artificial intelligence, consumer tech, and emerging innovations, he deliver clear, insightful content to keep readers informed. From cutting-edge gadgets to AI advancements and cryptocurrency trends, Jonathan breaks down complex topics to make technology accessible to all.

    Related Posts

    UK government delays AI copyright rules amid artist outcry

    March 6, 2026

    We Might All Be AI Engineers Now

    March 6, 2026

    GPL upgrades via section 14 proxy delegation

    March 6, 2026
    Leave A Reply Cancel Reply

    Top Posts

    Ping, You’ve Got Whale: AI detection system alerts ships of whales in their path

    April 22, 2025705 Views

    Lumo vs. Duck AI: Which AI is Better for Your Privacy?

    July 31, 2025291 Views

    6.7 Cummins Lifter Failure: What Years Are Affected (And Possible Fixes)

    April 14, 2025164 Views

    6 Best MagSafe Phone Grips (2025), Tested and Reviewed

    April 6, 2025125 Views
    Don't Miss
    Gaming March 6, 2026

    Sales data indicates Sony’s PS5 ports are increasingly losing audience share on PC, but only because of release timing

    Sales data indicates Sony’s PS5 ports are increasingly losing audience share on PC, but only…

    GDC Awards 2026 to recognise Don Daglow and Rebecca Heineman

    How Steam changes and a China strategy helped TinyBuild’s The King is Watching hit 500k sales

    Next-gen Xbox console, codenamed Project Helix, will play PC games

    Stay In Touch
    • Facebook
    • Twitter
    • Pinterest
    • Instagram
    • YouTube
    • Vimeo

    Subscribe to Updates

    Get the latest creative news from SmartMag about art & design.

    About Us
    About Us

    Welcome to Tech AI Verse, your go-to destination for everything technology! We bring you the latest news, trends, and insights from the ever-evolving world of tech. Our coverage spans across global technology industry updates, artificial intelligence advancements, machine learning ethics, and automation innovations. Stay connected with us as we explore the limitless possibilities of technology!

    Facebook X (Twitter) Pinterest YouTube WhatsApp
    Our Picks

    Sales data indicates Sony’s PS5 ports are increasingly losing audience share on PC, but only because of release timing

    March 6, 20262 Views

    GDC Awards 2026 to recognise Don Daglow and Rebecca Heineman

    March 6, 20262 Views

    How Steam changes and a China strategy helped TinyBuild’s The King is Watching hit 500k sales

    March 6, 20262 Views
    Most Popular

    7 Best Kids Bikes (2025): Mountain, Balance, Pedal, Coaster

    March 13, 20250 Views

    VTOMAN FlashSpeed 1500: Plenty Of Power For All Your Gear

    March 13, 20250 Views

    Best TV Antenna of 2025

    March 13, 20250 Views
    © 2026 TechAiVerse. Designed by Divya Tech.
    • Home
    • About Us
    • Contact Us
    • Privacy Policy
    • Terms & Conditions

    Type above and press Enter to search. Press Esc to cancel.