Added menu options for Retro modes

This commit is contained in:
Robert Beckebans 2024-01-03 15:54:58 +01:00
parent cbe6147f03
commit 610157fe8f
14 changed files with 112 additions and 76 deletions

View file

@ -639,8 +639,10 @@ r_graphicsAPI | Default DX12, can be either DX12 or Vul
r_antiAliasing | Different Anti-Aliasing modes
r_exposure [0 .. 1] | Default 0.5, controls brightness and affects HDR -> sRGB Rec. 709 exposure key. This is what you change in the video brightness options
r_useSSAO [0 .. 1] | Use Screen Space Ambient Occlusion to darken the corners in the scene and give it more depth
r_useFilmicPostProcessing [0, 1] | Apply several post process effects to mimic a filmic look
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, 1] | CRT monitor/TV filter
r_renderMode [0 .. 5] | Default 0 = Doom 3, 1 = Commodore 64, 2 = Commodore 64 Highres, 3 = Sega Genesis, 4 = Sega Genesis Highres, 5 = Sony PSX
## Modding Support
Name | Description

View file

@ -1368,9 +1368,11 @@ public:
SYSTEM_FIELD_VSYNC,
SYSTEM_FIELD_ANTIALIASING,
// RB begin
SYSTEM_FIELD_POSTFX,
SYSTEM_FIELD_SSAO,
SYSTEM_FIELD_RENDERMODE,
SYSTEM_FIELD_AMBIENT_BRIGHTNESS,
SYSTEM_FIELD_SSAO,
SYSTEM_FIELD_FILMIC_POSTFX,
SYSTEM_FIELD_CRT_POSTFX,
// RB end
SYSTEM_FIELD_BRIGHTNESS,
SYSTEM_FIELD_VOLUME,

View file

