Doom

Published May 23, 2007
Advertisement
Incase you couldn't figure it out by the journal description, I'm once again working on Doom.Net. This is an entirely new version, this time aimed at recreating the look and feel of the original Doom 1 and 2. My previous attempts partially failed due to feature creep by trying to be everything at once(heretic,hexen,zdoom,jdoom,boom,etc..). I've never really cared for anything the newer source ports added, especially new monsters and scripting which IMO destroys the "Doom" feel of the game. Also I'll be using shaders to try to emulate the software rendering look while still being able to use hardware acceleration.

So far all I've got is a map loader and emulating the 256 color palette using pixel shaders. The textures are in A8L8 format to save space, plus I need the alpha channel since Doom uses all 256 colors, the palette index is stored in the L byte.

No shader:


With shader:


This is the shader I'm using for now:

float LightLevel = 1.0f;float4x4 WorldViewProj	: WORLDVIEWPROJ;Texture ColorTexture;sampler ColorTextureSampler = sampler_state { texture =  ; magfilter = NONE; minfilter = NONE; mipfilter = NONE; AddressU = wrap; AddressV = wrap; };Texture PaletteTexture;sampler PaletteTextureSampler = sampler_state { texture =  ; magfilter = NONE; minfilter = NONE; mipfilter = NONE; AddressU = wrap; AddressV = wrap; };struct a2v{	float4 Position   	: POSITION0;	float2 TexCoords  	: TEXCOORD0;};struct v2p{	float4 Position		: POSITION0;	float2 TexCoords   	: TEXCOORD0;};struct p2f{    float4 Color 		: COLOR0;};void vs( in a2v IN, out v2p OUT ){	OUT.Position = mul( IN.Position, WorldViewProj );	OUT.TexCoords = IN.TexCoords;}void ps( in v2p IN, out p2f OUT ){	float4 TextureColor = tex2D( ColorTextureSampler, IN.TexCoords );	OUT.Color = tex1D( PaletteTextureSampler, TextureColor.r );	OUT.Color *= LightLevel;	OUT.Color.a = TextureColor.a;}technique PaletteTechnique{    pass p0    {        vertexshader = compile vs_1_1 vs();	pixelshader = compile ps_1_4 ps();    }}


One "problem" is that I never actually set ColorTexture and yet it seems to work. I'm just using Device.SetTexture. Can anyone explain this? My guess is it's undefined behaviour and I'm lucky it doesn't crash and explode.
Previous Entry Software rendering part 2
Next Entry The Color Map
0 likes 2 comments

Comments

Ravuya
Nice idea with the palette lookup shader. You could do some pretty insane stuff in there.
May 23, 2007 10:05 AM
Scet
That's the plan. I'm going to extended the palette texture from 256x1 to 256x64 and include the color lookup table(COLORMAP) inside and adjust the Tv coordinate depending on the distance and lightlevel of the vertices.

I'm also going to add the Tw coordinate so I can use my volume texture atlas code for the sprites. Walls and floors won't work for it since they need wrapping, but it should really help speed up sprite and font rendering.
May 23, 2007 10:50 AM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement
Advertisement