Added r_renderMode cvar for Retro rendering modes: C64, Sega, PSX

This commit is contained in:
Robert Beckebans 2023-12-30 14:10:07 +01:00
parent cd6c804508
commit 567b95a642
14 changed files with 453 additions and 36 deletions

View file

@ -3,14 +3,14 @@ bind "I" "toggle r_showSurfaceInfo"
bind "N" "noclip"
bind "M" "spawn moveable_macbethchart"
bind "F1" "toggle r_showViewEnvprobes 1 2 3 0"
bind "F2" "toggle r_showTris 1 2 3 0"
bind "F1" "toggle editLights"
bind "F2" "toggle r_showTris 1 2 0"
bind "F3" "toggle r_forceAmbient 0.5 1.0 0"
bind "F4" "toggle r_skipInteractions"
bind "F5" "savegame quick"
bind "F6" "toggle r_showLightGrid 1 3 4 0"
bind "F7" "toggle r_useSSAO"
bind "F8" "toggle r_useFilmicPostProcessing"
bind "F7" "toggle r_renderMode 0 1 2 3"
bind "F8" "toggle r_useCRTPostFX 0 1 2"
bind "F9" "loadgame quick"
bind "F10" "toggle com_fixedTic"
bind "F11" "toggle r_pbrDebug"
//bind "F10" "toggle com_fixedTic"
bind "F11" "toggle r_useFilmicPostFX"

View file

