Skip to content

Commit

Permalink
Beta ready version.
Browse files Browse the repository at this point in the history
* Pixelizer shader finalized.
* Updated the menu items.
* Bugfixes for Delta Touch.
  • Loading branch information
rodylg committed Jul 13, 2020
1 parent 2d58d67 commit 732ee3e
Show file tree
Hide file tree
Showing 6 changed files with 98 additions and 12 deletions.
4 changes: 2 additions & 2 deletions GLDEFS
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Pixelize & Dither
HardwareShader postprocess scene
HardwareShader postprocess beforebloom
{
Name "Pixelize_Scene"
Shader "shaders/glsl/pixelize.fp" 330
Expand All @@ -15,7 +15,7 @@ HardwareShader postprocess screen
Uniform int targetwt
Uniform int targetht
}
HardwareShader postprocess scene
HardwareShader postprocess beforebloom
{
Name "Dither_Scene"
Shader "shaders/glsl/dither.fp" 330
Expand Down
68 changes: 67 additions & 1 deletion MENUDEF
Original file line number Diff line number Diff line change
Expand Up @@ -183,12 +183,36 @@ OptionMenu "DemakeShadersOptionsMenu"
{
Title "Demake Shaders Options"
StaticText " "
StaticText "Resolution", "Gold"
StaticText "Pixelize", "Gold"
StaticText " "
Option "Pixelize Mode", "gl_demakeshaders_pixmode", "DemakeShadersPixmode"
Option "Pixel Doubling", "gl_demakeshaders_lowdetail", "DemakeShadersLowdetail"
TextField "Target Width", "gl_demakeshaders_targetwt"
TextField "Target Height", "gl_demakeshaders_targetht"
SubMenu "Resolution Presets", DemakeShadersResolutionMenu
StaticText " "
StaticText "$VIDMNU_CUSTOMRES"
Option "$VIDMNU_FORCEASPECT", "vid_aspect", "ForceRatios"
Option "$VIDMNU_CROPASPECT", "vid_cropaspect", "CropAspect"
Option "$VIDMNU_SCALEMODE", "vid_scalemode", "ScaleModes"
Slider "$VIDMNU_SCALEFACTOR", "vid_scalefactor", 0.25, 2.0, 0.25, 2
TextField "$VIDMNU_CUSTOMX", menu_resolution_custom_width
TextField "$VIDMNU_CUSTOMY", menu_resolution_custom_height
Option "$VIDMNU_USELINEAR", "vid_scale_linear", "YesNo"
StaticText " "
Command "$VIDMNU_APPLYW", "menu_resolution_commit_changes 0"
Command "$VIDMNU_APPLYFS", "menu_resolution_commit_changes 1"
StaticText " "
StaticText "Appearance ", "Gold"
StaticText " "
Submenu "$DSPLYMNU_GLOPT", "OpenGLOptions"
Submenu "$GLMNU_TEXOPT", "GLTextureGLOptions"
Submenu "$GLMNU_DYNLIGHT", "GLLightOptions"
Slider "$DSPLYMNU_SCREENSIZE", "screenblocks", 3.0, 12.0, 1.0, 0
Option "$ALTHUDMNU_ENABLE", "hud_althud", "OnOff"
Option "$MOUSEMNU_ALWAYSMOUSELOOK", "freelook", "OnOff"
Option "$HUDMNU_CROSSHAIRON", "crosshairon", "OnOff"
Option "$HUDMNU_CROSSHAIR", "crosshair", "Crosshairs"
StaticText " "
StaticText "Dither", "Gold"
StaticText " "
Expand All @@ -205,4 +229,46 @@ OptionMenu "DemakeShadersOptionsMenu"
Option "Max Frame Rate", "vid_maxfps", "DemakeShadersFrameRate"
Option "35 fps cap", "cl_capfps", "OnOff"
Option "Vertical sync", "vid_vsync", "OnOff"
}

OptionMenu "DemakeShadersResolutionMenu"
{
Title "Pixelize Resolution Presets"
StaticText " "
Command "(Atari Lynx) 160x102", "event demakeshaders_targetres 160 102 0"
Command "(Game Gear|Game Boy Color|Game Boy) 160x144", "event demakeshaders_targetres 160 144 0"
Command "(Neo Geo Pocket Color) 160x152", "event demakeshaders_targetres 160 152 0"
Command "(Apple II LoRes) 140x192", "event demakeshaders_targetres 140 192 3"
Command "(Atari 2600) 160x192", "event demakeshaders_targetres 160 192 3"
Command "(VIC-II|IBM PCjr|Amstrad CPC) 160x200", "event demakeshaders_targetres 160 200 3"
Command "(WonderSwan) 224x144", "event demakeshaders_targetres 224 144 0"
Command "(SNES DOOM) 216x176", "event demakeshaders_targetres 216 176 3"
Command "(Game Boy Advance) 240x160", "event demakeshaders_targetres 240 160 0"
Command "(Acorn BBC) 160x256", "event demakeshaders_targetres 160 256 3"
Command "(Nintendo DS|ZX Spectrum|MSX|Master System) 256x192", "event demakeshaders_targetres 256 192 3"
Command "(Apple II HiRes) 280x192", "event demakeshaders_targetres 280 192 3"
Command "(MSX2) 256x212", "event demakeshaders_targetres 256 212 3"
Command "(PC/TurboGrafx-16|Master System|SNES|NES) 256x224 [Overscan]", "event demakeshaders_targetres 256 224 3"
Command "(Master System|SNES|NES) 256x240", "event demakeshaders_targetres 256 240 3"
Command "(Atari 5200/400/800) 320x192", "event demakeshaders_targetres 320 192 0"
Command "(CGA) 320x200", "event demakeshaders_targetres 320 200 3"
Command "(Neo Geo AES/CD|Saturn|32X|Genesis) 320x224", "event demakeshaders_targetres 320 224 3"
Command "320x240", "event demakeshaders_targetres 320 240 3"
Command "(Amiga OCS PAL LoRes) 320x256", "event demakeshaders_targetres 320 256 4"
Command "(Jaguar Doom) 350x240", "event demakeshaders_targetres 350 240 3"
Command "(Virtual Boy) 384x224", "event demakeshaders_targetres 384 224 0"
Command "(MSX2) 512x212", "event demakeshaders_targetres 512 212 3"
Command "(Teletext PAL non-interlaced) 480x250", "event demakeshaders_targetres 480 250 3"
Command "(Amiga OCS NTSC LoRes) 320x400", "event demakeshaders_targetres 320 400 3"
Command "(CGA) 640x200", "event demakeshaders_targetres 640 200 3"
Command "(PSP|Neo Geo X) 480x272", "event demakeshaders_targetres 480 272 1"
Command "(Amiga OCS PAL HiRes) 640x256", "event demakeshaders_targetres 640 256 3"
Command "(3DS) 800x240", "event demakeshaders_targetres 800 240 0"
Command "(Macintosh) 512x384", "event demakeshaders_targetres 512 384 3"
Command "(EGA) 640x350", "event demakeshaders_targetres 640 350 3"
Command "(Teletext PAL interlaced) 480x500", "event demakeshaders_targetres 480 500 3"
Command "(MDA) 720x350", "event demakeshaders_targetres 720 350 3"
Command "(Amiga OCS NTSC Hires) 640x400", "event demakeshaders_targetres 640 400 3"
Command "640x480", "event demakeshaders_targetres 640 480 3"
Command "(PS Vita) 960x544", "event demakeshaders_targetres 960 544 1"
}
15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,28 @@
GLSL shaders for GZDoom 3.5.0+ that simulate various vintage systems.

## Project's Scope
Doom has been ported to countless devices, most of which have enough processing ability to run the game natively. But that wasn't always the case, and many older computers and video game consoles by 1993 simply were just not powerful enough to run this almighty game. While this situation hasn't changed at all for those aging systems, it's now possible to use modern source code ports and hardware to simulate what the game might have looked like on systems with less than the minimum requirements (80386DX@33MHz CPU, 4MB DRAM, 20MB HDD & VGA Graphics). There is certainly some charm and interest around the retro-computing look; low resolutions and constrained color palettes are an aesthetic that keeps on giving nostalgic thrills. This mod is for those who want some chunky pixely goodness.
Doom has been ported to countless devices, most of which have enough processing ability to run the game natively. But that wasn't always the case, and many older computers and video game consoles by 1993 simply were just not powerful enough to run this almighty game. While this situation hasn't changed at all for those ageing systems, it's now possible to use modern source code ports and hardware to simulate what the game might have looked like on systems with less than the minimum requirements (80386DX@33MHz CPU, 4MB DRAM, 20MB HDD & VGA Graphics). There is certainly some charm and interest around the retro-computing look; low resolutions and constrained colour palettes are an aesthetic that keeps on giving nostalgic thrills. This mod is for those who want some chunky pixely goodness.

## Roadmap of Features
- [x] **Refresh Rate Limiter:** Control the max frame rate of the engine.
- [x] **Palette Reduction w/ Ordered Dither:** Part of the [MariFX](https://github.com/OrdinaryMagician/marifx_m) Shaders for GZDoom, modified to accept more than 64 palettes and optimized to reduce it's video memory footprint.
- [x] **Multiple retro-systems palettes and color modes:** Videogame home consoles and portable systems, Vintage graphic systems, Monochrome, Grayscale and various RGB levels/bit-depths.
- [x] **Palette Reduction w/ Ordered Dither:** Part of the [MariFX](https://github.com/OrdinaryMagician/marifx_m) Shaders for GZDoom, modified to accept more than 64 palettes and optimized to reduce its video memory footprint.
- [x] **Multiple retro-systems palettes and colour modes:** Videogame home consoles and portable systems, Vintage graphic systems, Monochrome, Grayscale and various RGB levels/bit-depths.
- [x] **Resolution scaler w/ Non-squared Pixel Aspect Ratios**
- [x] **"Low-Detail" mode (double-width pixels)**
- [ ] **Customisable Scanlines**
- [ ] **Customizable Scanlines**
- [ ] **CRT and LCD simulation**
- [ ] **NTSC TV-output Color grading**

## Version History
**0.2.1-beta (2020-07-13)**
* Pixelizer shader finalized.
* Updated the menu items.
* Bugfixes for Delta Touch.

**0.2.0-alpha (2020-07-11)**
* The Pixelizer update. Its shader is WIP.
* Implemented a modified Rachael's "low detail" shader.
* Moved the dithering shader to it's own pass on the pipeline.
* Moved the dithering shader to its own pass on the pipeline.
* Added a CLUT atlas method. It can be faster on certain video cards but increases memory usage.
* Added Sega Jaguar's CRY palette and Nintendo's Virtual Boy palette.

Expand Down
12 changes: 11 additions & 1 deletion ZSCRIPT.zsc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ version "3.3"

Class DemakeShadersHandler : StaticEventHandler
{
transient ui CVar gl_demakeshaders_pixmode,
transient ui CVar vid_aspect,
gl_demakeshaders_pixmode,
gl_demakeshaders_lowdetail,
gl_demakeshaders_targetwt,
gl_demakeshaders_targetht,
Expand Down Expand Up @@ -1055,5 +1056,14 @@ Class DemakeShadersHandler : StaticEventHandler
break;
}
}
if ( e.Name ~== "demakeshaders_targetres" )
{
if ( !gl_demakeshaders_targetwt ) gl_demakeshaders_targetwt = CVar.FindCVar('gl_demakeshaders_targetwt');
if ( !gl_demakeshaders_targetht ) gl_demakeshaders_targetht = CVar.FindCVar('gl_demakeshaders_targetht');
if ( !vid_aspect ) vid_aspect = CVar.FindCVar('vid_aspect');
gl_demakeshaders_targetwt.SetInt( e.args[0] );
gl_demakeshaders_targetht.SetInt( e.args[1] );
vid_aspect.SetInt( e.args[2] );
}
}
}
9 changes: 7 additions & 2 deletions shaders/glsl/CRYspace.fp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,12 @@
precision mediump float;
#endif
#define COMPAT_PRECISION mediump
#define GET_C C = vec3(A.r*249.0/255.0,A.g*249.0/255.0,A.b*249.0/255.0)
#define GET_B ivec3(A.r*63.0+0.5,A.g*63.0+0.5,A.b*63.0+0.5)
#else
#define COMPAT_PRECISION
#define GET_C C = vec3( A.rgb * 249. / 255 )
#define GET_B ivec3( A.rgb * 63 + .5 )
#endif