@ -119,10 +119,19 @@ void idMenuScreen_Shell_SystemOptions::Initialize( idMenuHandler* data )
// RB begin
control = new( TAG_SWF ) idMenuWidget_ControlButton();
control->SetOptionType( OPTION_SLIDER_TEXT );
control->SetLabel( "Filmic VFX" );
control->SetDataSource( &systemData, idMenuDataSource_SystemSettings::SYSTEM_FIELD_POSTFX );
control->SetLabel( "Render Mode" );
control->SetDataSource( &systemData, idMenuDataSource_SystemSettings::SYSTEM_FIELD_RENDERMODE );
control->SetupEvents( DEFAULT_REPEAT_TIME, options->GetChildren().Num() );
control->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_COMMAND, idMenuDataSource_SystemSettings::SYSTEM_FIELD_POSTFX );
control->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_COMMAND, idMenuDataSource_SystemSettings::SYSTEM_FIELD_RENDERMODE );
options->AddChild( control );
control = new( TAG_SWF ) idMenuWidget_ControlButton();
control->SetOptionType( OPTION_SLIDER_BAR );
control->SetLabel( "Ambient Lighting" );
control->SetDescription( "Sets the amount of indirect lighting. Needed for modern PBR reflections" );
control->SetDataSource( &systemData, idMenuDataSource_SystemSettings::SYSTEM_FIELD_AMBIENT_BRIGHTNESS );
control->SetupEvents( 2, options->GetChildren().Num() );
control->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_COMMAND, idMenuDataSource_SystemSettings::SYSTEM_FIELD_AMBIENT_BRIGHTNESS );
options->AddChild( control );
control = new( TAG_SWF ) idMenuWidget_ControlButton();
@ -142,12 +151,19 @@ void idMenuScreen_Shell_SystemOptions::Initialize( idMenuHandler* data )
options->AddChild( control );*/
control = new( TAG_SWF ) idMenuWidget_ControlButton();
control->SetOptionType( OPTION_SLIDER_BAR );
control->SetLabel( "Ambient Lighting" );
control->SetDescription( "Sets the amount of indirect lighting. Needed for modern PBR reflections" );
control->SetDataSource( &systemData, idMenuDataSource_SystemSettings::SYSTEM_FIELD_AMBIENT_BRIGHTNESS );
control->SetupEvents( 2, options->GetChildren().Num() );
control->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_COMMAND, idMenuDataSource_SystemSettings::SYSTEM_FIELD_SSAO );
control->SetOptionType( OPTION_SLIDER_TEXT );
control->SetLabel( "Filmic Post FX" );
control->SetDataSource( &systemData, idMenuDataSource_SystemSettings::SYSTEM_FIELD_FILMIC_POSTFX );
control->SetupEvents( DEFAULT_REPEAT_TIME, options->GetChildren().Num() );
control->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_COMMAND, idMenuDataSource_SystemSettings::SYSTEM_FIELD_FILMIC_POSTFX );
options->AddChild( control );
control = new( TAG_SWF ) idMenuWidget_ControlButton();
control->SetOptionType( OPTION_SLIDER_TEXT );
control->SetLabel( "CRT Filter" );
control->SetDataSource( &systemData, idMenuDataSource_SystemSettings::SYSTEM_FIELD_CRT_POSTFX );
control->SetupEvents( DEFAULT_REPEAT_TIME, options->GetChildren().Num() );
control->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_COMMAND, idMenuDataSource_SystemSettings::SYSTEM_FIELD_CRT_POSTFX );
options->AddChild( control );
// RB end
@ -593,13 +609,27 @@ void idMenuScreen_Shell_SystemOptions::idMenuDataSource_SystemSettings::AdjustFi
break;
}
// RB begin
case SYSTEM_FIELD_POSTFX:
case SYSTEM_FIELD_RENDERMODE:
{
static const int numValues = 6;
static const int values[numValues] = { 0, 1, 2, 3, 4, 5 };
r_renderMode.SetInteger( AdjustOption( r_renderMode.GetInteger(), values, numValues, adjustAmount ) );
break;
}
case SYSTEM_FIELD_FILMIC_POSTFX:
{
static const int numValues = 2;
static const int values[numValues] = { 0, 1 };
r_useFilmicPostFX.SetInteger( AdjustOption( r_useFilmicPostFX.GetInteger(), values, numValues, adjustAmount ) );
break;
}
case SYSTEM_FIELD_CRT_POSTFX:
{
static const int numValues = 3;
static const int values[numValues] = { 0, 1, 2 };
r_useCRTPostFX.SetInteger( AdjustOption( r_useCRTPostFX.GetInteger(), values, numValues, adjustAmount ) );
break;
}
/*
case SYSTEM_FIELD_SHADOWMAPPING:
{
@ -759,7 +789,24 @@ idSWFScriptVar idMenuScreen_Shell_SystemOptions::idMenuDataSource_SystemSettings
return values[ r_antiAliasing.GetInteger() ];
}
case SYSTEM_FIELD_POSTFX:
case SYSTEM_FIELD_RENDERMODE:
{
static const int numValues = 6;
static const char* values[numValues] =
{
"Doom 3",
"Commodore 64",
"Commodore 64 Highres",
"Sega Genesis",
"Sega Genesis Highres",
"Sony PSX",
};
compile_time_assert( numValues == ( RENDERMODE_PSX + 1 ) );
return values[ r_renderMode.GetInteger() ];
}
case SYSTEM_FIELD_FILMIC_POSTFX:
if( r_useFilmicPostFX.GetInteger() > 0 )
{
return "#str_swf_enabled";
@ -768,20 +815,19 @@ idSWFScriptVar idMenuScreen_Shell_SystemOptions::idMenuDataSource_SystemSettings
{
return "#str_swf_disabled";
}
//return va( "%dx", idMath::IPow( 2, r_motionBlur.GetInteger() ) );
// RB begin
/*
case SYSTEM_FIELD_SHADOWMAPPING:
if( r_useShadowMapping.GetInteger() == 1 )
case SYSTEM_FIELD_CRT_POSTFX:
{
static const int numValues = 3;
static const char* values[numValues] =
{
return "#str_swf_enabled";
}
else
{
return "#str_swf_disabled";
}
*/
"#str_swf_disabled",
"Mattias CRT",
"Newpixie CRT",
};
return values[ r_useCRTPostFX.GetInteger() ];
}
//case SYSTEM_FIELD_LODBIAS:
// return LinearAdjust( r_lodBias.GetFloat(), -1.0f, 1.0f, 0.0f, 100.0f );
@ -798,7 +844,6 @@ idSWFScriptVar idMenuScreen_Shell_SystemOptions::idMenuDataSource_SystemSettings
case SYSTEM_FIELD_AMBIENT_BRIGHTNESS:
return LinearAdjust( r_forceAmbient.GetFloat(), 0.0f, 1.0f, 0.0f, 100.0f );
// RB end
case SYSTEM_FIELD_BRIGHTNESS:
return LinearAdjust( r_exposure.GetFloat(), 0.0f, 1.0f, 0.0f, 100.0f );

