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

Thought experiment: Dithering in Doom

Recommended Posts

Whoah!
Even though the details are in a lower quality, it still looks badass! 

But then again I wouldn't feel like if a "richer" palette would be needed. Maybe Doom was adjusted to their limits capacities and the developpers couldn't implement too much apart from what they did (just proposing a hypothetical situation, not sure if it's the truth), but that was just fine, if not perfect for the very same purpose of the game.

 

I have the feeling that they didn't limited their imagination to a palette. They maybe made some adjustments to a sprite here and another there... but that's just natural and probably unavoidable, both in their creativity and the (supposed, if there were) limits. 

 

As the atmosphere of the game is a dark/horror/suspense scenario, I'm not sure if they even cared for brighter values for the palette. 

The most magenta/lavender/purple thing I can think of are Cacodemon's projectile's outline (apart from that, the pink in Demon's (Pinky), Baron's and Cacodemon's skin, but that's just softer;and they look kind of brown in the dark). And probably they priorized the palette colors that were the fittest to be reused to make more sprites (they even reused sprites to make new projectiles and monsters).

 

Still, I think it would be interesting to know what could have been Doom with those palette changes. Who knows?

Share this post


Link to post

The problem with this method is that it doesn't really work for sprite scaling. The Doom engine uses nearest-neighbor scaling with no mip-mapping, which means it's always skipping over rows of pixels. Your image looks like it has an ordered dithering pattern, which means you'd see a bunch of moiré patterns (look at the brick walls on MAP12 in vanilla Doom if you want to see what I'm talking about.) It might look better with a non-repeating dither function such as Floyd-Steinberg, but it still wouldn't look perfect.

Theoretically you could render a high-color image and then apply ordered dithering to the whole screen, but in that case you probably wouldn't need to dither the image in the first place.

It's interesting to think what they could've done with a more expansive palette, but in that case they probably would've used flat shading instead.

Share this post


Link to post
Posted (edited)

I love dithering, but while it always looks perfect in a 2D game, where the distance of the sprite is usually the same, in a "3D"-game like Doom the dithering will look ugly, as soon as something is a certain distance away. Granted, with today's resolutions that would be less of a problem, but still, while I love to dither here and there, I think a heavy approach like your Doomguy would look a bit funny ingame.

 

Then you have the whole "realism" vs. "pixelart" debate, where for some people the textures and such just look more "realistic" with a not-ordered approach to dithering.

Share this post


Link to post

While the palette could definitely have been done better (plenty of folks have tried that), 256 colors was your state of the art no matter what back then (unless you had weirdo cards), and it was just a few years too shy of 16-bit color (which even then is still only 65k colors).

 

That said, many of the problems with the palette is that the designers decided on a palette more optimized for their world, and less for representing every possible color. That means more browns and reds, some greens, and relatively little stuff like yellows, purples, blues, etc.

 

In short, the palette they made, while perhaps not optimal, wasn't chosen totally at random either - it was a conscious decision.

Share this post


Link to post

Doom doesn't use any dithering at all so I don't even know how to consider a world in which it used dithering. It would be... different? I guess?

Share this post


Link to post
20 minutes ago, Linguica said:

Doom doesn't use any dithering at all so I don't even know how to consider a world in which it used dithering. It would be... different? I guess?

32X Doom might be the closest analog, and even there I'm not sure if dithering was used.

Share this post


Link to post
Posted (edited)
1 hour ago, Linguica said:

Doom doesn't use any dithering at all so I don't even know how to consider a world in which it used dithering. It would be... different? I guess?

Seems like id lost interest in dithering as a technique after Wolfenstein. As @komojo mentioned, scaling would make it look weird. You can see how unpleasant it looks in Wolfenstein, particularly with the doors. So this would probably only look good at higher resolutions. I want to say that the PSX versions used something...not dithering, but some kind of weird grainy filter. 

 

Share this post


Link to post
Posted (edited)
1 hour ago, Dark Pulse said:

In short, the palette they made, while perhaps not optimal, wasn't chosen totally at random either - it was a conscious decision.

I don't think anyone is arguing that it was random. What I'm saying is that there's just way too many shades of a few of the hues, and likely this had to do with making those colors band well, since they were used so much. You end up sacrificing other hues as a result, or flat out ignoring certain parts of the spectrum due to a lack of room. I think id did a decent job, as the vanilla game looks fine, even in dark areas. But a dithered approach might have encouraged a palette with more overall range, but then that would have required id to be prescient enough to anticipate a longstanding modding community.

Share this post


