10 ms·
I put a real-time 3D shader on the Game Boy Color
- ndgold 8mo agoI can’t believe it
- speps 8mo agoAwesome 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_frames https://github.com/nukep/gbshader/tree/main/sequences/gbspin...
- Karliss 8mo agoIt'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 8mo agoThere'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/examples/gb/hblank_copy 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.
- anthk 8mo agoWell, Cannon Fodder for the GBC it's 1 MB big, and the rest such as Metal Gear and Alone in the Dark are pretty sized for the hardware.
- antidamage 8mo agoIt's not that different from how some creative Mac games were doing 3d lighting on 2d textures prior to 3d accelerated hardware being available. The neat part here is that it runs on a Gameboy Colour.
- bulbar 8mo agoOn a device that apparently doesn't even support floating point operations and doesn't support multiplication. Super cool.
- Someone 8mo agoIt’s a shader, not a renderer. The images are pre-rendered, but the shading is done in real time. ⇒ I think they’re correct in calling this a 3D shader.
- glouwbug 8mo agoIt’s nice getting real hacker material on hackernews
- andix 8mo agoIt wasn't just a prompt to an AI? How did they do it? ;)
- FeteCommuniste 8mo agoThe lost, dark art of using one's brain to implement something line by line.
- jama211 8mo agoI mean it’s cool and all but it’s like making a painting entirely out of tiny dots with your hands tied behind your back. I’m happy for their achievement and it looks cool but it shouldn’t throw any shade on those of us who just like to use a paint brush instead.
- tkel 8mo agoYou mean you tell someone else to make a painting while you watch and then claim their work as yours
- jama211 8mo agoGenuinely curious, what’s your goal here? Disparage those who use LLMs? Or just express your unhappiness at the amount of ai content on the HN front page? Or just want to throw shade on LLM use in general? This is impressive and cool but I don’t understand the bitterness here.
- andix 8mo agosarcasm. In response of HN being mostly about AI now. I’m very interested in the AI content, but it’s also a bit sad how much it became the main topic.
- villgax 8mo agoThis is why HN exists, almost gives me the same joy as flipping through tech magazines of yester-decades.
- a_t48 8mo agoNice, I’ll have to give this a try on my Analogue Pocket
- spacebacon 8mo agoThis 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.
- wasmainiac 8mo ago> 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 8mo agoThe 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 8mo agoJust… ignore Reddit.
- ekipan 8mo agoIt seems to me that AI is mostly optimized for tricking suits into thinking they don't need people to do actual work. If I hear "you're absolutely right!" one more time my eyes might roll all the way back into my head. Still, even though they suck at specific artifacts or copy, I've had success asking an LLM to poke for holes in my documentation. Things that need concrete examples, knowledge assumptions I didn't realize I was making, that sort of thing. Sweet Gameboy shader!
- VoidWhisperer 8mo agoYou're absolutely right! (sorry, I couldn't resist)
- Sharlin 8mo agoThe "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 8mo agoAah you're right. That was from my vomit draft and forgot to tidy it up. I'll update the post soon
- Sharlin 8mo agoThanks!
- jnpnj 8mo agoAlways loved using old hardware with recent understandings.
- fallat 8mo agoI 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.
- jnpnj 8mo agoWas there anything of that sort made during the gbc era on this hardware ? I thought nobody ever attempted it before
- fallat 8mo agoNot exactly this, but many "3D games" were pre-computed scenes. The normal map is the novel bit of this demo.
- jnpnj 8mo agoOk, and at the time, was anybody even thinking about computing normal maps this way on such hardware ? that was my original though, "maybe" this is the result of applying more recent ideas for this group to hardware that wasn't made to support it. But maybe i'm wrong and people did try.
- iLoveOncall 8mo agoIsn't it a bug that when spinning the object the light also spins?
- araes 8mo agoIt'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.
- giancarlostoro 8mo agoI 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 8mo agoYou 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.
- giancarlostoro 8mo agoI still have my 90s one but would love a modern brand new one, similar to how they did the SNES Mini
- VimEscapeArtist 8mo agoYou can buy the ModRetro Chromatic from the Oculus VR creator. It's better than anything Nintendo could ever produce.
- wileydragonfly 8mo agoDoesn’t he use your money to blow people up or something?
- VanTheBrand 8mo agoNo the US government does that. He just takes the money taxpayers gave the government to blow people up with, and unlike the other defense contractors, also indirectly finances the production of gameboys with some of the money. The idea that giving money to ModRetro finances arms is essentially backwards from how money actually flows.
- 8mo ago
- HeckFeck 8mo agoThis is the coolest thing I've seen in months. Licence it as beerware, then I'm obliged to owe you one.
- Waterluvian 8mo agoI’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.
- otterstack 8mo agoHi, 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/3mecu4zzkfc2n https://bsky.app/profile/dannyspencer.bsky.social/post/3mecu...
- Agentlien 8mo agoThis was so much fun to read! Very neat solutions using spherical coordinates and logarithms. How did you get the actual idea to do this in the first place?
- otterstack 8mo agoThanks! It's fuzzy, but I think it was because I was learning GB assembly while working on shaders in Houdini or something (I'm a tech artist). The two worlds collided in my head, saw that there's no native multiplication on the GB, and figured it'd be a fun problem.
- Agentlien 8mo agoAs someone with a similar background (graphics programmer) it sure seems like a fun problem. I honestly found the lack of multiplication instruction quite surprising. I did not know that!
- unicorn_cowboy 8mo agoThis author is a psycho. In a good way.
- fwystup 8mo agoReally interesting Project, thanks for sharing. Reminded me a bit of my time coding assembly on the C64 (yeah, I'm old). For 3D (wire-frame) we also needed to find creative ways around hardware limitations, especially the lack of a multiply instruction.
- patrick4urcloud 8mo agonice job !
- VimEscapeArtist 8mo agoI bow before the master. Genuinely outstanding work. Since you're already doing what's essentially demoscene-grade hacking, have you thought about putting together a short demo and entering it at a demoparty? There's a list of events at demoparty.net - this kind of thing would absolutely shine there.
- exploraz 8mo agoPreviously: https://news.ycombinator.com/item?id=46913127 https://news.ycombinator.com/item?id=46913127