mirror of
https://github.com/id-Software/DOOM-3-BFG.git
synced 2025-03-13 22:22:05 +00:00
Deleted NES shader
This commit is contained in:
parent
2ae6a7fe86
commit
482317fc01
14 changed files with 14 additions and 416 deletions
|
@ -633,7 +633,7 @@ r_useSSAO [0 .. 1] | Use Screen Space Ambient Occlusion to d
|
|||
r_forceAmbient | Default 0.5, controls additional brightness by Global Illumination
|
||||
r_useFilmicPostFX [0, 1] | Apply several post process effects to mimic a filmic look
|
||||
r_useCRTPostFX [0 .. 2] | CRT monitor/TV filter
|
||||
r_renderMode [0 .. 7] | Default 0 = Doom, 1 = CGA, 2 = CGA Highres, 3 = Commodore 64, 4 = Commodore 64 Highres, 5 = Amstrad CPC 6128, 6 = Amstrad CPC 6128 Highres, 7 = NES, 8 = NES Highres, 9 = Sega Genesis, 10 = Sega Genesis Highres, 11 = Sony PSX
|
||||
r_renderMode [0 .. 9] | Default 0 = Doom, 1 = CGA, 2 = CGA Highres, 3 = Commodore 64, 4 = Commodore 64 Highres, 5 = Amstrad CPC 6128, 6 = Amstrad CPC 6128 Highres, 7 = Sega Genesis, 8 = Sega Genesis Highres, 9 = Sony PSX
|
||||
|
||||
## Modding Support
|
||||
Name | Description
|
||||
|
|
|
@ -124,7 +124,7 @@ Immerse yourself in the authentic Commodore 64 mode, faithfully replicating the
|
|||
|
||||
The retro rendering modes transport you back to the golden age of gaming, with a resolution that mimics the beloved 320x240 display, now extended to a widescreen 480x270 format. To enhance the arcade feel, two new CRT filters are included that overlay the entire game, including Doom 1 & 2.
|
||||
|
||||
To access these retro rendering modes, simply navigate to the menu options and select your desired mode. Alternatively, you can control the rendering mode by modifying the `r_renderMode` variable. The available values for `r_renderMode` are as follows: Default (0) for Doom 3, 2-bit CGA (1), 2-bit CGA Highres(2), Commodore 64 (3), Commodore 64 Highres (4), Amstrad CPC (5), Amstrad CPC Highres (6), NES (7), NES Highres (8), Sega Genesis (9), Sega Genesis Highres (10) and Sony PSX (11).
|
||||
To access these retro rendering modes, simply navigate to the menu options and select your desired mode. Alternatively, you can control the rendering mode by modifying the `r_renderMode` variable. The available values for `r_renderMode` are as follows: Default (0) for Doom 3, 2-bit CGA (1), 2-bit CGA Highres(2), Commodore 64 (3), Commodore 64 Highres (4), Amstrad CPC (5), Amstrad CPC Highres (6), Sega Genesis (7), Sega Genesis Highres (8) and Sony PSX (9).
|
||||
|
||||
<img src="https://i.imgur.com/W8umJ3a.png" width="800">
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ bind "F4" "toggle r_skipInteractions"
|
|||
bind "F5" "savegame quick"
|
||||
bind "F6" "toggle r_showLightGrid 1 3 4 0"
|
||||
//bind "F6" "toggle r_renderMode 0 1 3 5 7 9 11"
|
||||
bind "F7" "toggle r_renderMode 0 1 2 3 4 5 6 7 8 9 10 11"
|
||||
bind "F7" "toggle r_renderMode 0 1 2 3 4 5 6 7 8 9"
|
||||
bind "F8" "toggle r_useCRTPostFX 0 1 2 3"
|
||||
bind "F9" "loadgame quick"
|
||||
// bind "F10" "toggle com_fixedTic"
|
||||
|
|
|
@ -614,8 +614,8 @@ void idMenuScreen_Shell_SystemOptions::idMenuDataSource_SystemSettings::AdjustFi
|
|||
// RB begin
|
||||
case SYSTEM_FIELD_RENDERMODE:
|
||||
{
|
||||
static const int numValues = 12;
|
||||
static const int values[numValues] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 };
|
||||
static const int numValues = 10;
|
||||
static const int values[numValues] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
|
||||
r_renderMode.SetInteger( AdjustOption( r_renderMode.GetInteger(), values, numValues, adjustAmount ) );
|
||||
break;
|
||||
}
|
||||
|
@ -795,7 +795,7 @@ idSWFScriptVar idMenuScreen_Shell_SystemOptions::idMenuDataSource_SystemSettings
|
|||
}
|
||||
case SYSTEM_FIELD_RENDERMODE:
|
||||
{
|
||||
static const int numValues = 12;
|
||||
static const int numValues = 10;
|
||||
static const char* values[numValues] =
|
||||
{
|
||||
"Doom 3",
|
||||
|
@ -805,8 +805,6 @@ idSWFScriptVar idMenuScreen_Shell_SystemOptions::idMenuDataSource_SystemSettings
|
|||
"Commodore 64 Hi",
|
||||
"Amstrad CPC 6128",
|
||||
"Amstrad CPC 6128 Hi",
|
||||
"NES",
|
||||
"NES Hi",
|
||||
"Sega Genesis",
|
||||
"Sega Genesis Highres",
|
||||
"Sony PSX",
|
||||
|
|
|
@ -444,7 +444,7 @@ float idConsoleLocal::DrawFPS( float y )
|
|||
aaMode = aaValues[ r_antiAliasing.GetInteger() ];
|
||||
}
|
||||
|
||||
static const int rrNumValues = 12;
|
||||
static const int rrNumValues = 10;
|
||||
static const char* rrValues[rrNumValues] =
|
||||
{
|
||||
"Doom",
|
||||
|
@ -454,10 +454,8 @@ float idConsoleLocal::DrawFPS( float y )
|
|||
"C64 Hi",
|
||||
"CPC",
|
||||
"CPC Hi",
|
||||
"NES",
|
||||
"NES Hi",
|
||||
"Sega MD",
|
||||
"Sega MD Hi",
|
||||
"Sega",
|
||||
"Sega Hi",
|
||||
"Sony PSX",
|
||||
};
|
||||
|
||||
|
|
|
@ -6575,12 +6575,6 @@ void idRenderBackend::PostProcess( const void* data )
|
|||
|
||||
renderProgManager.BindShader_PostProcess_RetroCPC();
|
||||
}
|
||||
else if( r_renderMode.GetInteger() == RENDERMODE_NES || r_renderMode.GetInteger() == RENDERMODE_NES_HIGHRES )
|
||||
{
|
||||
jitterTexScale[0] = r_renderMode.GetInteger() == RENDERMODE_NES_HIGHRES ? 2.0 : 1.0;
|
||||
|
||||
renderProgManager.BindShader_PostProcess_RetroNES();
|
||||
}
|
||||
else if( r_renderMode.GetInteger() == RENDERMODE_GENESIS || r_renderMode.GetInteger() == RENDERMODE_GENESIS_HIGHRES )
|
||||
{
|
||||
jitterTexScale[0] = r_renderMode.GetInteger() == RENDERMODE_GENESIS_HIGHRES ? 2.0 : 1.0;
|
||||
|
|
|
@ -1298,8 +1298,6 @@ enum RenderMode
|
|||
RENDERMODE_C64_HIGHRES,
|
||||
RENDERMODE_CPC,
|
||||
RENDERMODE_CPC_HIGHRES,
|
||||
RENDERMODE_NES,
|
||||
RENDERMODE_NES_HIGHRES,
|
||||
RENDERMODE_GENESIS,
|
||||
RENDERMODE_GENESIS_HIGHRES,
|
||||
RENDERMODE_PSX,
|
||||
|
|
|
@ -345,9 +345,9 @@ void idRenderProgManager::Init( nvrhi::IDevice* device )
|
|||
auto ppFxBindingLayout2 = nvrhi::BindingLayoutDesc()
|
||||
.setVisibility( nvrhi::ShaderType::All )
|
||||
.addItem( renderParmLayoutItem )
|
||||
.addItem( nvrhi::BindingLayoutItem::Texture_SRV( 0 ) ) // LDR _currentRender
|
||||
.addItem( nvrhi::BindingLayoutItem::Texture_SRV( 1 ) ) // _blueNoise
|
||||
.addItem( nvrhi::BindingLayoutItem::Texture_SRV( 2 ) ) // _currentNormals
|
||||
.addItem( nvrhi::BindingLayoutItem::Texture_SRV( 0 ) ) // LDR _currentRender
|
||||
.addItem( nvrhi::BindingLayoutItem::Texture_SRV( 1 ) ) // _blueNoise
|
||||
.addItem( nvrhi::BindingLayoutItem::Texture_SRV( 2 ) ) // _currentNormals
|
||||
.addItem( nvrhi::BindingLayoutItem::Texture_SRV( 3 ) ); // _currentDepth
|
||||
|
||||
bindingLayouts[BINDING_LAYOUT_POST_PROCESS_FINAL2] = { device->createBindingLayout( ppFxBindingLayout2 ), samplerTwoBindingLayout };
|
||||
|
@ -575,7 +575,6 @@ void idRenderProgManager::Init( nvrhi::IDevice* device )
|
|||
{ BUILTIN_POSTPROCESS_RETRO_2BIT, "builtin/post/retro_2bit", "", {}, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_POST_PROCESS_FINAL },
|
||||
{ BUILTIN_POSTPROCESS_RETRO_C64, "builtin/post/retro_c64", "", {}, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_POST_PROCESS_FINAL },
|
||||
{ BUILTIN_POSTPROCESS_RETRO_CPC, "builtin/post/retro_cpc", "", {}, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_POST_PROCESS_FINAL2 },
|
||||
{ BUILTIN_POSTPROCESS_RETRO_NES, "builtin/post/retro_nes", "", {}, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_POST_PROCESS_FINAL },
|
||||
{ BUILTIN_POSTPROCESS_RETRO_GENESIS, "builtin/post/retro_genesis", "", {}, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_POST_PROCESS_FINAL },
|
||||
{ BUILTIN_POSTPROCESS_RETRO_PSX, "builtin/post/retro_ps1", "", {}, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_POST_PROCESS_FINAL },
|
||||
{ BUILTIN_CRT_MATTIAS, "builtin/post/crt_mattias", "", {}, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_POST_PROCESS_CRT },
|
||||
|
|
|
@ -375,7 +375,6 @@ enum
|
|||
BUILTIN_POSTPROCESS_RETRO_2BIT, // CGA, Gameboy, cool for Gamejams
|
||||
BUILTIN_POSTPROCESS_RETRO_C64, // Commodore 64
|
||||
BUILTIN_POSTPROCESS_RETRO_CPC, // Amstrad 6128
|
||||
BUILTIN_POSTPROCESS_RETRO_NES, // NES
|
||||
BUILTIN_POSTPROCESS_RETRO_GENESIS, // Sega Genesis / Megadrive
|
||||
BUILTIN_POSTPROCESS_RETRO_PSX, // Sony Playstation 1
|
||||
BUILTIN_CRT_MATTIAS,
|
||||
|
@ -857,11 +856,6 @@ public:
|
|||
BindShader_Builtin( BUILTIN_POSTPROCESS_RETRO_2BIT );
|
||||
}
|
||||
|
||||
void BindShader_PostProcess_RetroNES()
|
||||
{
|
||||
BindShader_Builtin( BUILTIN_POSTPROCESS_RETRO_NES );
|
||||
}
|
||||
|
||||
void BindShader_PostProcess_RetroGenesis()
|
||||
{
|
||||
BindShader_Builtin( BUILTIN_POSTPROCESS_RETRO_GENESIS );
|
||||
|
|
|
@ -315,7 +315,7 @@ idCVar r_crtVignette( "r_crtVignette", "0.8", CVAR_RENDERER | CVAR_FLOAT | CVAR_
|
|||
|
||||
idCVar r_retroDitherScale( "r_retroDitherScale", "0.3", CVAR_RENDERER | CVAR_FLOAT | CVAR_NEW, "" );
|
||||
|
||||
idCVar r_renderMode( "r_renderMode", "0", CVAR_RENDERER | CVAR_ARCHIVE | CVAR_INTEGER | CVAR_NEW, "0 = Doom, 1 = CGA, 2 = CGA Highres, 3 = Commodore 64, 4 = Commodore 64 Highres, 5 = Amstrad CPC 6128, 6 = Amstrad CPC 6128 Highres, 7 = NES, 8 = NES Highres, 9 = Sega Genesis, 10 = Sega Genesis Highres, 11 = Sony PSX", 0, 11 );
|
||||
idCVar r_renderMode( "r_renderMode", "0", CVAR_RENDERER | CVAR_ARCHIVE | CVAR_INTEGER | CVAR_NEW, "0 = Doom, 1 = CGA, 2 = CGA Highres, 3 = Commodore 64, 4 = Commodore 64 Highres, 5 = Amstrad CPC 6128, 6 = Amstrad CPC 6128 Highres, 7 = Sega Genesis, 8 = Sega Genesis Highres, 9 = Sony PSX", 0, 9 );
|
||||
|
||||
idCVar r_psxVertexJitter( "r_psxVertexJitter", "0.5", CVAR_RENDERER | CVAR_FLOAT | CVAR_NEW, "", 0.0f, 0.75f );
|
||||
idCVar r_psxAffineTextures( "r_psxAffineTextures", "1", CVAR_RENDERER | CVAR_FLOAT | CVAR_NEW, "" );
|
||||
|
|
|
@ -1,326 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 2024 Robert Beckebans
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
|
||||
|
||||
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
|
||||
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
#include "global_inc.hlsl"
|
||||
|
||||
|
||||
// *INDENT-OFF*
|
||||
Texture2D t_BaseColor : register( t0 VK_DESCRIPTOR_SET( 0 ) );
|
||||
Texture2D t_BlueNoise : register( t1 VK_DESCRIPTOR_SET( 0 ) );
|
||||
|
||||
SamplerState s_LinearClamp : register(s0 VK_DESCRIPTOR_SET( 1 ) );
|
||||
SamplerState s_LinearWrap : register(s1 VK_DESCRIPTOR_SET( 1 ) ); // blue noise 256
|
||||
|
||||
struct PS_IN
|
||||
{
|
||||
float4 position : SV_Position;
|
||||
float2 texcoord0 : TEXCOORD0_centroid;
|
||||
};
|
||||
|
||||
struct PS_OUT
|
||||
{
|
||||
float4 color : SV_Target0;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
|
||||
#define RESOLUTION_DIVISOR 4.0
|
||||
#define NUM_COLORS 55
|
||||
|
||||
|
||||
float3 Average( float3 pal[NUM_COLORS] )
|
||||
{
|
||||
float3 sum = _float3( 0 );
|
||||
|
||||
for( int i = 0; i < NUM_COLORS; i++ )
|
||||
{
|
||||
sum += pal[i];
|
||||
}
|
||||
|
||||
return sum / float( NUM_COLORS );
|
||||
}
|
||||
|
||||
float3 Deviation( float3 pal[NUM_COLORS] )
|
||||
{
|
||||
float3 sum = _float3( 0 );
|
||||
float3 avg = Average( pal );
|
||||
|
||||
for( int i = 0; i < NUM_COLORS; i++ )
|
||||
{
|
||||
sum += abs( pal[i] - avg );
|
||||
}
|
||||
|
||||
return sum / float( NUM_COLORS );
|
||||
}
|
||||
|
||||
float3 StandardDeviation( float3 pal[NUM_COLORS] )
|
||||
{
|
||||
float3 sum = _float3( 0 );
|
||||
float3 avg = Average( pal );
|
||||
|
||||
for( int i = 0; i < NUM_COLORS; i++ )
|
||||
{
|
||||
sum += pow( pal[i] - avg, 2.0 );
|
||||
}
|
||||
|
||||
return sqrt( sum );
|
||||
}
|
||||
|
||||
// squared distance to avoid the sqrt of distance function
|
||||
float ColorCompare( float3 a, float3 b )
|
||||
{
|
||||
float3 diff = b - a;
|
||||
return dot( diff, diff );
|
||||
}
|
||||
|
||||
// find nearest palette color using Euclidean distance
|
||||
float3 LinearSearch( float3 c, float3 pal[NUM_COLORS] )
|
||||
{
|
||||
int index = 0;
|
||||
float minDist = ColorCompare( c, pal[0] );
|
||||
|
||||
for( int i = 1; i < NUM_COLORS; i++ )
|
||||
{
|
||||
float dist = ColorCompare( c, pal[i] );
|
||||
|
||||
if( dist < minDist )
|
||||
{
|
||||
minDist = dist;
|
||||
index = i;
|
||||
}
|
||||
}
|
||||
|
||||
return pal[index];
|
||||
}
|
||||
|
||||
|
||||
#define RGB(r, g, b) float3(float(r)/255.0, float(g)/255.0, float(b)/255.0)
|
||||
|
||||
void main( PS_IN fragment, out PS_OUT result )
|
||||
{
|
||||
#if 0
|
||||
|
||||
// NES 1
|
||||
// https://lospec.com/palette-list/nintendo-entertainment-system
|
||||
|
||||
const float3 palette[NUM_COLORS] = // 55
|
||||
{
|
||||
RGB( 0, 0, 0 ),
|
||||
RGB( 0, 88, 0 ),
|
||||
RGB( 80, 48, 0 ),
|
||||
RGB( 0, 104, 0 ),
|
||||
RGB( 0, 64, 88 ),
|
||||
RGB( 0, 120, 0 ),
|
||||
RGB( 136, 20, 0 ),
|
||||
RGB( 0, 168, 0 ),
|
||||
RGB( 168, 16, 0 ),
|
||||
RGB( 168, 0, 32 ),
|
||||
RGB( 0, 168, 68 ),
|
||||
RGB( 0, 184, 0 ),
|
||||
RGB( 0, 0, 188 ),
|
||||
RGB( 0, 136, 136 ),
|
||||
RGB( 148, 0, 132 ),
|
||||
RGB( 68, 40, 188 ),
|
||||
RGB( 120, 120, 120 ),
|
||||
RGB( 172, 124, 0 ),
|
||||
RGB( 124, 124, 124 ),
|
||||
RGB( 228, 0, 88 ),
|
||||
RGB( 228, 92, 16 ),
|
||||
RGB( 88, 216, 84 ),
|
||||
RGB( 0, 0, 252 ),
|
||||
RGB( 248, 56, 0 ),
|
||||
RGB( 0, 88, 248 ),
|
||||
RGB( 0, 120, 248 ),
|
||||
RGB( 104, 68, 252 ),
|
||||
RGB( 248, 120, 88 ),
|
||||
RGB( 216, 0, 204 ),
|
||||
RGB( 88, 248, 152 ),
|
||||
RGB( 248, 88, 152 ),
|
||||
RGB( 104, 136, 252 ),
|
||||
RGB( 252, 160, 68 ),
|
||||
RGB( 248, 184, 0 ),
|
||||
RGB( 184, 248, 24 ),
|
||||
RGB( 152, 120, 248 ),
|
||||
RGB( 0, 232, 216 ),
|
||||
RGB( 60, 188, 252 ),
|
||||
RGB( 188, 188, 188 ),
|
||||
RGB( 216, 248, 120 ),
|
||||
RGB( 248, 216, 120 ),
|
||||
RGB( 248, 164, 192 ),
|
||||
RGB( 0, 252, 252 ),
|
||||
RGB( 184, 248, 184 ),
|
||||
RGB( 184, 184, 248 ),
|
||||
RGB( 240, 208, 176 ),
|
||||
RGB( 248, 120, 248 ),
|
||||
RGB( 252, 224, 168 ),
|
||||
RGB( 216, 184, 248 ),
|
||||
RGB( 184, 248, 216 ),
|
||||
RGB( 164, 228, 252 ),
|
||||
RGB( 248, 184, 248 ),
|
||||
RGB( 248, 216, 248 ),
|
||||
RGB( 248, 248, 248 ),
|
||||
RGB( 252, 252, 252 ),
|
||||
};
|
||||
|
||||
const float3 medianAbsoluteDeviation = RGB( 96, 0, 160 );
|
||||
const float3 deviation = RGB( 87, 70, 86 );
|
||||
|
||||
#else
|
||||
|
||||
// NES Advanced
|
||||
// https://lospec.com/palette-list/nes-advanced
|
||||
|
||||
const float3 palette[NUM_COLORS] = // 55
|
||||
{
|
||||
RGB( 0, 0, 0 ),
|
||||
RGB( 42, 26, 20 ),
|
||||
RGB( 63, 0, 17 ),
|
||||
RGB( 38, 39, 38 ),
|
||||
RGB( 38, 35, 47 ),
|
||||
RGB( 15, 69, 15 ),
|
||||
RGB( 86, 13, 4 ),
|
||||
RGB( 68, 10, 65 ),
|
||||
RGB( 47, 84, 28 ),
|
||||
RGB( 49, 64, 71 ),
|
||||
RGB( 24, 22, 103 ),
|
||||
RGB( 93, 52, 42 ),
|
||||
RGB( 17, 81, 83 ),
|
||||
RGB( 81, 79, 76 ),
|
||||
RGB( 0, 139, 18 ),
|
||||
RGB( 27, 55, 127 ),
|
||||
RGB( 150, 8, 17 ),
|
||||
RGB( 90, 131, 27 ),
|
||||
RGB( 142, 78, 17 ),
|
||||
RGB( 12, 133, 99 ),
|
||||
RGB( 59, 44, 150 ),
|
||||
RGB( 89, 109, 98 ),
|
||||
RGB( 179, 28, 53 ),
|
||||
RGB( 129, 37, 147 ),
|
||||
RGB( 196, 54, 17 ),
|
||||
RGB( 11, 203, 18 ),
|
||||
RGB( 166, 110, 70 ),
|
||||
RGB( 167, 93, 105 ),
|
||||
RGB( 4, 191, 121 ),
|
||||
RGB( 136, 126, 131 ),
|
||||
RGB( 20, 122, 191 ),
|
||||
RGB( 232, 24, 19 ),
|
||||
RGB( 146, 156, 116 ),
|
||||
RGB( 162, 187, 30 ),
|
||||
RGB( 226, 106, 18 ),
|
||||
RGB( 62, 243, 63 ),
|
||||
RGB( 239, 32, 100 ),
|
||||
RGB( 216, 149, 17 ),
|
||||
RGB( 112, 106, 225 ),
|
||||
RGB( 204, 75, 185 ),
|
||||
RGB( 64, 175, 221 ),
|
||||
RGB( 242, 98, 130 ),
|
||||
RGB( 223, 156, 110 ),
|
||||
RGB( 106, 230, 170 ),
|
||||
RGB( 179, 170, 192 ),
|
||||
RGB( 240, 175, 102 ),
|
||||
RGB( 143, 149, 238 ),
|
||||
RGB( 234, 209, 30 ),
|
||||
RGB( 198, 223, 107 ),
|
||||
RGB( 200, 197, 163 ),
|
||||
RGB( 236, 158, 164 ),
|
||||
RGB( 245, 235, 107 ),
|
||||
RGB( 236, 153, 219 ),
|
||||
RGB( 178, 219, 244 ),
|
||||
RGB( 252, 252, 252 ),
|
||||
};
|
||||
|
||||
const float3 medianAbsoluteDeviation = RGB( 55, 13, 120 );
|
||||
const float3 deviation = RGB( 73, 61, 60 );
|
||||
|
||||
#endif
|
||||
|
||||
float2 uv = ( fragment.texcoord0 );
|
||||
float2 uvPixelated = floor( fragment.position.xy / RESOLUTION_DIVISOR ) * RESOLUTION_DIVISOR;
|
||||
|
||||
float3 quantizationPeriod = _float3( 1.0 / NUM_COLORS );
|
||||
float3 quantDeviation = deviation;// = Deviation( palette );
|
||||
//quantDeviation = medianAbsoluteDeviation;
|
||||
|
||||
// get pixellated base color
|
||||
float3 color = t_BaseColor.Sample( s_LinearClamp, uvPixelated * rpWindowCoord.xy ).rgb;
|
||||
|
||||
float2 uvDither = uvPixelated;
|
||||
//if( rpJitterTexScale.x > 1.0 )
|
||||
{
|
||||
uvDither = fragment.position.xy / ( RESOLUTION_DIVISOR / rpJitterTexScale.x );
|
||||
}
|
||||
float dither = DitherArray8x8( uvDither ) - 0.5;
|
||||
|
||||
#if 0
|
||||
if( uv.y < 0.0625 )
|
||||
{
|
||||
color = HSVToRGB( float3( uv.x, 1.0, uv.y * 16.0 ) );
|
||||
|
||||
result.color = float4( color, 1.0 );
|
||||
return;
|
||||
}
|
||||
else if( uv.y < 0.125 )
|
||||
{
|
||||
// quantized
|
||||
color = HSVToRGB( float3( uv.x, 1.0, ( uv.y - 0.0625 ) * 16.0 ) );
|
||||
color = LinearSearch( color, palette );
|
||||
|
||||
result.color = float4( color, 1.0 );
|
||||
return;
|
||||
}
|
||||
else if( uv.y < 0.1875 )
|
||||
{
|
||||
// dithered quantized
|
||||
color = HSVToRGB( float3( uv.x, 1.0, ( uv.y - 0.125 ) * 16.0 ) );
|
||||
|
||||
color.rgb += float3( dither, dither, dither ) * quantDeviation * rpJitterTexScale.y;
|
||||
color = LinearSearch( color, palette );
|
||||
|
||||
result.color = float4( color, 1.0 );
|
||||
return;
|
||||
}
|
||||
else if( uv.y < 0.25 )
|
||||
{
|
||||
color = _float3( uv.x );
|
||||
color = floor( color * NUM_COLORS ) * ( 1.0 / ( NUM_COLORS - 1.0 ) );
|
||||
color += float3( dither, dither, dither ) * quantDeviation * rpJitterTexScale.y;
|
||||
color = LinearSearch( color.rgb, palette );
|
||||
|
||||
result.color = float4( color, 1.0 );
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
color.rgb += float3( dither, dither, dither ) * quantDeviation * rpJitterTexScale.y;
|
||||
|
||||
// find closest color match from C64 color palette
|
||||
color = LinearSearch( color.rgb, palette );
|
||||
|
||||
result.color = float4( color, 1.0 );
|
||||
}
|
|
@ -1,55 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
|
||||
|
||||
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
|
||||
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
#include "global_inc.hlsl"
|
||||
|
||||
|
||||
// *INDENT-OFF*
|
||||
struct VS_IN
|
||||
{
|
||||
float4 position : POSITION;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
float4 normal : NORMAL;
|
||||
float4 tangent : TANGENT;
|
||||
float4 color : COLOR0;
|
||||
float4 color2 : COLOR1;
|
||||
};
|
||||
|
||||
struct VS_OUT {
|
||||
float4 position : SV_Position;
|
||||
float2 texcoord0 : TEXCOORD0_centroid;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
void main( VS_IN vertex, out VS_OUT result )
|
||||
{
|
||||
result.position = vertex.position;
|
||||
result.position.y = -result.position.y;
|
||||
|
||||
result.texcoord0 = vertex.texcoord;
|
||||
}
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 2023 Robert Beckebans
|
||||
Copyright (C) 2024 Robert Beckebans
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
|
|
|
@ -60,8 +60,6 @@ builtin/post/retro_cpc.vs.hlsl -T vs
|
|||
builtin/post/retro_cpc.ps.hlsl -T ps
|
||||
builtin/post/retro_2bit.vs.hlsl -T vs
|
||||
builtin/post/retro_2bit.ps.hlsl -T ps
|
||||
builtin/post/retro_nes.vs.hlsl -T vs
|
||||
builtin/post/retro_nes.ps.hlsl -T ps
|
||||
builtin/post/retro_genesis.vs.hlsl -T vs
|
||||
builtin/post/retro_genesis.ps.hlsl -T ps
|
||||
builtin/post/retro_ps1.vs.hlsl -T vs
|
||||
|
|
Loading…
Reference in a new issue