Link to post
Posted (edited)
4 minutes ago, GoatLord said:

I don't think anyone is arguing that it was random. What I'm saying is that there's just way too many shades of a few of the hues, and likely this had to do with making those colors band well, since they were used so much. You end up sacrificing other hues as a result, or flat out ignoring certain parts of the spectrum due to a lack of room. I think id did a decent job, as the vanilla game looks fine, even in dark areas. But a dithered approach might have encouraged a palette with more overall range, but then that would have required id to be prescient enough to anticipate a longstanding modding community.

Basically. And in reality, this is only a limitation if we choose to make it one. I mean, we've got hardware-accelerated renderers and can easily do true-color graphics in lots of engines - but it requires us to leave vanilla compatibility behind as a (mostly) necessary consequence.

 

We can't have being perfectly compatible along with lots of flexibility. Too many eggs get broken in the process.

Share this post


Link to post

When done properly, dithering can look fantastic, but it's also easy to screw it up. KBDoom has an option that renders translucent explosions with a form of dithering, providing a very fast form of software translucency. It switches to dithered mode when the distance to the player becomes very small.

 

Dithering in screen space (at high resolutions) can produce some very nice results. But it can also be expensive, performance-wise if not done very carefully. But dithering in texture space will make textures even more chunky.

Share this post


Link to post
Posted (edited)
29 minutes ago, DoctorFrickinRetro said:

I have no idea what any of this means but I like what I am seeing

To put it in layman terms, dithering is a process that was popular in the days before large scale palettes (that is, palettes with millions or billions of colors) were a thing. Up until the mid 90s, most games had to be very conservative about color usage, with 16-, 64-, and 256-color palettes being particularly popular. If you look at the dithered version of the OP image, you can see that some of the colors are expressed as a checkerboard pattern of a lighter and darker color. At a distance, this creates the illusion of greater color depth. The Wikipedia entry for pixel art, pictured below, is a better example of how this checkerboard pattern can be used effectively.

 

 

sprite2.png

Share this post


Link to post

I tried some post process dithering in my 16 color game. When I finally got it working about right, it was kind ok, but was irritating when moving around. More irritating if using the 320 resolution.

Share this post


Link to post
Posted (edited)

Maybe dithering could be used on the diminished lighting to good effect. I don't know how expensive dithering in real time is or how you would work it into the software renderer but I assume it wouldn't have worked out on the 486.

Edited by GuyMcBrofist

Share this post


Link to post
Posted (edited)
3 hours ago, GoatLord said:

To put it in layman terms, dithering is a process that was popular in the days before large scale palettes (that is, palettes with millions or billions of colors) were a thing. Up until the mid 90s, most games had to be very conservative about color usage, with 16-, 64-, and 256-color palettes being particularly popular. If you look at the dithered version of the OP image, you can see that some of the colors are expressed as a checkerboard pattern of a lighter and darker color. At a distance, this creates the illusion of greater color depth. The Wikipedia entry for pixel art, pictured below, is a better example of how this checkerboard pattern can be used effectively.

 

 

sprite2.png

Nice explanation. Also, I like that sprite - with some scarier teeth, and some rotations, that'd make a cool Doom monster :)

 

2 hours ago, TwinBeast said:

I tried some post process dithering in my 16 color game. When I finally got it working about right, it was kind ok, but was irritating when moving around. More irritating if using the 320 resolution.

Oh, wow, yeah at 320x200, I guess your eyes focus on the checkerboard, and see that pattern predominately, huh? Does your game let the player set the video resolution? If you can get really small pixels onscreen, dithering kinda disappears, and your eyes simply perceive more colors. With Goatlord's image, the checkerboard pattern is pretty noticeable, but in the quoted image above, it just looks hi-color.

 

What kind of game did you make?

 

8 minutes ago, GuyMcBrofist said:

Maybe dithering could be used on the diminished lighting to good effect. I don't know how expensive dithering in real time is but I assume it wouldn't have worked out on the 486.

It really depends on the implementation. You *could* dither the textures. You could expand each texture, say, 4x normal size, and instead of using 256 colors, you use less, and interleave them. And, you'd have to scale them down when rendering. What's cool about that is that you retain the pixelated look, and even have a higher-res effect on the textures in close-ups! One issue with this technique is the aliasing that happens when you're further away from the textures. But, other than the memory requirements, this technique should run at about normal speed.

 

Screen space dithering can look better, but that's where you might run into performance problems, unless you've very clever. You don't have to use a checkerboard pattern either - there's some more advanced dithering techniques that use non-checkerboard patterns, but they require knowledge of adjacent pixels, which can be very slow.

 

