mirror of
https://github.com/id-Software/DOOM-3-BFG.git
synced 2025-03-15 07:00:58 +00:00
Updated embedded shaders
This commit is contained in:
parent
c158a16a93
commit
facc23d956
1 changed files with 31 additions and 18 deletions
|
@ -17,7 +17,7 @@ static const cgShaderDef_t cg_renderprogs[] =
|
|||
"\n"
|
||||
"Doom 3 BFG Edition GPL Source Code\n"
|
||||
"Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. \n"
|
||||
"Copyright (C) 2013-2014 Robert Beckebans\n"
|
||||
"Copyright (C) 2013-2016 Robert Beckebans\n"
|
||||
"\n"
|
||||
"This file is part of the Doom 3 BFG Edition GPL Source Code (\"Doom 3 BFG Edition Source Code\"). \n"
|
||||
"\n"
|
||||
|
@ -147,7 +147,7 @@ static const cgShaderDef_t cg_renderprogs[] =
|
|||
"\n"
|
||||
"half3 sRGBToLinearRGB( half3 rgb )\n"
|
||||
"{\n"
|
||||
"#if defined(USE_LINEAR_RGB)\n"
|
||||
"#if defined( USE_LINEAR_RGB ) && !defined( USE_SRGB )\n"
|
||||
" return max( pow( rgb, half3( 2.2 ) ), half3( 0.0 ) );\n"
|
||||
"#else\n"
|
||||
" return rgb;\n"
|
||||
|
@ -156,7 +156,7 @@ static const cgShaderDef_t cg_renderprogs[] =
|
|||
"\n"
|
||||
"half4 sRGBAToLinearRGBA( half4 rgba )\n"
|
||||
"{\n"
|
||||
"#if defined(USE_LINEAR_RGB)\n"
|
||||
"#if defined( USE_LINEAR_RGB ) && !defined( USE_SRGB )\n"
|
||||
" return float4( max( pow( rgba.rgb, half3( 2.2 ) ), half3( 0.0 ) ), rgba.a );\n"
|
||||
"#else\n"
|
||||
" return rgba;\n"
|
||||
|
@ -165,7 +165,7 @@ static const cgShaderDef_t cg_renderprogs[] =
|
|||
"\n"
|
||||
"half3 LinearRGBToSRGB( half3 rgb )\n"
|
||||
"{\n"
|
||||
"#if defined(USE_LINEAR_RGB)\n"
|
||||
"#if defined( USE_LINEAR_RGB ) && !defined( USE_SRGB )\n"
|
||||
" return pow( rgb, half3( 1.0 ) / half3( 2.2 ) );\n"
|
||||
"#else\n"
|
||||
" return rgb;\n"
|
||||
|
@ -174,7 +174,7 @@ static const cgShaderDef_t cg_renderprogs[] =
|
|||
"\n"
|
||||
"half4 LinearRGBToSRGB( half4 rgba )\n"
|
||||
"{\n"
|
||||
"#if defined(USE_LINEAR_RGB)\n"
|
||||
"#if defined( USE_LINEAR_RGB ) && !defined( USE_SRGB )\n"
|
||||
" rgba.rgb = pow( rgba.rgb, half3( 1.0 ) / half3( 2.2 ) );\n"
|
||||
" return rgba; //pow( rgba, half4( 1.0 ) / half4( 2.2 ) );\n"
|
||||
"#else\n"
|
||||
|
@ -241,11 +241,9 @@ static const cgShaderDef_t cg_renderprogs[] =
|
|||
"\n"
|
||||
"#define square( x ) ( x * x )\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"static const half4 LUMINANCE_VECTOR = half4( 0.2125, 0.7154, 0.0721, 0.0 );\n"
|
||||
"\n"
|
||||
"static const half4 LUMINANCE_SRGB = half4( 0.2125, 0.7154, 0.0721, 0.0 );\n"
|
||||
"static const half4 LUMINANCE_LINEAR = half4( 0.299, 0.587, 0.144, 0.0 );\n"
|
||||
"\n"
|
||||
"#define _half2( x ) half2( x )\n"
|
||||
"#define _half3( x ) half3( x )\n"
|
||||
"#define _half4( x ) half4( x )\n"
|
||||
|
@ -4113,7 +4111,7 @@ static const cgShaderDef_t cg_renderprogs[] =
|
|||
"\n"
|
||||
" float4 envMap = texCUBE( samp0, reflectionVector );\n"
|
||||
"\n"
|
||||
" result.color = float4( envMap.xyz, 1.0f ) * fragment.color;\n"
|
||||
" result.color = float4( sRGBToLinearRGB( envMap.xyz ), 1.0f ) * fragment.color;\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
|
||||
|
@ -4280,7 +4278,7 @@ static const cgShaderDef_t cg_renderprogs[] =
|
|||
"\n"
|
||||
" float4 envMap = texCUBE( samp0, reflectionVector );\n"
|
||||
"\n"
|
||||
" result.color = float4( envMap.xyz, 1.0f ) * fragment.color;\n"
|
||||
" result.color = float4( sRGBToLinearRGB( envMap.xyz ), 1.0f ) * fragment.color;\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
|
||||
|
@ -6279,7 +6277,7 @@ static const cgShaderDef_t cg_renderprogs[] =
|
|||
"\n"
|
||||
" float4 envMap = texCUBE( samp0, reflectionVector );\n"
|
||||
"\n"
|
||||
" result.color = float4( envMap.xyz, 1.0f ) * fragment.color;\n"
|
||||
" result.color = float4( sRGBToLinearRGB( envMap.xyz ), 1.0f ) * fragment.color;\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
|
||||
|
@ -6406,7 +6404,7 @@ static const cgShaderDef_t cg_renderprogs[] =
|
|||
"\n"
|
||||
" float4 envMap = texCUBE( samp0, reflectionVector );\n"
|
||||
"\n"
|
||||
" result.color = float4( envMap.xyz, 1.0f ) * fragment.color;\n"
|
||||
" result.color = float4( sRGBToLinearRGB( envMap.xyz ), 1.0f ) * fragment.color;\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
|
||||
|
@ -8128,7 +8126,7 @@ static const cgShaderDef_t cg_renderprogs[] =
|
|||
"\n"
|
||||
"\n"
|
||||
" half3 halfAngleVector = normalize( lightVector + viewVector );\n"
|
||||
" half hdotN = saturate( dot3( halfAngleVector, localNormal ) );\n"
|
||||
" half hdotN = clamp( dot3( halfAngleVector, localNormal ), 0.0, 1.0 );\n"
|
||||
"\n"
|
||||
"#if 0 //defined(USE_PBR)\n"
|
||||
" \n"
|
||||
|
@ -8185,7 +8183,7 @@ static const cgShaderDef_t cg_renderprogs[] =
|
|||
" // disney GGX\n"
|
||||
" float D = ( hdotN * hdotN ) * ( rrrr - 1.0 ) + 1.0;\n"
|
||||
" float VFapprox = ( ldotH * ldotH ) * ( roughness + 0.5 );\n"
|
||||
" half3 specularBRDF = ( rrrr / ( 4.0 * PI * D * D * VFapprox ) ) * reflectColor;\n"
|
||||
" half3 specularBRDF = ( rrrr / ( 4.0 * PI * D * D * VFapprox ) ) * ldotN * reflectColor;\n"
|
||||
" //specularBRDF = half3( 0.0 );\n"
|
||||
" \n"
|
||||
"#if 0\n"
|
||||
|
@ -9270,7 +9268,7 @@ static const cgShaderDef_t cg_renderprogs[] =
|
|||
" // disney GGX\n"
|
||||
" float D = ( hdotN * hdotN ) * ( rrrr - 1.0 ) + 1.0;\n"
|
||||
" float VFapprox = ( ldotH * ldotH ) * ( roughness + 0.5 );\n"
|
||||
" half3 specularBRDF = ( rrrr / ( 4.0 * PI * D * D * VFapprox ) ) * reflectColor;\n"
|
||||
" half3 specularBRDF = ( rrrr / ( 4.0 * PI * D * D * VFapprox ) ) * ldotN * reflectColor;\n"
|
||||
" //specularBRDF = half3( 0.0 );\n"
|
||||
" \n"
|
||||
"#if 0\n"
|
||||
|
@ -10663,7 +10661,7 @@ static const cgShaderDef_t cg_renderprogs[] =
|
|||
"};\n"
|
||||
"\n"
|
||||
"void main( PS_IN fragment, out PS_OUT result ) {\n"
|
||||
" result.color = texCUBE( samp0, fragment.texcoord0 ) * fragment.color;\n"
|
||||
" result.color = sRGBAToLinearRGBA( texCUBE( samp0, fragment.texcoord0 ) ) * fragment.color;\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
|
||||
|
@ -12193,6 +12191,20 @@ static const cgShaderDef_t cg_renderprogs[] =
|
|||
"#elif OPERATOR == 2\n"
|
||||
"\n"
|
||||
" // can be in range [-4.0 .. 4.0]\n"
|
||||
" //float exposureOffset = rpScreenCorrectionFactor.w;\n"
|
||||
" \n"
|
||||
" float avgLuminance = max( hdrAverageLuminance, 0.001 );\n"
|
||||
" float linearExposure = ( hdrKey / avgLuminance );\n"
|
||||
" float exposure = log2( max( linearExposure, 0.0001 ) );\n"
|
||||
" \n"
|
||||
" //exposure = -2.0;\n"
|
||||
" float3 exposedColor = exp2( exposure ) * color.rgb;\n"
|
||||
" \n"
|
||||
" color.rgb = ACESFilm( exposedColor );\n"
|
||||
" \n"
|
||||
"#elif OPERATOR == 3\n"
|
||||
"\n"
|
||||
" // can be in range [-4.0 .. 4.0]\n"
|
||||
" float exposure = rpScreenCorrectionFactor.w;\n"
|
||||
" \n"
|
||||
" // exposure curves ranges from 0.0625 to 16.0\n"
|
||||
|
@ -12203,7 +12215,8 @@ static const cgShaderDef_t cg_renderprogs[] =
|
|||
" \n"
|
||||
" float3 whiteScale = 1.0 / ACESFilm( float3( Ymax ) );\n"
|
||||
" color.rgb = curr * whiteScale;\n"
|
||||
"#elif OPERATOR == 3\n"
|
||||
" \n"
|
||||
"#elif OPERATOR == 4\n"
|
||||
" // Uncharted 2 tone mapping based on Kodak film curve\n"
|
||||
"\n"
|
||||
" //float exposure = ( hdrKey / hdrAverageLuminance ) * 0.2;\n"
|
||||
|
@ -12472,7 +12485,7 @@ static const cgShaderDef_t cg_renderprogs[] =
|
|||
"};\n"
|
||||
"\n"
|
||||
"void main( PS_IN fragment, out PS_OUT result ) {\n"
|
||||
" result.color = texCUBE( samp0, fragment.texcoord0 ) * fragment.color;\n"
|
||||
" result.color = sRGBAToLinearRGBA( texCUBE( samp0, fragment.texcoord0 ) ) * fragment.color;\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
|
||||
|
|
Loading…
Reference in a new issue