View file

@ -46,7 +46,6 @@ If you have questions concerning this license or the applicable additional terms
#include "../libs/mesa/format_r11g11b10f.h"
idCVar image_highQualityCompression( "image_highQualityCompression", "0", CVAR_BOOL, "Use high quality (slow) compression" );
idCVar r_useHighQualitySky( "r_useHighQualitySky", "1", CVAR_BOOL | CVAR_ARCHIVE, "Use high quality skyboxes" );
/*
========================

View file

@ -73,8 +73,6 @@ typedef struct mtrParsingData_s
bool forceOverlays;
} mtrParsingData_t;
extern idCVar r_useHighQualitySky;
idCVar r_forceSoundOpAmplitude( "r_forceSoundOpAmplitude", "0", CVAR_FLOAT, "Don't call into the sound system for amplitudes" );
/*
@ -1870,14 +1868,7 @@ void idMaterial::ParseStage( idLexer& src, const textureRepeat_t trpDefault )
}
if( !token.Icmp( "uncompressedCubeMap" ) )
{
if( r_useHighQualitySky.GetBool() )
{
td = TD_HIGHQUALITY_CUBE; // motorsep 05-17-2015; token to mark cubemap/skybox to be uncompressed texture
}
else
{
td = TD_LOWQUALITY_CUBE;
}
td = TD_HIGHQUALITY_CUBE; // motorsep 05-17-2015; token to mark cubemap/skybox to be uncompressed texture
continue;
}
if( !token.Icmp( "nopicmip" ) )

View file

@ -30,11 +30,7 @@ If you have questions concerning this license or the applicable additional terms
#include "precompiled.h"
#pragma hdrstop
/*
================================================================================================
Contains the Image implementation for OpenGL.
================================================================================================
*/
idCVar image_pixelLook( "image_pixelLook", "0", CVAR_BOOL | CVAR_ARCHIVE, "Turn off linear filtering on most textures to achieve the 90s software renderer look" );
#include "../RenderCommon.h"
@ -303,7 +299,7 @@ idImage::GetSampler
*/
void* idImage::GetSampler( SamplerCache& samplerCache )
{
if( r_renderMode.GetInteger() == RENDERMODE_PSX )
if( R_UsePixelatedLook() )
{
if( !sampler )
{

View file

@ -733,7 +733,7 @@ void idRenderBackend::GetCurrentBindingLayout( int type )
desc[2].bindings[5].resourceHandle = ( nvrhi::ITexture* )GetImageAt( 10 )->GetTextureID();
}
if( r_renderMode.GetInteger() == RENDERMODE_PSX )
if( R_UsePixelatedLook() )
{
if( desc[3].bindings.empty() )
{
@ -823,7 +823,7 @@ void idRenderBackend::GetCurrentBindingLayout( int type )
desc[2].bindings[5].resourceHandle = ( nvrhi::ITexture* )GetImageAt( 10 )->GetTextureID();
}
if( r_renderMode.GetInteger() == RENDERMODE_PSX )
if( R_UsePixelatedLook() )
{
if( desc[3].bindings.empty() )
{
@ -938,7 +938,7 @@ void idRenderBackend::GetCurrentBindingLayout( int type )
}
// samplers: 3
if( r_renderMode.GetInteger() == RENDERMODE_PSX )
if( R_UsePixelatedLook() )
{
if( desc[3].bindings.empty() )
{
@ -1024,7 +1024,7 @@ void idRenderBackend::GetCurrentBindingLayout( int type )
}
// samplers: 3
if( r_renderMode.GetInteger() == RENDERMODE_PSX )
if( R_UsePixelatedLook() )
{
if( desc[3].bindings.empty() )
{
@ -1113,7 +1113,7 @@ void idRenderBackend::GetCurrentBindingLayout( int type )
}
// samplers: 3
if( r_renderMode.GetInteger() == RENDERMODE_PSX )
if( R_UsePixelatedLook() )
{
if( desc[3].bindings.empty() )
{
@ -1218,7 +1218,7 @@ void idRenderBackend::GetCurrentBindingLayout( int type )
}
// samplers: 3
if( r_renderMode.GetInteger() == RENDERMODE_PSX )
if( R_UsePixelatedLook() )
{
if( desc[3].bindings.empty() )
{
@ -1466,7 +1466,7 @@ void idRenderBackend::GetCurrentBindingLayout( int type )
desc[0].bindings[3].resourceHandle = ( nvrhi::ITexture* )GetImageAt( 2 )->GetTextureID();
}
if( r_renderMode.GetInteger() == RENDERMODE_PSX )
if( R_UsePixelatedLook() )
{
if( desc[1].bindings.empty() )
{
@ -1558,7 +1558,7 @@ void idRenderBackend::GetCurrentBindingLayout( int type )
bindings[1].resourceHandle = ( nvrhi::ITexture* )GetImageAt( 1 )->GetTextureID();
}
if( r_renderMode.GetInteger() == RENDERMODE_PSX )
if( R_UsePixelatedLook() )
{
if( desc[2].bindings.empty() )
{
@ -1622,7 +1622,7 @@ void idRenderBackend::GetCurrentBindingLayout( int type )
bindings[1].resourceHandle = ( nvrhi::ITexture* )GetImageAt( 1 )->GetTextureID();
}
if( r_renderMode.GetInteger() == RENDERMODE_PSX )
if( R_UsePixelatedLook() )
{
if( desc[2].bindings.empty() )
{
@ -1672,7 +1672,7 @@ void idRenderBackend::GetCurrentBindingLayout( int type )
desc[0].bindings[3].resourceHandle = ( nvrhi::ITexture* )GetImageAt( 2 )->GetTextureID();
}
if( r_renderMode.GetInteger() == RENDERMODE_PSX )
if( R_UsePixelatedLook() )
{
if( desc[1].bindings.empty() )
{

View file

@ -2172,11 +2172,11 @@ void idRenderBackend::AmbientPass( const drawSurf_t* const* drawSurfs, int numDr
specularColor = lightColor;// * 0.5f;
float ambientBoost = 1.0f;
if( !r_usePBR.GetBool() )
{
ambientBoost += r_useSSAO.GetBool() ? 0.2f : 0.0f;
ambientBoost *= 1.1f;
}
//if( !r_usePBR.GetBool() )
//{
// ambientBoost += r_useSSAO.GetBool() ? 0.2f : 0.0f;
// ambientBoost *= 1.1f;
//}
ambientColor.x = r_forceAmbient.GetFloat() * ambientBoost;
ambientColor.y = r_forceAmbient.GetFloat() * ambientBoost;
@ -2186,7 +2186,7 @@ void idRenderBackend::AmbientPass( const drawSurf_t* const* drawSurfs, int numDr
renderProgManager.SetRenderParm( RENDERPARM_AMBIENT_COLOR, ambientColor.ToFloatPtr() );
bool useIBL = r_usePBR.GetBool() && !fillGbuffer;
bool useIBL = !fillGbuffer;
// setup renderparms assuming we will be drawing trivial surfaces first
RB_SetupForFastPathInteractions( diffuseColor, specularColor );

View file

@ -1268,7 +1268,6 @@ extern idCVar r_hdrDebug;
extern idCVar r_ldrContrastThreshold;
extern idCVar r_ldrContrastOffset;
extern idCVar r_useFilmicPostFX;
extern idCVar r_forceAmbient;
extern idCVar r_useSSAO;
@ -1276,7 +1275,6 @@ extern idCVar r_ssaoDebug;
extern idCVar r_ssaoFiltering;
extern idCVar r_useHierarchicalDepthBuffer;
extern idCVar r_usePBR;
extern idCVar r_pbrDebug;
extern idCVar r_showViewEnvprobes;
extern idCVar r_showLightGrid; // show Quake 3 style light grid points
@ -1293,6 +1291,7 @@ extern idCVar r_taaNewFrameWeight;
extern idCVar r_taaMaxRadiance;
extern idCVar r_taaMotionVectors;
extern idCVar r_useFilmicPostFX;
extern idCVar r_useCRTPostFX;
extern idCVar r_crtCurvature;
extern idCVar r_crtVignette;
@ -1308,6 +1307,7 @@ enum RenderMode
};
extern idCVar r_renderMode;
extern idCVar image_pixelLook;
// RB end
/*
@ -1318,6 +1318,8 @@ INITIALIZATION
====================================================================
*/
bool R_UsePixelatedLook();
bool R_UseTemporalAA();
uint R_GetMSAASamples();

View file

@ -623,7 +623,6 @@ void idRenderProgManager::Init( nvrhi::IDevice* device )
}
}
r_usePBR.ClearModified();
r_pbrDebug.ClearModified();
uniforms.SetNum( RENDERPARM_TOTAL, vec4_zero );

View file

@ -171,9 +171,6 @@ idCVar r_flareSize( "r_flareSize", "1", CVAR_RENDERER | CVAR_FLOAT, "scale the f
idCVar r_useScissor( "r_useScissor", "1", CVAR_RENDERER | CVAR_BOOL, "scissor clip as portals and lights are processed" );
idCVar r_useLightDepthBounds( "r_useLightDepthBounds", "1", CVAR_RENDERER | CVAR_BOOL, "use depth bounds test on lights to reduce both shadow and interaction fill" );
idCVar r_useShadowDepthBounds( "r_useShadowDepthBounds", "1", CVAR_RENDERER | CVAR_BOOL, "use depth bounds test on individual shadow volumes to reduce shadow fill" );
// RB begin
idCVar r_useHalfLambertLighting( "r_useHalfLambertLighting", "0", CVAR_RENDERER | CVAR_BOOL | CVAR_ARCHIVE, "use Half-Lambert lighting instead of classic Lambert, requires reloadShaders" );
// RB end
idCVar r_screenFraction( "r_screenFraction", "100", CVAR_RENDERER | CVAR_INTEGER, "for testing fill rate, the resolution of the entire screen can be changed" );
idCVar r_usePortals( "r_usePortals", "1", CVAR_RENDERER | CVAR_BOOL, " 1 = use portals to perform area culling, otherwise draw everything" );
@ -285,8 +282,6 @@ idCVar r_ssaoDebug( "r_ssaoDebug", "0", CVAR_RENDERER | CVAR_INTEGER, "" );
idCVar r_ssaoFiltering( "r_ssaoFiltering", "0", CVAR_RENDERER | CVAR_BOOL, "" );
idCVar r_useHierarchicalDepthBuffer( "r_useHierarchicalDepthBuffer", "1", CVAR_RENDERER | CVAR_BOOL, "" );
// RB: only change r_usePBR if you are a developer
idCVar r_usePBR( "r_usePBR", "1", CVAR_RENDERER | CVAR_ROM | CVAR_STATIC | CVAR_BOOL, "use PBR and Image Based Lighting instead of old Quake 4 style ambient lighting" );
idCVar r_pbrDebug( "r_pbrDebug", "0", CVAR_RENDERER | CVAR_INTEGER, "show which materials have PBR support (green = PBR, red = oldschool D3)" );
idCVar r_showViewEnvprobes( "r_showViewEnvprobes", "0", CVAR_RENDERER | CVAR_INTEGER, "1 = displays the bounding boxes of all view environment probes, 2 = show irradiance" );
idCVar r_showLightGrid( "r_showLightGrid", "0", CVAR_RENDERER | CVAR_INTEGER, "show Quake 3 style light grid points" );
@ -317,6 +312,11 @@ const char* skyDirection[6] = { "_forward", "_back", "_left", "_right", "_up", "
DeviceManager* deviceManager = NULL;
bool R_UsePixelatedLook()
{
return ( r_renderMode.GetInteger() == RENDERMODE_PSX ) || image_pixelLook.GetBool();
}
bool R_UseTemporalAA()
{
if( !r_useTemporalAA.GetBool() )

View file

@ -145,15 +145,15 @@ float3 BinarySearch( float3 target, float3 pal[NUM_COLORS] )
void main( PS_IN fragment, out PS_OUT result )
{
float2 uv = ( fragment.texcoord0 );
float2 uvPixellated = floor( fragment.position.xy / RESOLUTION_DIVISOR ) * RESOLUTION_DIVISOR;
float2 uvPixelated = floor( fragment.position.xy / RESOLUTION_DIVISOR ) * RESOLUTION_DIVISOR;
float3 quantizationPeriod = _float3( 1.0 / NUM_COLORS );
// get pixellated base color
float3 color = t_BaseColor.Sample( samp0, uvPixellated * rpWindowCoord.xy ).rgb;
float3 color = t_BaseColor.Sample( samp0, uvPixelated * rpWindowCoord.xy ).rgb;
// add Bayer 8x8 dithering
float2 uvDither = uvPixellated;
float2 uvDither = uvPixelated;
//if( rpJitterTexScale.x > 1.0 )
{
uvDither = fragment.position.xy / ( RESOLUTION_DIVISOR / rpJitterTexScale.x );

View file

@ -104,7 +104,7 @@ float3 LinearSearch( float3 c, float3 pal[NUM_COLORS] )
void main( PS_IN fragment, out PS_OUT result )
{
float2 uv = ( fragment.texcoord0 );
float2 uvPixellated = floor( fragment.position.xy / RESOLUTION_DIVISOR ) * RESOLUTION_DIVISOR;
float2 uvPixelated = 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
@ -116,13 +116,13 @@ void main( PS_IN fragment, out PS_OUT result )
float3 quantizationPeriod = _float3( 1.0 / ( quantizationSteps - 1 ) );
// get pixellated base color
float3 color = t_BaseColor.Sample( samp0, uvPixellated * rpWindowCoord.xy ).rgb;
float3 color = t_BaseColor.Sample( samp0, uvPixelated * rpWindowCoord.xy ).rgb;
//color = _float3( uv.x );
//color = Quantize( color, quantizationPeriod );
// add Bayer 8x8 dithering
float2 uvDither = uvPixellated;
float2 uvDither = uvPixelated;
//if( rpJitterTexScale.x > 1.0 )
{
uvDither = fragment.position.xy / ( RESOLUTION_DIVISOR / rpJitterTexScale.x );

View file

@ -64,7 +64,7 @@ float3 Quantize( float3 color, float3 period )
void main( PS_IN fragment, out PS_OUT result )
{
float2 uv = ( fragment.texcoord0 );
float2 uvPixellated = floor( fragment.position.xy / RESOLUTION_DIVISOR ) * RESOLUTION_DIVISOR;
float2 uvPixelated = floor( fragment.position.xy / RESOLUTION_DIVISOR ) * RESOLUTION_DIVISOR;
// most Sony Playstation 1 titles used 5 bit per RGB channel
// 2^5 = 32
@ -74,7 +74,7 @@ void main( PS_IN fragment, out PS_OUT result )
float3 quantizationPeriod = _float3( 1.0 / ( quantizationSteps - 1 ) );
// get pixellated base color
float3 color = t_BaseColor.Sample( samp0, uvPixellated * rpWindowCoord.xy ).rgb;
float3 color = t_BaseColor.Sample( samp0, uvPixelated * rpWindowCoord.xy ).rgb;
// add Bayer 8x8 dithering
float2 uvDither = fragment.position.xy / RESOLUTION_DIVISOR;