@ -34,7 +34,7 @@ const static int NUM_SYSTEM_OPTIONS_OPTIONS = 8;
extern idCVar r_graphicsAPI;
extern idCVar r_antiAliasing;
extern idCVar r_usePostProcessing;
extern idCVar r_useFilmicPostFX;
extern idCVar r_swapInterval;
extern idCVar s_volume_dB;
extern idCVar r_exposure; // RB: use this to control HDR exposure or brightness in LDR mode
@ -421,7 +421,7 @@ void idMenuScreen_Shell_SystemOptions::idMenuDataSource_SystemSettings::LoadData
//originalShadowMapping = r_useShadowMapping.GetInteger();
originalSSAO = r_useSSAO.GetInteger();
originalAmbientBrightness = r_forceAmbient.GetFloat();
originalPostProcessing = r_usePostProcessing.GetInteger();
originalPostProcessing = r_useFilmicPostFX.GetInteger();
// RB end
const int fullscreen = r_fullscreen.GetInteger();
@ -597,7 +597,7 @@ void idMenuScreen_Shell_SystemOptions::idMenuDataSource_SystemSettings::AdjustFi
{
static const int numValues = 2;
static const int values[numValues] = { 0, 1 };
r_usePostProcessing.SetInteger( AdjustOption( r_usePostProcessing.GetInteger(), values, numValues, adjustAmount ) );
r_useFilmicPostFX.SetInteger( AdjustOption( r_useFilmicPostFX.GetInteger(), values, numValues, adjustAmount ) );
break;
}
/*
@ -760,7 +760,7 @@ idSWFScriptVar idMenuScreen_Shell_SystemOptions::idMenuDataSource_SystemSettings
return values[ r_antiAliasing.GetInteger() ];
}
case SYSTEM_FIELD_POSTFX:
if( r_usePostProcessing.GetInteger() > 0 )
if( r_useFilmicPostFX.GetInteger() > 0 )
{
return "#str_swf_enabled";
}
@ -848,7 +848,7 @@ bool idMenuScreen_Shell_SystemOptions::idMenuDataSource_SystemSettings::IsDataCh
return true;
}
if( originalPostProcessing != r_usePostProcessing.GetInteger() )
if( originalPostProcessing != r_useFilmicPostFX.GetInteger() )
{
return true;
}

View file

@ -1234,5 +1234,92 @@ CONSOLE_COMMAND( makeImageHeader, "load an image and turn it into a .h file", NU
}
headerFile->Printf( "\n};\n#endif\n" );
Mem_Free( buffer );
}
CONSOLE_COMMAND( makePaletteHeader, "load a .pal palette, build an image from it and turn it into a .h file", NULL )
{
byte* buffer;
int width = 0, height = 0;
if( args.Argc() < 2 )
{
common->Printf( "USAGE: makePaletteHeader filename [exportname]\n" );
return;
}
idStr filename = args.Argv( 1 );
R_LoadImage( filename, &buffer, &width, &height, NULL, true, NULL );
if( !buffer )
{
common->Printf( "loading %s failed.\n", filename.c_str() );
return;
}
filename.StripFileExtension();
idStr exportname;
if( args.Argc() == 3 )
{
exportname.Format( "Image_%s.h", args.Argv( 2 ) );
}
else
{
exportname.Format( "Image_%s.h", filename.c_str() );
}
for( int i = 0; i < exportname.Length(); i++ )
{
if( exportname[ i ] == '/' )
{
exportname[ i ] = '_';
}
}
idFileLocal headerFile( fileSystem->OpenFileWrite( exportname, "fs_basepath" ) );
idStr uppername = exportname;
uppername.ToUpper();
for( int i = 0; i < uppername.Length(); i++ )
{
if( uppername[ i ] == '.' )
{
uppername[ i ] = '_';
}
}
headerFile->Printf( "#ifndef %s_TEX_H\n", uppername.c_str() );
headerFile->Printf( "#define %s_TEX_H\n\n", uppername.c_str() );
headerFile->Printf( "#define %s_TEX_WIDTH %i\n", uppername.c_str(), width );
headerFile->Printf( "#define %s_TEX_HEIGHT %i\n\n", uppername.c_str(), height );
headerFile->Printf( "static const unsigned char %s_Bytes[] = {\n", uppername.c_str() );
int bufferSize = width * height * 4;
for( int i = 0; i < bufferSize; i++ )
{
byte b = buffer[i];
if( i < ( bufferSize - 1 ) )
{
headerFile->Printf( "0x%02hhx, ", b );
}
else
{
headerFile->Printf( "0x%02hhx", b );
}
if( i % 12 == 0 )
{
headerFile->Printf( "\n" );
}
}
headerFile->Printf( "\n};\n#endif\n" );
Mem_Free( buffer );
}

View file

@ -5980,15 +5980,6 @@ idRenderBackend::PostProcess
extern idCVar rs_enable;
void idRenderBackend::PostProcess( const void* data )
{
// only do the post process step if resolution scaling is enabled. Prevents the unnecessary copying of the framebuffer and
// corresponding full screen quad pass.
/*
if( rs_enable.GetInteger() == 0 && !r_usePostProcessing.GetBool() && r_antiAliasing.GetInteger() == 0 )
{
return;
}
*/
if( viewDef->renderView.rdflags & RDF_IRRADIANCE )
{
#if defined( USE_NVRHI )
@ -6106,7 +6097,7 @@ void idRenderBackend::PostProcess( const void* data )
}
#endif
if( r_usePostProcessing.GetInteger() > 0 )
if( r_useFilmicPostFX.GetBool() || r_renderMode.GetInteger() > 0 )
{
BlitParameters blitParms;
blitParms.sourceTexture = ( nvrhi::ITexture* )globalImages->ldrImage->GetTextureID();
@ -6123,10 +6114,18 @@ void idRenderBackend::PostProcess( const void* data )
GL_SelectTexture( 1 );
globalImages->blueNoiseImage256->Bind();
if( r_usePostProcessing.GetInteger() == 2 )
if( r_renderMode.GetInteger() == 1 )
{
renderProgManager.BindShader_PostProcess_RetroC64();
}
else if( r_renderMode.GetInteger() == 2 )
{
renderProgManager.BindShader_PostProcess_RetroGenesis();
}
else if( r_renderMode.GetInteger() == 3 )
{
renderProgManager.BindShader_PostProcess_RetroPSX();
}
else
{
renderProgManager.BindShader_PostProcess();

View file

@ -1268,7 +1268,7 @@ extern idCVar r_hdrDebug;
extern idCVar r_ldrContrastThreshold;
extern idCVar r_ldrContrastOffset;
extern idCVar r_usePostProcessing;
extern idCVar r_useFilmicPostFX;
extern idCVar r_forceAmbient;
extern idCVar r_useSSAO;
@ -1296,6 +1296,8 @@ extern idCVar r_taaMotionVectors;
extern idCVar r_useCRTPostFX;
extern idCVar r_crtCurvature;
extern idCVar r_crtVignette;
extern idCVar r_renderMode;
// RB end
/*

View file

@ -522,6 +522,8 @@ void idRenderProgManager::Init( nvrhi::IDevice* device )
{ BUILTIN_WOBBLESKY, "builtin/legacy/wobblesky", "", {}, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_DEFAULT },
{ BUILTIN_POSTPROCESS, "builtin/post/postprocess", "", {}, 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_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_FINAL },
{ BUILTIN_CRT_NUPIXIE, "builtin/post/crt_newpixie", "", {}, false, SHADER_STAGE_DEFAULT, LAYOUT_DRAW_VERT, BINDING_LAYOUT_POST_PROCESS_FINAL },

View file

@ -366,7 +366,9 @@ enum
BUILTIN_WOBBLESKY,
BUILTIN_POSTPROCESS,
// RB begin
BUILTIN_POSTPROCESS_RETRO_C64,
BUILTIN_POSTPROCESS_RETRO_C64, // Commodore 64
BUILTIN_POSTPROCESS_RETRO_GENESIS, // Sega Genesis / Megadrive
BUILTIN_POSTPROCESS_RETRO_PSX, // Sony Playstation 1
BUILTIN_CRT_MATTIAS,
BUILTIN_CRT_NUPIXIE,
BUILTIN_SCREEN,
@ -825,6 +827,16 @@ public:
BindShader_Builtin( BUILTIN_POSTPROCESS_RETRO_C64 );
}
void BindShader_PostProcess_RetroGenesis()
{
BindShader_Builtin( BUILTIN_POSTPROCESS_RETRO_GENESIS );
}
void BindShader_PostProcess_RetroPSX()
{
BindShader_Builtin( BUILTIN_POSTPROCESS_RETRO_PSX );
}
void BindShader_CrtMattias()
{
BindShader_Builtin( BUILTIN_CRT_MATTIAS );

View file

@ -276,7 +276,7 @@ idCVar r_hdrDebug( "r_hdrDebug", "0", CVAR_RENDERER | CVAR_FLOAT, "show scene lu
idCVar r_ldrContrastThreshold( "r_ldrContrastThreshold", "1.1", CVAR_RENDERER | CVAR_FLOAT, "" );
idCVar r_ldrContrastOffset( "r_ldrContrastOffset", "3", CVAR_RENDERER | CVAR_FLOAT, "" );
idCVar r_usePostProcessing( "r_usePostProcessing", "1", CVAR_RENDERER | CVAR_ARCHIVE | CVAR_INTEGER, "1 = Filmic Look, 2 = Retro C64", 0, 2 );
idCVar r_useFilmicPostFX( "r_useFilmicPostFX", "1", CVAR_RENDERER | CVAR_ARCHIVE | CVAR_BOOL, "filmic look with chromatic abberation and film grain" );
idCVar r_forceAmbient( "r_forceAmbient", "0.5", CVAR_RENDERER | CVAR_ARCHIVE | CVAR_FLOAT, "render additional ambient pass to make the game less dark", 0.0f, 1.0f );
@ -306,6 +306,8 @@ idCVar r_taaMotionVectors( "r_taaMotionVectors", "1", CVAR_RENDERER | CVAR_BOOL,
idCVar r_useCRTPostFX( "r_useCRTPostFX", "0", CVAR_RENDERER | CVAR_ARCHIVE | CVAR_INTEGER, "RetroArch CRT shader: 1 = Matthias CRT, 1 = New Pixie", 0, 2 );
idCVar r_crtCurvature( "r_crtCurvature", "2", CVAR_RENDERER | CVAR_FLOAT, "rounded borders" );
idCVar r_crtVignette( "r_crtVignette", "0.8", CVAR_RENDERER | CVAR_FLOAT, "fading into the borders" );
idCVar r_renderMode( "r_renderMode", "0", CVAR_RENDERER | CVAR_ARCHIVE | CVAR_INTEGER, "0 = Doom, 1 = Commodore 64, 3 = Sega Genesis, 4 = Sony PSX", 0, 4 );
// RB end
const char* fileExten[4] = { "tga", "png", "jpg", "exr" };

View file

@ -55,7 +55,7 @@ struct PS_OUT
// find nearest palette color using Euclidean distance
float4 LinearSearch( float3 c, float3 pal[NUM_COLORS] )
float3 LinearSearch( float3 c, float3 pal[NUM_COLORS] )
{
int idx = 0;
float nd = distance( c, pal[0] );
@ -71,7 +71,7 @@ float4 LinearSearch( float3 c, float3 pal[NUM_COLORS] )
}
}
return float4( pal[idx], 1.0 );
return pal[idx];
}
float3 GetClosest( float3 val1, float3 val2, float3 target )
@ -147,16 +147,13 @@ void main( PS_IN fragment, out PS_OUT result )
float2 uv = ( fragment.texcoord0 );
float2 uvPixellated = floor( fragment.position.xy / RESOLUTION_DIVISOR ) * RESOLUTION_DIVISOR;
float4 color = t_BaseColor.Sample( samp0, uv );
float3 quantizationPeriod = _float3( 1.0 / NUM_COLORS );
// get pixellated base color
float3 dc = t_BaseColor.Sample( samp0, uvPixellated * rpWindowCoord.xy ).rgb;
color.rgb = dc;
float3 color = t_BaseColor.Sample( samp0, uvPixellated * rpWindowCoord.xy ).rgb;
// add Bayer 8x8 dithering
//float2 psxDitherScale = fragment.position.xy / ( RESOLUTION_DIVISOR / 2.0 );
//float2 uvDither = fragment.position.xy / ( RESOLUTION_DIVISOR / 2.0 );
float dither = DitherArray8x8( uvPixellated ) - 0.5;
color.rgb += float3( dither, dither, dither ) * quantizationPeriod;
@ -205,12 +202,9 @@ void main( PS_IN fragment, out PS_OUT result )
};
#endif
// PSX color quantization
//color = floor( color * 32.0 ) / 32.0;
// find closest color match from C64 color palette
color = LinearSearch( color.rgb, palette );
//color = float4( BinarySearch( color.rgb, palette ), 1.0 );
result.color = color;
result.color = float4( color, 1.0 );
}

View file

@ -0,0 +1,117 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
Copyright (C) 2023 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 samp0 : register(s0 VK_DESCRIPTOR_SET( 1 ) );
SamplerState samp1 : 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 64
// find nearest palette color using Euclidean distance
float3 LinearSearch( float3 c, float3 pal[NUM_COLORS] )
{
int idx = 0;
float nd = distance( c, pal[0] );
for( int i = 1; i < NUM_COLORS; i++ )
{
float d = distance( c, pal[i] );
if( d < nd )
{
nd = d;
idx = i;
}
}
return pal[idx];
}
float Quantize( float inp, float period )
{
return floor( ( inp + period / 2.0 ) / period ) * period;
}
#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 )
{
float2 uv = ( fragment.texcoord0 );
float2 uvPixellated = floor( fragment.position.xy / RESOLUTION_DIVISOR ) * RESOLUTION_DIVISOR;
// the Sega Mega Drive has a 9 bit HW palette making a total of 512 available colors
// that is 3 bit per RGB channel
// 2^3 = 8
// 8 * 8 * 8 = 512 colors
// although only 61 colors were available on the screen at the same time but we ignore this for now
const int quantizationSteps = 8;
float3 quantizationPeriod = _float3( 1.0 / ( quantizationSteps - 1 ) );
// get pixellated base color
float3 color = t_BaseColor.Sample( samp0, uvPixellated * rpWindowCoord.xy ).rgb;
// add Bayer 8x8 dithering
float2 uvDither = fragment.position.xy / ( RESOLUTION_DIVISOR / 1.0 );
float dither = DitherArray8x8( uvPixellated ) - 0.5;
color.rgb += float3( dither, dither, dither ) * quantizationPeriod;
// find closest color match from Sega Mega Drive color palette
color = float3(
Quantize( color.r, quantizationPeriod.r ),
Quantize( color.g, quantizationPeriod.g ),
Quantize( color.b, quantizationPeriod.b )
);
//color = LinearSearch( color.rgb, palette );
//color = float4( BinarySearch( color.rgb, palette ), 1.0 );
result.color = float4( color, 1.0 );
}

View file

@ -0,0 +1,55 @@
/*
===========================================================================
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;
}

View file

@ -0,0 +1,88 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
Copyright (C) 2023 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 samp0 : register(s0 VK_DESCRIPTOR_SET( 1 ) );
SamplerState samp1 : 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
float Quantize( float inp, float period )
{
return floor( ( inp + period / 2.0 ) / period ) * period;
}
void main( PS_IN fragment, out PS_OUT result )
{
float2 uv = ( fragment.texcoord0 );
float2 uvPixellated = floor( fragment.position.xy / RESOLUTION_DIVISOR ) * RESOLUTION_DIVISOR;
// most Sony Playstation 1 titles used 5 bit per RGB channel
// 2^5 = 32
// 32 * 32 * 32 = 32768 colors
const int quantizationSteps = 32;
float3 quantizationPeriod = _float3( 1.0 / ( quantizationSteps - 1 ) );
// get pixellated base color
float3 color = t_BaseColor.Sample( samp0, uvPixellated * rpWindowCoord.xy ).rgb;
// add Bayer 8x8 dithering
float2 uvDither = fragment.position.xy / ( RESOLUTION_DIVISOR / 1.0 );
float dither = DitherArray8x8( uvDither ) - 0.5;
color.rgb += float3( dither, dither, dither ) * quantizationPeriod;
// PSX color quantization
color = float3(
Quantize( color.r, quantizationPeriod.r ),
Quantize( color.g, quantizationPeriod.g ),
Quantize( color.b, quantizationPeriod.b )
);
result.color = float4( color, 1.0 );
}

View file

@ -0,0 +1,55 @@
/*
===========================================================================
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;
}

View file

@ -54,6 +54,10 @@ builtin/post/postprocess.vs.hlsl -T vs_5_0
builtin/post/postprocess.ps.hlsl -T ps_5_0
builtin/post/retro_c64.vs.hlsl -T vs_5_0
builtin/post/retro_c64.ps.hlsl -T ps_5_0
builtin/post/retro_genesis.vs.hlsl -T vs_5_0
builtin/post/retro_genesis.ps.hlsl -T ps_5_0
builtin/post/retro_ps1.vs.hlsl -T vs_5_0
builtin/post/retro_ps1.ps.hlsl -T ps_5_0
builtin/post/crt_mattias.vs.hlsl -T vs_5_0
builtin/post/crt_mattias.ps.hlsl -T ps_5_0
builtin/post/crt_newpixie.vs.hlsl -T vs_5_0