Remix.run Logo
I put a real-time 3D shader on the Game Boy Color(blog.otterstack.com)
215 points by adunk 6 hours ago | 26 comments
speps 5 hours ago | parent | next [-]

Awesome looking results. As far as I understand it's a "3D" shader in the sense that it looks 3D but it's a prerendered 2D normal map which is then lit using the resulting world space normal.

Here are the frames: https://github.com/nukep/gbshader/tree/main/sequences/gbspin...

Karliss 3 hours ago | parent [-]

It's not that different from "real 3d" renderers. Especially in deferred rendering pipelines the rasterizer creates a bunch of buffers for depth map, normal map, color, etc but main shaders are running on those 2d buffers. That's the beauty of it parts operating with 3d triangles are kept simple simple and the expensive lighting shaders run once on flat 2d images with 0 overdraw. The shaders don't care whether normal map buffer came from 3d geometry which was rasterized just now, prerendered some time ago or the mix of 2. And even in forward rendering pipelines the fragment shader is operating on implicit 2d pixels created by vertex shaders and rasterizer from "real 3d" data.

The way I look at it if the input and math in the shader is working with 3d vectors its a 3d shader. Whether there is also a 3d rasterizer is a separate question.

Modern 3d games are exploiting it in many different ways. Prerendering a 3D model from multiple views might sound like cheating but use of imposters is a real technique used by proper 3d engines.

araes 2 hours ago | parent [-]

There's a GBDK demo that actually does something similar (spinning 2D imposters). Does not handle the lighting though, which is quite impressive.

https://github.com/gbdk-2020/gbdk-2020/tree/develop/gbdk-lib...

Unfortunately, the 2D imposter mode has pretty significant difficulties with arbitrarily rotated 3D. The GBDK imposter rotation demo needs a 256k cart just to handle 64 rotation frames in a circle for a single object. Expanding that out to fully 3D views and rotations gets quite prohibitive.

Haven't tried downloading RGDBS to compile this yet. However, suspect the final file is probably similar, and pushing the upper limits on GB cart sizes.

glouwbug 4 hours ago | parent | prev | next [-]

It’s nice getting real hacker material on hackernews

andix an hour ago | parent [-]

It wasn't just a prompt to an AI? How did they do it? ;)

otterstack an hour ago | parent | prev | next [-]

Hi, author here. I heard it got posted here and decided to make an account, so I can hop in here. Thanks for sharing!

I'm also looking into simplifying it a bit more with environment maps, which I shared on my Bsky: https://bsky.app/profile/dannyspencer.bsky.social/post/3mecu...

Waterluvian 2 hours ago | parent | prev | next [-]

I’m incredibly impressed by this, largely because it actually is running on a CGB. What I see often are hacks where the game boy is just being used as a terminal and the cartridge has been packed with far more powerful processing power.

wasmainiac 4 hours ago | parent | prev | next [-]

> An overall failed attempt at using AI > I attempted to use AI to try out the process, mostly because 1) the industry won't shut up about AI, and 2) I wanted a grounded opinion of it for novel projects, so I have a concrete and personal reference point when talking about it in the wild. At the end of the day, this is still a hobbyist project, so AI really isn't the point! But still...

> I believe in disclosing all attempts or actual uses of generative AI output, because I think it's unethical to deceive people about the process of your work. Not doing so undermines trust, and amounts to disinformation or plagiarism. Disclosure also invites people who have disagreements to engage with the work, which they should be able to. I'm open to feedback, btw.

Thank you for your honesty! Also tremendous project.

otterstack an hour ago | parent [-]

The funny thing is the phrasing used to be more neutral, but I changed the tone to be slightly more skeptical because people thought I was just glazing AI in my post. Another guy on Reddit seemed annoyed that I didn't love AI enough.

I just wanted to document the process for this type of project. shrug

wileydragonfly 14 minutes ago | parent [-]

Just… ignore Reddit.

spacebacon 4 hours ago | parent | prev | next [-]

This GBC shader reveals a key truth: all computation is approximation under constraint. Multiplication becomes table lookups plus addition, while precision yields to what the eye actually sees.

giancarlostoro 2 hours ago | parent | prev | next [-]

I lowkey wish Nintendo would rerelease the GBC or GBA I would buy one. They can bake in some games into a few cartridges and make it 100% worth the buy too.

gkhartman 2 hours ago | parent | next [-]

You can pick a used one up for pretty cheap. Add a flash cartridge and you're done. I think the cheap android handhelds of the same form factor are a better option though.

I've still got my Gameboy collection, but rarely use it. It's just so much easier to fire up an emulator these days.

VimEscapeArtist an hour ago | parent | prev [-]

You can buy the ModRetro Chromatic from the Oculus VR creator. It's better than anything Nintendo could ever produce.

wileydragonfly 13 minutes ago | parent [-]

Doesn’t he use your money to blow people up or something?

HeckFeck 2 hours ago | parent | prev | next [-]

This is the coolest thing I've seen in months. Licence it as beerware, then I'm obliged to owe you one.

villgax 4 hours ago | parent | prev | next [-]

This is why HN exists, almost gives me the same joy as flipping through tech magazines of yester-decades.

Sharlin 4 hours ago | parent | prev | next [-]

The "Making it work" section seems to abruptly end at the following?

  By modifying the instruction operand!

  2A      ld a, [hl+]
  D6 08   sub a, 8
otterstack an hour ago | parent [-]

Aah you're right. That was from my vomit draft and forgot to tidy it up. I'll update the post soon

Sharlin an hour ago | parent [-]

Thanks!

jnpnj 4 hours ago | parent | prev | next [-]

Always loved using old hardware with recent understandings.

fallat 3 hours ago | parent [-]

I don't think there's anything recent here, they are just pre-computing a normal map which doubles as already "baking" a 3D-looking image in.

a_t48 4 hours ago | parent | prev | next [-]

Nice, I’ll have to give this a try on my Analogue Pocket

iLoveOncall 3 hours ago | parent | prev | next [-]

Isn't it a bug that when spinning the object the light also spins?

araes 2 hours ago | parent [-]

It's the equivalent of spinning the view camera around in the scene. Up / Down spins the light coordinates, Left / Right spins the camera viewpoint.

Probably could have been written that way though, since it is spinning the camera view rather than the object.

ndgold 5 hours ago | parent | prev [-]

I can’t believe it