void main()
Expand All @@ -31,13 +35,14 @@ void main()
vec4 A = texture( InputTexture, TexCoord );
A.rgb = clamp( A.rgb, vec3( 0. ), vec3( 1. ));

if( crymode == 2 && A.r == A.g && A.b == A.r ) C = A.rgb * 249. / 255 ;
if( crymode == 2 && A.r == A.g && A.b == A.r )
GET_C; //see lines 24|28
else
{
float Aval = max( max( A.r, A.g ), A.b );
A.rgb /= Aval ;

ivec3 B = ivec3( A.rgb * 63 + .5 );
ivec3 B = GET_B; //see lines 25|29
int index = (( B.r << 6 ) + B.g << 6 ) + B.b ;
int tx = index & 511 ;
int ty = index >> 9 ;
Expand Down
2 changes: 1 addition & 1 deletion shaders/glsl/dither.fp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ void main()
//#undef d //Deprecated by precalculating
vec2 coord = TexCoord;
vec2 targtres = vec2(targetwt/(1+lowdetail),targetht);
vec2 sfact = textureSize(InputTexture,0);
vec2 sfact = vec2(textureSize(InputTexture,0));
if ( pixmode != 0 )
{
if ( lowdetail == 0 )
Expand Down

0 comments on commit 732ee3e

Please sign in to comment.