It's definitely worth investigating. Imagine requiring only, say, 64 colors - you'd have 192 colors free to add rich blues and greens, purples, cyan, different yellows, etc. But, personally, I don't think I'd be satisfied with any dithering output less than 1920x1080 - I'm too spoiled with crisp, solid-colored pixels!

 

Here's an example of "fake" 50% translucency that uses a technique very similar to checkerboard dithering at 1920x1080. To see the effect proper, you must download the image and view it unscaled, otherwise the effect fails spectacularly! I think it's quite decent at this resolution, as you can hardly see the checkerboard at such a high resolution, and it really speeds up software translucency.

 

Honest opinion: How does it look?

DOOM0014.PNG.0458d1d29f78186316b5f9eb07e75d4c.PNG

Edited by kb1

Share this post


Link to post
3 hours ago, kb1 said:

Honest opinion: How does it look?

 

it looks interesting, similiar to the film-grain effect. I doubt that you can spot checkers in the action, if not told beforehand.

Share this post


Link to post

oh, the good old trick of simulating translucency with omited pixels. Q2 used that to simulate water translucency in software mode, afair.

Share this post


Link to post

Glass in Virtua Cop also. t gives it comicbooky look.

 

virtua-cop_26.png

 

But I remember the closeup of some protective goggles looking terrible.

Share this post


Link to post
4 hours ago, kb1 said:

Oh, wow, yeah at 320x200, I guess your eyes focus on the checkerboard, and see that pattern predominately, huh? Does your game let the player set the video resolution? If you can get really small pixels onscreen, dithering kinda disappears, and your eyes simply perceive more colors. With Goatlord's image, the checkerboard pattern is pretty noticeable, but in the quoted image above, it just looks hi-color.

 

What kind of game did you make?

 

Honest opinion: How does it look?

It looked a bit better in 640 res, but still a too disturbing. I think dithering works better for 2D games or isometric games, or with very high res, but then might just as well use more colors. It's CyberShade, but it's on hold until I figure out more time for game development. Also tried that stipple alpha, blending more light levels and colors. Also tried if the dithering was just like alternating lines, but that was also a little weird.

Share this post


Link to post
Posted (edited)
23 minutes ago, ketmar said:

oh, the good old trick of simulating translucency with omited pixels. Q2 used that to simulate water translucency in software mode, afair.

 

No, Q2 used a transparency look up table in software: Fabien Sanglard

Share this post


Link to post

i think that there was a renderer that did "pixel-punching" too. or a setting. i certainly remember this effect on Q2 water. it may be some custom rendering dll, though. or my memory is playing tricks on me. ;-)

Share this post


Link to post
Posted (edited)

I think scanlines might've been better than dithering. It looks really weird to have dithered sprites while the textures are all clean. Although I don't think either are needed in the software renderer. It already uses tricks nonstop and those look good (aside from pink color getting shafted).

Share this post


Link to post

Yeah, I don't necessarily think dithering would have been better so much as just different. I myself love the technique and use it in most all of my pixel art, although I use a scan line effect as well, usually for skies.

 

On a related note, the Virtua Cop image is interesting because that form of dithering was not used because of palette limitations, but because transparency was difficult to pull off until the latter half of the 90s. 

Share this post


Link to post

If dithering is to be used then it's best at the renderer level, not the sprite level.

 

By the way, there is one port of Doom that uses dithering:

 

 

Share this post


Link to post

The reasons why this wouldn't work well have already been discussed, so I'll just say this:

Doom's palette can be vastly improved and optimized without doing anything nearly this destructive to the graphics. I've done some experiments in the past to see how much can be squeezed out of the palette without causing noticeable problems that offset the gains, and it's a lot more than you'd expect. No one needs a bunch of nearly-indistinguishable shades between white and bright yellow, for instance. You can definitely add the additional color ranges you're talking about.

Share this post


Link to post
4 hours ago, ketmar said:

i think that there was a renderer that did "pixel-punching" too. or a setting. i certainly remember this effect on Q2 water. it may be some custom rendering dll, though. or my memory is playing tricks on me. ;-)

you aren't entirely confused here, the software renderer had a "stipple alpha" option which removed the table lookup transparency and used a pattern of clear pixels to fake it.

 

this thread makes me wonder a little though how the unreal dithering algorithm would look in software doom... heh.

Share this post


Link to post

If you want to try dithering in software Doom, use PrBoom in 8 bit mode and set filtering to "linear".

 

Screen Shot 2019-04-30 at 10.26.01 AM.crushed.png

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
×