jmickle66666666 Posted December 20, 2017 Hey, I've been working on some Doom stuff in Unity recently, and tackled the problem of writing a shader to replicate the Doom software renderer, as opposed to just going with that "opengl" look. I wrote up an article on Medium about it! Thought it would be good to share here~ https://medium.com/@jmickle_/writing-a-doom-style-shader-for-unity-63fa13678634 17 Quote Share this post Link to post
drfrag Posted December 21, 2017 (edited) I find this very interesting, this could be a milestone or the beginning of a new era in Doom history. Or may be i'm just imagining things? Well i had a dream many years ago.. I guess you're converting the levels using an automated process. If you manage to port or emulate the AI and all the stuff to make the levels playable (the DOOM source is GPL after all) you'd only need to run the iwads for this to qualify as a Doom engine. You'd need to convert them on the user's computer of course. And then you could have a classic mode emulating the old renderer and another one with modern lightning and stuff. Then people could create advanced real big 3D levels for Doom with better lightning and physics and without the performance limitations of the old inefficient engine. Edited December 21, 2017 by drfrag 1 Quote Share this post Link to post
Danfun64 Posted December 21, 2017 I'm not sure I like the idea. Unity isn't FLOSS software, and it would bite if someone made a mod exclusively for this. 0 Quote Share this post Link to post
jmickle66666666 Posted December 21, 2017 My shader is written for Unity, but Unity uses standard CG and HLSL for their shaders, so my code is portable easily enough to any system. I'm also writing what I can in C# without ties to the Unity engine. Not all is possible (since a lot is implementation, not data reading), but what is portable is portable. All the code is on github here: https://github.com/jmickle66666666/DoomUnity But overall: I'm making this as a hobby project, and I don't care if Unity is FLOSS or not. Every line of code I write for this will be open sourced, and Unity enables me to be doing what I'm doing. I'm not sure what the problem is if someone makes a mod for it. 3 Quote Share this post Link to post
Bauul Posted December 21, 2017 That's very cool! The end result does genuinely look like the vanilla software renderer. Do you have any footage of it in action you'd be willing to share? 0 Quote Share this post Link to post
jmickle66666666 Posted December 22, 2017 I made this video showing off the sounds and menu i was working on today: Doesn't show much of the level though. When I have a bit more done I'll make a proper thread for the engine 0 Quote Share this post Link to post
david_a Posted December 22, 2017 (edited) That’s pretty cool; I’ll keep your battle with the floors/ceilings in mind in case I ever decide to make something that will render Doom levels :) Are you going to implement fake contrast too? Edited December 22, 2017 by david_a 0 Quote Share this post Link to post
jmickle66666666 Posted December 22, 2017 Fake contrast is already implemented, I just didn't cover it in the post because it's calculated outside the shader code. You can see it working on the pillars in the example shots. 0 Quote Share this post Link to post
LexiMax Posted December 26, 2017 That's amazing. That "palette index as red value" trick is something I recognize and have used before, but seems like you took it the rest of the way. Wonder if @Graf Zahl would implement something like this in GZDoom - if he hasn't already. 1 Quote Share this post Link to post
Edward850 Posted December 26, 2017 (edited) 5 minutes ago, AlexMax said: Wonder if @Graf Zahl would implement something like this in GZDoom - if he hasn't already. Randi already did this for ZDoom (it uploads a single channel texture and uses a shader to assign the byte to each palette index on the GPU), GZDoom would already have it by extension (for the software renderer), and I'm unsure if it has it as an 8bit shader effect. Fun fact, so did the original release of Keen Dreams on Steam. That was changed to a 32bit texture constructor when Icculus and I updated it, as SDL2 did a much better job of rendering it directly and the resolution was static 320x200 anyway, which is very cheap to produce. Any benefit from it nowadays would be from much larger resolutions. Edited December 26, 2017 by Edward850 0 Quote Share this post Link to post
jmickle66666666 Posted December 26, 2017 I think alexmax meant implementing it for the hardware renderer, not the software renderer. 0 Quote Share this post Link to post
Edward850 Posted December 26, 2017 I knew that, however the principle is pretty much the same. 0 Quote Share this post Link to post
LexiMax Posted December 26, 2017 (edited) 2 hours ago, Edward850 said: Randi already did this for ZDoom, GZDoom would already have it by extension (for the software renderer), and I'm unsure if it has it as an 8bit shader effect. Unless I am misinterpreting what she's done, it looks like she's replicating the look of the software renderer in a truly 3D OpenGL renderer. The novelty that jmickle appears to bring is doing 3D rendering using a palette, and then using the proper colormap index based on distance, which to my knowledge has not been done before. If all you want is literally the software renderer on an OpenGL context, which is my understanding of what ZDoom used to do, the later steps she is taking are unnecessary (if it's even possible), you just do the red palette index trick from the normal software rendered output and you're done. Edited December 26, 2017 by AlexMax 0 Quote Share this post Link to post
jmickle66666666 Posted December 26, 2017 She* and yeah. My shader is entirely hardware meaning you can look up and down without y-shearing, and also mix and match it with anything else rendering too. It's just a material on a surface. 1 Quote Share this post Link to post
Arctangent Posted December 26, 2017 (edited) I actually really want to see a game use this with fully modeled monsters and weapons, especially if it could emulate the higher-than-1px-resolution effect that comes with weapons on non-320x200 resolutions and enemies when they're close up. It wouldn't be super Doom-y that way, sure, but fluid animations and stuff like full rotations on map objects and view sway on weapons while still keeping the pixel-y look would be just 👌 edit: oh yeah how can i forget, stuff like dynamic lighting affecting things that look like sprites would be a really nice effect too Edited December 26, 2017 by Arctangent 0 Quote Share this post Link to post
kb1 Posted December 28, 2017 On 12/25/2017 at 9:09 PM, jmickle66666666 said: She* and yeah. My shader is entirely hardware meaning you can look up and down without y-shearing, and also mix and match it with anything else rendering too. It's just a material on a surface. Alright, I want to see that skeleton in some real levels - that's badass! 0 Quote Share this post Link to post
dpJudas Posted December 28, 2017 For the contest of "who did this first", Randi's D3D9 2D acceleration indeed does use palette textures, but with a single colormap (no light levels). My "hard poly" renderer, which is a few months old, does the same as this unity shader when its in palette mode. Generally I agree with Edward850 that there's little extra involved in adding the light levels compared to what Randi did. The shader isn't really the biggest problem in porting Doom to Unity, though. It is all the work required to get the sectors moving, supporting line actions, and implementing all the actors. 0 Quote Share this post Link to post
Xaser Posted December 28, 2017 Slight tangent, but since folks are kinda talking about it, having original Doom-style shading (w/palette+colormap) in GZDoom's GL renderer is like the holy grail for The Adventures of Square. Quasi-relevant stuff here. 0 Quote Share this post Link to post
dpJudas Posted December 28, 2017 Not quite the GL renderer, but here's a Direct3D 11 renderer showing Square in palette mode: 0 Quote Share this post Link to post
Arctangent Posted December 28, 2017 I am immediately taken by that jarring misalignment in the left-side cave wall. 0 Quote Share this post Link to post
YoopyDoopyDooper Posted March 30, 2021 (edited) On 12/21/2017 at 1:50 PM, jmickle66666666 said: My shader is written for Unity, but Unity uses standard CG and HLSL for their shaders, so my code is portable easily enough to any system. I'm also writing what I can in C# without ties to the Unity engine. Not all is possible (since a lot is implementation, not data reading), but what is portable is portable. All the code is on github here: https://github.com/jmickle66666666/DoomUnity But overall: I'm making this as a hobby project, and I don't care if Unity is FLOSS or not. Every line of code I write for this will be open sourced, and Unity enables me to be doing what I'm doing. I'm not sure what the problem is if someone makes a mod for it. Hey, i really, really need help. im trying to use your software renderer but for the life of me i cant figure out how you converted the textures. No matter what i do, i cant get it to look anywhere near close to what you got. Edited March 30, 2021 by YoopyDoopyDooper 0 Quote Share this post Link to post
Linuxmaster1992 Posted March 31, 2021 Would this be available for Linux? 0 Quote Share this post Link to post
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.