Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Doom in two triangles and a fragment shader, Mind Blowing!

Recommended Posts

Ok, I felt like I had to post this here. It's not related with the main code of doom, but it's some tribute some guy did on a mindblowing coderporn site. You got be a shader programmer to maybe appreciate what these guys do at shadertoy and glsl sandbox sites, and I thought I should have the links, it's only recently I saw a recreation of Doom E1M1 fully proceduraly generated on a shader, but some time ago I had seen Doom 2, but the new one has even more love.

It needs WebGL, might not work in some browsers (I run it in chrome, but many people said it fails in FF or IE)

GLSL Sandbox version
Shadertoy version

Also Doom 2
Also wolfenstein

Let's explain this. Normally, fragment shaders have to be applied over a polygonal surface. And it's usually much less intensive that those examples in the site. But this site is an exception. It draws for you just a Quad (or two big triangles) fitting exactly the frame of the screen. It also gives you few variables like timer, mouse and feedback from previous frame, and then supplies you with an editor where you can write any fragment shader which applies on this quad surface. Then you somehow have to create 2d or 3d effects, even though there is no real geometry. Usually it's raytracing techniques on surface defined inside the code. And even the textures are not bitmaps, but fully procedural algorithms. So a ray hits the floor in that doom shader, calls another function that procedurally generates the pixel color from hexagonical algorithm in real time. Of course this is the less optimal way to do things, but these shaders are just like a coders playground trying to show what is possible and how far the GPUs have come (a little longer code and it would exceed the maximum shader program size in the card), how powerful they can be to render this in unconventional ways.

Some of the theory is explained here.

Anyway, if this doesn't fit doom general (I thought it would, in a way), maybe we could move it to general?

p.s.1 Anyway, it needs more background to explain, I just wanted to mention this for coder who are into shader programming. This is a great tribute to doom.
p.s.2 comment some defines (and click the run in shadertoy to recompile, but sandbox is automatic with every change), like the pixelized_screen and texture, for highres. This just wants to mimic original doom of the past.
p.s.3 also shader takes long time to reload and recompile, especially if you make changes in the glsl sandbox version.

Share this post

Link to post

Hmm....for some reason I'm not particularly impressed. This is basically a geometrical polygon-by-polygon, texture-by-texture recreation of the levels of various games, as a GL scene. Given a 3D model (or 2D map) and the software they used to convert it to explicit code (I hope they didn't type-in everything by hand!), you could make such a "shader" out of nearly anything.

It would be way more impressive if part of Doom's source code was actually running as an actual shader. Now that shit would be the motherfucking ass.

Share this post

Link to post

It's true in a sense. It's mind blowing at first but when you learn how they do it, it might loose some of it's magic. I've used this site to test few shaders, but nothing extraordinary like these, I don't have the patience. Sometimes I feel like these guys have too much time/patience. It's similar to minecraft, building those enormous structures, I know it's possible I just would never have the patience to do it. I am still amazed by these stuff though, and some of these shaders (some others on the site) are really beautiful on their own to watch and think they are fully procedural, if you have some GeForce Titan to run them fullscreen in good frame rate.

Also, the maximum program size is already near the end in some of these, few more code and the compiling fails. So, maybe someone writes the doom source code in a far future GeForce 666 one day :)

Share this post

Link to post

Seeing this type of stuff makes me wish I could code.

Share this post

Link to post

Hmm...this actually becomes more interesting after one realizes that the textures and objects look almost like they do in Doom: there are no textures or sprites in the traditional sense, just "descriptors" that generate wall columns and floor textures procedurally. They do look close enough to the originals though, unless you look close enough.

The geometry of the recreated levels is partially explicit, partially the result of procedural construction (e.g. copying similar columns in E1M1, replicating and scaling the steps in MAP01 etc.)

Share this post

Link to post

My first thought: I need this screen-saver! Followed by: Does this do custom or PWADs?

Would be awesome to have it read from a folder of various WADs and throw one up on screen every time your screen-saver triggers. But maybe I'm thinking too small.

Share this post

Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now