mirror of
https://github.com/id-Software/DOOM-3-BFG.git
synced 2025-04-24 02:32:18 +00:00
Use Astyle to format all HLSL renderprogs from now on
This commit is contained in:
parent
caa9258289
commit
d198ec5139
119 changed files with 2036 additions and 1630 deletions
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
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").
|
||||
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
|
||||
|
@ -28,6 +28,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#include "global.inc.hlsl"
|
||||
|
||||
// *INDENT-OFF*
|
||||
struct VS_IN
|
||||
{
|
||||
float4 position : POSITION;
|
||||
|
@ -39,6 +40,7 @@ struct VS_OUT
|
|||
float4 position : POSITION;
|
||||
float2 texcoord0 : TEXCOORD0;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
void main( VS_IN vertex, out VS_OUT result )
|
||||
{
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
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").
|
||||
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
|
||||
|
@ -28,6 +28,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#include "global.inc.hlsl"
|
||||
|
||||
// *INDENT-OFF*
|
||||
struct VS_IN
|
||||
{
|
||||
float4 position : POSITION;
|
||||
|
@ -39,6 +40,7 @@ struct VS_OUT
|
|||
float4 position : POSITION;
|
||||
float2 texcoord0 : TEXCOORD0;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
void main( VS_IN vertex, out VS_OUT result )
|
||||
{
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
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").
|
||||
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
|
||||
|
@ -28,6 +28,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#include "global.inc.hlsl"
|
||||
|
||||
// *INDENT-OFF*
|
||||
struct VS_IN
|
||||
{
|
||||
float4 position : POSITION;
|
||||
|
@ -39,6 +40,7 @@ struct VS_OUT
|
|||
float4 position : POSITION;
|
||||
float2 texcoord0 : TEXCOORD0;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
void main( VS_IN vertex, out VS_OUT result )
|
||||
{
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 2014-2020 Robert Beckebans
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
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
|
||||
|
@ -34,7 +34,7 @@ half Distribution_GGX( half hdotN, half alpha )
|
|||
float a2 = alpha * alpha;
|
||||
//float tmp = ( hdotN * hdotN ) * ( a2 - 1.0 ) + 1.0;
|
||||
float tmp = ( hdotN * a2 - hdotN ) * hdotN + 1.0;
|
||||
|
||||
|
||||
return ( a2 / ( PI * tmp * tmp ) );
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,7 @@ half Distribution_GGX_Disney( half hdotN, half alphaG )
|
|||
float a2 = alphaG * alphaG;
|
||||
float tmp = ( hdotN * hdotN ) * ( a2 - 1.0 ) + 1.0;
|
||||
//tmp *= tmp;
|
||||
|
||||
|
||||
return ( a2 / ( PI * tmp ) );
|
||||
}
|
||||
|
||||
|
@ -71,7 +71,7 @@ half3 Fresnel_SchlickRoughness( half3 specularColor, half vDotN, half roughness
|
|||
// See Sébastien Lagarde and Charles de Rousiers. 2014. Moving Frostbite to PBR.
|
||||
float ComputeSpecularAO( float vDotN, float ao, float roughness )
|
||||
{
|
||||
return clamp( pow( vDotN + ao, exp2( -16.0 * roughness - 1.0) ) - 1.0 + ao, 0.0, 1.0 );
|
||||
return clamp( pow( vDotN + ao, exp2( -16.0 * roughness - 1.0 ) ) - 1.0 + ao, 0.0, 1.0 );
|
||||
}
|
||||
|
||||
// Visibility term G( l, v, h )
|
||||
|
@ -79,10 +79,10 @@ float ComputeSpecularAO( float vDotN, float ao, float roughness )
|
|||
float Visibility_Schlick( half vdotN, half ldotN, float alpha )
|
||||
{
|
||||
float k = alpha * 0.5;
|
||||
|
||||
|
||||
float schlickL = ( ldotN * ( 1.0 - k ) + k );
|
||||
float schlickV = ( vdotN * ( 1.0 - k ) + k );
|
||||
|
||||
|
||||
return ( 0.25 / ( schlickL * schlickV ) );
|
||||
//return ( ( schlickL * schlickV ) / ( 4.0 * vdotN * ldotN ) );
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ float Visibility_SmithGGX( half vdotN, half ldotN, float alpha )
|
|||
|
||||
float V1 = ldotN + sqrt( alpha + ( 1.0 - alpha ) * ldotN * ldotN );
|
||||
float V2 = vdotN + sqrt( alpha + ( 1.0 - alpha ) * vdotN * vdotN );
|
||||
|
||||
|
||||
// RB: avoid too bright spots
|
||||
return ( 1.0 / max( V1 * V2, 0.15 ) );
|
||||
}
|
||||
|
@ -127,7 +127,7 @@ float3 EnvironmentBRDF( half g, half vdotN, float3 rf0 )
|
|||
t += float4( 0.0, 0.0, ( 0.015 - 0.75 * 0.04 ) / 0.96, 0.75 );
|
||||
half a0 = t.x * min( t.y, exp2( -9.28 * vdotN ) ) + t.z;
|
||||
half a1 = t.w;
|
||||
|
||||
|
||||
return saturate( a0 + rf0 * ( a1 - a0 ) );
|
||||
}
|
||||
|
||||
|
|
|
@ -22,16 +22,16 @@
|
|||
uniform sampler2D samp0 : register( s0 ); // view normals
|
||||
uniform sampler2D samp1 : register( s1 ); // view depth
|
||||
uniform sampler2D samp2 : register( s2 ); // view AO
|
||||
|
||||
|
||||
#define normal_buffer samp0
|
||||
#define cszBuffer samp1
|
||||
#define source samp2
|
||||
|
||||
|
||||
struct PS_IN
|
||||
{
|
||||
float2 texcoord0 : TEXCOORD0_centroid;
|
||||
};
|
||||
|
||||
|
||||
struct PS_OUT
|
||||
{
|
||||
float4 color : COLOR;
|
||||
|
@ -87,7 +87,7 @@ struct PS_OUT
|
|||
//uniform int2 axis;
|
||||
|
||||
#if USE_OCT16
|
||||
#include <oct.glsl>
|
||||
#include <oct.glsl>
|
||||
#endif
|
||||
|
||||
float3 sampleNormal( sampler2D normalBuffer, int2 ssC, int mipLevel )
|
||||
|
@ -113,10 +113,10 @@ float CSZToKey( float z )
|
|||
float reconstructCSZ( float d )
|
||||
{
|
||||
//return clipInfo[0] / (clipInfo[1] * d + clipInfo[2]);
|
||||
|
||||
|
||||
// infinite far perspective matrix
|
||||
return -3.0 / ( -1.0 * d + 1.0 );
|
||||
|
||||
|
||||
//d = d * 2.0 - 1.0;
|
||||
//return -rpProjectionMatrixZ.w / ( -rpProjectionMatrixZ.z - d );
|
||||
}
|
||||
|
@ -127,15 +127,15 @@ float3 reconstructCSPosition( float2 S, float z )
|
|||
P.z = z * 2.0 - 1.0;
|
||||
P.xy = ( S * rpScreenCorrectionFactor.xy ) * 2.0 - 1.0;
|
||||
P.w = 1.0;
|
||||
|
||||
|
||||
float4 csP;
|
||||
csP.x = dot4( P, rpModelMatrixX );
|
||||
csP.y = dot4( P, rpModelMatrixY );
|
||||
csP.z = dot4( P, rpModelMatrixZ );
|
||||
csP.w = dot4( P, rpModelMatrixW );
|
||||
|
||||
|
||||
csP.xyz /= csP.w;
|
||||
|
||||
|
||||
return csP.xyz;
|
||||
}
|
||||
|
||||
|
@ -153,7 +153,7 @@ float getKey( int2 ssP )
|
|||
float3 P = reconstructCSPosition( float2( ssP ) + float2( 0.5 ), key );
|
||||
key = P.z;
|
||||
#endif
|
||||
|
||||
|
||||
key = clamp( key * ( 1.0 / FAR_PLANE_Z ), 0.0, 1.0 );
|
||||
return key;
|
||||
}
|
||||
|
@ -170,10 +170,10 @@ float3 getPosition( int2 ssP, sampler2D cszBuffer )
|
|||
{
|
||||
float3 P;
|
||||
P.z = texelFetch( cszBuffer, ssP, 0 ).r;
|
||||
|
||||
|
||||
// Offset to pixel center
|
||||
P = reconstructCSPosition( float2( ssP ) + float2( 0.5 ), P.z );
|
||||
|
||||
|
||||
return P;
|
||||
}
|
||||
|
||||
|
@ -181,43 +181,43 @@ float calculateBilateralWeight( float key, float tapKey, int2 tapLoc, float3 n_C
|
|||
{
|
||||
// range domain (the "bilateral" weight). As depth difference increases, decrease weight.
|
||||
float depthWeight = max( 0.0, 1.0 - ( EDGE_SHARPNESS * 2000.0 ) * abs( tapKey - key ) );
|
||||
|
||||
|
||||
float k_normal = 1.0; //40.0;
|
||||
float k_plane = 1.0; //0.5;
|
||||
|
||||
|
||||
// Prevents blending over creases.
|
||||
float normalWeight = 1.0; //1000.0;
|
||||
float planeWeight = 1.0;
|
||||
|
||||
|
||||
#if USE_NORMALS
|
||||
float3 tapN_C = sampleNormal( normal_buffer, tapLoc, 0 );
|
||||
depthWeight = 1.0;
|
||||
|
||||
|
||||
float normalError = ( 1.0 - dot( tapN_C, n_C ) ) * k_normal;
|
||||
normalWeight = max( 1.0 - EDGE_SHARPNESS * normalError, 0.00 );
|
||||
|
||||
|
||||
|
||||
|
||||
float lowDistanceThreshold2 = 0.001; //0.01;
|
||||
|
||||
|
||||
//float3 tapC = positionFromKey( tapKey, tapLoc, projInfo );
|
||||
float3 tapC = getPosition( tapLoc, cszBuffer );
|
||||
|
||||
|
||||
// Change in position in camera space
|
||||
float3 dq = C - tapC;
|
||||
|
||||
|
||||
// How far away is this point from the original sample
|
||||
// in camera space? (Max value is unbounded)
|
||||
float distance2 = dot( dq, dq );
|
||||
|
||||
|
||||
// How far off the expected plane (on the perpendicular) is this point? Max value is unbounded.
|
||||
float planeError = max( abs( dot( dq, tapN_C ) ), abs( dot( dq, n_C ) ) );
|
||||
|
||||
|
||||
planeWeight = ( distance2 < lowDistanceThreshold2 ) ? 1.0 :
|
||||
pow( max( 0.0, 1.0 - EDGE_SHARPNESS * 2.0 * k_plane * planeError / sqrt( distance2 ) ), 2.0 );
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
return depthWeight * normalWeight * planeWeight;
|
||||
}
|
||||
|
||||
|
@ -264,11 +264,11 @@ void main( PS_IN fragment, out PS_OUT result )
|
|||
kernel[6] = 0.036108;
|
||||
#endif
|
||||
//#endif
|
||||
|
||||
|
||||
int2 ssC = int2( gl_FragCoord.xy );
|
||||
|
||||
|
||||
float4 temp = texelFetch( source, ssC, 0 );
|
||||
|
||||
|
||||
#if 0
|
||||
if( fragment.texcoord0.x < 0.75 )
|
||||
{
|
||||
|
@ -276,7 +276,7 @@ void main( PS_IN fragment, out PS_OUT result )
|
|||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if 0
|
||||
float key = getKey( ssC );
|
||||
float3 C = positionFromKey( key, ssC );
|
||||
|
@ -284,27 +284,27 @@ void main( PS_IN fragment, out PS_OUT result )
|
|||
float3 C = getPosition( ssC, cszBuffer );
|
||||
float key = CSZToKey( C.z );
|
||||
#endif
|
||||
|
||||
|
||||
VALUE_TYPE sum = temp.VALUE_COMPONENTS;
|
||||
|
||||
|
||||
if( key == 1.0 )
|
||||
{
|
||||
// Sky pixel (if you aren't using depth keying, disable this test)
|
||||
blurResult = sum;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Base weight for falloff. Increase this for more blurriness,
|
||||
// decrease it for better edge discrimination
|
||||
float BASE = kernel[0];
|
||||
float totalWeight = BASE;
|
||||
sum *= totalWeight;
|
||||
|
||||
|
||||
float3 n_C;
|
||||
#if USE_NORMALS
|
||||
n_C = sampleNormal( normal_buffer, ssC, 0 );
|
||||
#endif
|
||||
|
||||
|
||||
#if MDB_WEIGHTS == 0
|
||||
for( int r = -R; r <= R; ++r )
|
||||
{
|
||||
|
@ -314,35 +314,35 @@ void main( PS_IN fragment, out PS_OUT result )
|
|||
{
|
||||
int2 tapLoc = ssC + int2( rpJitterTexScale.xy ) * ( r * SCALE );
|
||||
temp = texelFetch( source, tapLoc, 0 );
|
||||
|
||||
|
||||
|
||||
|
||||
float tapKey = getKey( tapLoc );
|
||||
VALUE_TYPE value = temp.VALUE_COMPONENTS;
|
||||
|
||||
|
||||
// spatial domain: offset kernel tap
|
||||
float weight = 0.3 + kernel[abs( r )];
|
||||
|
||||
|
||||
float bilateralWeight = calculateBilateralWeight( key, tapKey, tapLoc, n_C, C );
|
||||
|
||||
|
||||
weight *= bilateralWeight;
|
||||
sum += value * weight;
|
||||
totalWeight += weight;
|
||||
}
|
||||
}
|
||||
#else
|
||||
|
||||
|
||||
float lastBilateralWeight = 9999.0;
|
||||
for( int r = -1; r >= -R; --r )
|
||||
{
|
||||
int2 tapLoc = ssC + int2( rpJitterTexScale.xy ) * ( r * SCALE );
|
||||
temp = texelFetch( source, tapLoc, 0 );
|
||||
float tapKey = getKey( tapLoc );
|
||||
|
||||
|
||||
VALUE_TYPE value = temp.VALUE_COMPONENTS;
|
||||
|
||||
|
||||
// spatial domain: offset kernel tap
|
||||
float weight = 0.3 + kernel[abs( r )];
|
||||
|
||||
|
||||
// range domain (the "bilateral" weight). As depth difference increases, decrease weight.
|
||||
float bilateralWeight = calculateBilateralWeight( key, tapKey, tapLoc, n_C, C );
|
||||
bilateralWeight = min( lastBilateralWeight, bilateralWeight );
|
||||
|
@ -351,7 +351,7 @@ void main( PS_IN fragment, out PS_OUT result )
|
|||
sum += value * weight;
|
||||
totalWeight += weight;
|
||||
}
|
||||
|
||||
|
||||
lastBilateralWeight = 9999.0;
|
||||
for( int r = 1; r <= R; ++r )
|
||||
{
|
||||
|
@ -359,10 +359,10 @@ void main( PS_IN fragment, out PS_OUT result )
|
|||
temp = texelFetch( source, tapLoc, 0 );
|
||||
float tapKey = getKey( tapLoc );
|
||||
VALUE_TYPE value = temp.VALUE_COMPONENTS;
|
||||
|
||||
|
||||
// spatial domain: offset kernel tap
|
||||
float weight = 0.3 + kernel[abs( r )];
|
||||
|
||||
|
||||
// range domain (the "bilateral" weight). As depth difference increases, decrease weight.
|
||||
float bilateralWeight = calculateBilateralWeight( key, tapKey, tapLoc, n_C, C );
|
||||
bilateralWeight = min( lastBilateralWeight, bilateralWeight );
|
||||
|
@ -372,7 +372,7 @@ void main( PS_IN fragment, out PS_OUT result )
|
|||
totalWeight += weight;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
const float epsilon = 0.0001;
|
||||
blurResult = sum / ( totalWeight + epsilon );
|
||||
}
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
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").
|
||||
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
|
||||
|
@ -28,6 +28,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#include "global.inc.hlsl"
|
||||
|
||||
// *INDENT-OFF*
|
||||
struct VS_IN
|
||||
{
|
||||
float4 position : POSITION;
|
||||
|
@ -39,6 +40,7 @@ struct VS_OUT
|
|||
float4 position : POSITION;
|
||||
float2 texcoord0 : TEXCOORD0;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
void main( VS_IN vertex, out VS_OUT result )
|
||||
{
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
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").
|
||||
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
|
||||
|
@ -28,6 +28,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#include "global.inc.hlsl"
|
||||
|
||||
// *INDENT-OFF*
|
||||
struct VS_IN
|
||||
{
|
||||
float4 position : POSITION;
|
||||
|
@ -39,6 +40,7 @@ struct VS_OUT
|
|||
float4 position : POSITION;
|
||||
float2 texcoord0 : TEXCOORD0;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
void main( VS_IN vertex, out VS_OUT result )
|
||||
{
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -38,7 +38,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
uniform sampler2D samp0 : register(s0); // _smaaEdges
|
||||
uniform sampler2D samp1 : register(s1); // _smaaArea
|
||||
uniform sampler2D samp2 : register(s2); // _smaaSearch
|
||||
|
||||
|
||||
struct PS_IN
|
||||
{
|
||||
float4 position : VPOS;
|
||||
|
@ -48,7 +48,7 @@ struct PS_IN
|
|||
float4 texcoord3 : TEXCOORD3_centroid;
|
||||
float4 texcoord4 : TEXCOORD4_centroid;
|
||||
};
|
||||
|
||||
|
||||
struct PS_OUT
|
||||
{
|
||||
float4 color : COLOR;
|
||||
|
@ -59,25 +59,25 @@ struct PS_OUT
|
|||
void main( PS_IN fragment, out PS_OUT result )
|
||||
{
|
||||
float2 texcoord = fragment.texcoord0;
|
||||
|
||||
|
||||
float4 offset[3];
|
||||
offset[0] = fragment.texcoord1;
|
||||
offset[1] = fragment.texcoord2;
|
||||
offset[2] = fragment.texcoord3;
|
||||
|
||||
float2 pixcoord = fragment.texcoord4.st;
|
||||
|
||||
|
||||
// TODO
|
||||
//float4 subsampleIndices = float4( 1.0, 1.0, 1.0, 0.0 );
|
||||
float4 subsampleIndices = float4( 0.0, 0.0, 0.0, 0.0 );
|
||||
|
||||
|
||||
float4 color = SMAABlendingWeightCalculationPS( texcoord,
|
||||
pixcoord,
|
||||
offset,
|
||||
samp0,
|
||||
samp1,
|
||||
samp2,
|
||||
subsampleIndices );
|
||||
pixcoord,
|
||||
offset,
|
||||
samp0,
|
||||
samp1,
|
||||
samp2,
|
||||
subsampleIndices );
|
||||
|
||||
//color = float4( texcoord.s, texcoord.t, 0.0, 1.0 );
|
||||
result.color = color;
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 2015 Robert Beckebans
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
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
|
||||
|
@ -33,6 +33,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#define SMAA_INCLUDE_PS 0
|
||||
#include "SMAA.inc.hlsl"
|
||||
|
||||
// *INDENT-OFF*
|
||||
struct VS_IN
|
||||
{
|
||||
float4 position : POSITION;
|
||||
|
@ -51,6 +52,7 @@ struct VS_OUT
|
|||
float4 texcoord3 : TEXCOORD3;
|
||||
float4 texcoord4 : TEXCOORD4;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
void main( VS_IN vertex, out VS_OUT result )
|
||||
{
|
||||
|
@ -63,7 +65,7 @@ void main( VS_IN vertex, out VS_OUT result )
|
|||
float4 offset[3];
|
||||
float2 pixcoord;
|
||||
SMAABlendingWeightCalculationVS( texcoord, pixcoord, offset );
|
||||
|
||||
|
||||
result.texcoord1 = offset[0];
|
||||
result.texcoord2 = offset[1];
|
||||
result.texcoord3 = offset[2];
|
||||
|
|
|
@ -36,7 +36,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
// *INDENT-OFF*
|
||||
uniform sampler2D samp0 : register(s0); // _currentColor
|
||||
uniform sampler2D samp1 : register(s1); // TODO _predictColor
|
||||
|
||||
|
||||
struct PS_IN
|
||||
{
|
||||
float4 position : VPOS;
|
||||
|
@ -45,7 +45,7 @@ struct PS_IN
|
|||
float4 texcoord2 : TEXCOORD2_centroid;
|
||||
float4 texcoord3 : TEXCOORD3_centroid;
|
||||
};
|
||||
|
||||
|
||||
struct PS_OUT
|
||||
{
|
||||
float4 color : COLOR;
|
||||
|
@ -56,20 +56,20 @@ struct PS_OUT
|
|||
void main( PS_IN fragment, out PS_OUT result )
|
||||
{
|
||||
float2 tCoords = fragment.texcoord0;
|
||||
|
||||
|
||||
float4 offset[3];
|
||||
offset[0] = fragment.texcoord1;
|
||||
offset[1] = fragment.texcoord2;
|
||||
offset[2] = fragment.texcoord3;
|
||||
|
||||
|
||||
float4 color = float4( 0.0 );
|
||||
color.rg = SMAALumaEdgeDetectionPS( tCoords,
|
||||
offset,
|
||||
samp0
|
||||
#if SMAA_PREDICATION
|
||||
, samp1
|
||||
#endif
|
||||
);
|
||||
|
||||
offset,
|
||||
samp0
|
||||
#if SMAA_PREDICATION
|
||||
, samp1
|
||||
#endif
|
||||
);
|
||||
|
||||
result.color = color;
|
||||
}
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 2015 Robert Beckebans
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
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
|
||||
|
@ -33,6 +33,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#define SMAA_INCLUDE_PS 0
|
||||
#include "SMAA.inc.hlsl"
|
||||
|
||||
// *INDENT-OFF*
|
||||
struct VS_IN
|
||||
{
|
||||
float4 position : POSITION;
|
||||
|
@ -50,6 +51,7 @@ struct VS_OUT
|
|||
float4 texcoord2 : TEXCOORD2;
|
||||
float4 texcoord3 : TEXCOORD3;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
void main( VS_IN vertex, out VS_OUT result )
|
||||
{
|
||||
|
@ -57,12 +59,12 @@ void main( VS_IN vertex, out VS_OUT result )
|
|||
|
||||
float2 texcoord = vertex.texcoord;
|
||||
//float2 texcoord = float2( vertex.texcoord.s, 1.0 - vertex.texcoord.t );
|
||||
|
||||
|
||||
result.texcoord0 = texcoord;
|
||||
|
||||
float4 offset[3];
|
||||
SMAAEdgeDetectionVS( texcoord, offset );
|
||||
|
||||
|
||||
result.texcoord1 = offset[0];
|
||||
result.texcoord2 = offset[1];
|
||||
result.texcoord3 = offset[2];
|
||||
|
|
|
@ -37,14 +37,14 @@ If you have questions concerning this license or the applicable additional terms
|
|||
uniform sampler2D samp0 : register(s0); // _currentColor
|
||||
uniform sampler2D samp1 : register(s1); // _smaaBlend
|
||||
//uniform sampler2D samp2 : register(s1); // _velocity
|
||||
|
||||
|
||||
struct PS_IN
|
||||
{
|
||||
float4 position : VPOS;
|
||||
float2 texcoord0 : TEXCOORD0_centroid;
|
||||
float4 texcoord1 : TEXCOORD1_centroid;
|
||||
};
|
||||
|
||||
|
||||
struct PS_OUT
|
||||
{
|
||||
float4 color : COLOR;
|
||||
|
@ -55,18 +55,18 @@ struct PS_OUT
|
|||
void main( PS_IN fragment, out PS_OUT result )
|
||||
{
|
||||
float2 texcoord = fragment.texcoord0;
|
||||
|
||||
|
||||
float4 offset = fragment.texcoord1;
|
||||
|
||||
float4 color = SMAANeighborhoodBlendingPS(texcoord,
|
||||
offset,
|
||||
samp0,
|
||||
samp1
|
||||
#if SMAA_REPROJECTION
|
||||
, SMAATexture2D(velocityTex)
|
||||
#endif
|
||||
);
|
||||
|
||||
float4 color = SMAANeighborhoodBlendingPS( texcoord,
|
||||
offset,
|
||||
samp0,
|
||||
samp1
|
||||
#if SMAA_REPROJECTION
|
||||
, SMAATexture2D( velocityTex )
|
||||
#endif
|
||||
);
|
||||
|
||||
//color = tex2D( samp1, texcoord );
|
||||
//color = float4( samp1 );
|
||||
result.color = color;
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 2015 Robert Beckebans
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
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
|
||||
|
@ -33,6 +33,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#define SMAA_INCLUDE_PS 0
|
||||
#include "SMAA.inc.hlsl"
|
||||
|
||||
// *INDENT-OFF*
|
||||
struct VS_IN
|
||||
{
|
||||
float4 position : POSITION;
|
||||
|
@ -48,6 +49,7 @@ struct VS_OUT
|
|||
float2 texcoord0 : TEXCOORD0;
|
||||
float4 texcoord1 : TEXCOORD1;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
void main( VS_IN vertex, out VS_OUT result )
|
||||
{
|
||||
|
@ -57,6 +59,6 @@ void main( VS_IN vertex, out VS_OUT result )
|
|||
|
||||
float4 offset;
|
||||
SMAANeighborhoodBlendingVS( vertex.texcoord, offset );
|
||||
|
||||
|
||||
result.texcoord1 = offset;
|
||||
}
|
|
@ -2,10 +2,10 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 2013-2015 Robert Beckebans
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
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
|
||||
|
@ -29,6 +29,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#include "global.inc.hlsl"
|
||||
|
||||
// *INDENT-OFF*
|
||||
uniform sampler2D samp0 : register(s0); // texture 1 is the per-surface normal map
|
||||
uniform sampler2D samp1 : register(s1); // texture 3 is the per-surface specular or roughness/metallic/AO mixer map
|
||||
uniform sampler2D samp2 : register(s2); // texture 2 is the per-surface baseColor map
|
||||
|
@ -50,8 +51,10 @@ struct PS_IN {
|
|||
struct PS_OUT {
|
||||
half4 color : COLOR;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
void main( PS_IN fragment, out PS_OUT result ) {
|
||||
void main( PS_IN fragment, out PS_OUT result )
|
||||
{
|
||||
half4 bumpMap = tex2D( samp0, fragment.texcoord1.xy );
|
||||
// half4 lightFalloff = idtex2Dproj( samp1, fragment.texcoord2 );
|
||||
// half4 lightProj = idtex2Dproj( samp2, fragment.texcoord3 );
|
||||
|
@ -76,21 +79,21 @@ void main( PS_IN fragment, out PS_OUT result ) {
|
|||
half3 specularContribution = _half3( pow( abs( hDotN ), specularPower ) );
|
||||
|
||||
half3 diffuseColor = diffuseMap * ( rpDiffuseModifier.xyz ) * 1.5f;
|
||||
half3 specularColor = specMap.xyz * specularContribution * ( rpSpecularModifier.xyz );
|
||||
|
||||
half3 specularColor = specMap.xyz * specularContribution * ( rpSpecularModifier.xyz );
|
||||
|
||||
// RB: http://developer.valvesoftware.com/wiki/Half_Lambert
|
||||
float halfLdotN = dot3( localNormal, lightVector ) * 0.5 + 0.5;
|
||||
halfLdotN *= halfLdotN;
|
||||
|
||||
|
||||
// traditional very dark Lambert light model used in Doom 3
|
||||
float ldotN = dot3( localNormal, lightVector );
|
||||
|
||||
|
||||
half3 lightColor = sRGBToLinearRGB( rpAmbientColor.rgb );
|
||||
|
||||
|
||||
half rim = 1.0f - saturate( hDotN );
|
||||
half rimPower = 8.0;
|
||||
half3 rimColor = sRGBToLinearRGB( half3( 0.125 ) * 1.2 ) * lightColor * pow( rim, rimPower );
|
||||
|
||||
|
||||
//result.color.rgb = localNormal.xyz * 0.5 + 0.5;
|
||||
result.color.xyz = ( ( diffuseColor + specularColor ) * halfLdotN * lightColor + rimColor ) * fragment.color.rgb;
|
||||
//result.color = ( ( diffuseColor + specularColor ) * halfLdotN * lightColor + rimColor ) * fragment.color.rgba;
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 2013-2015 Robert Beckebans
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
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
|
||||
|
@ -33,6 +33,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
uniform matrices_ubo { float4 matrices[408]; };
|
||||
#endif
|
||||
|
||||
// *INDENT-OFF*
|
||||
struct VS_IN {
|
||||
float4 position : POSITION;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
|
@ -53,8 +54,10 @@ struct VS_OUT {
|
|||
float4 texcoord6 : TEXCOORD6;
|
||||
float4 color : COLOR0;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
void main( VS_IN vertex, out VS_OUT result ) {
|
||||
void main( VS_IN vertex, out VS_OUT result )
|
||||
{
|
||||
|
||||
float4 vNormal = vertex.normal * 2.0 - 1.0;
|
||||
float4 vTangent = vertex.tangent * 2.0 - 1.0;
|
||||
|
@ -72,25 +75,25 @@ void main( VS_IN vertex, out VS_OUT result ) {
|
|||
const float w3 = vertex.color2.w;
|
||||
|
||||
float4 matX, matY, matZ; // must be float4 for vec4
|
||||
int joint = int(vertex.color.x * 255.1 * 3.0);
|
||||
matX = matrices[int(joint+0)] * w0;
|
||||
matY = matrices[int(joint+1)] * w0;
|
||||
matZ = matrices[int(joint+2)] * w0;
|
||||
int joint = int( vertex.color.x * 255.1 * 3.0 );
|
||||
matX = matrices[int( joint + 0 )] * w0;
|
||||
matY = matrices[int( joint + 1 )] * w0;
|
||||
matZ = matrices[int( joint + 2 )] * w0;
|
||||
|
||||
joint = int(vertex.color.y * 255.1 * 3.0);
|
||||
matX += matrices[int(joint+0)] * w1;
|
||||
matY += matrices[int(joint+1)] * w1;
|
||||
matZ += matrices[int(joint+2)] * w1;
|
||||
joint = int( vertex.color.y * 255.1 * 3.0 );
|
||||
matX += matrices[int( joint + 0 )] * w1;
|
||||
matY += matrices[int( joint + 1 )] * w1;
|
||||
matZ += matrices[int( joint + 2 )] * w1;
|
||||
|
||||
joint = int(vertex.color.z * 255.1 * 3.0);
|
||||
matX += matrices[int(joint+0)] * w2;
|
||||
matY += matrices[int(joint+1)] * w2;
|
||||
matZ += matrices[int(joint+2)] * w2;
|
||||
joint = int( vertex.color.z * 255.1 * 3.0 );
|
||||
matX += matrices[int( joint + 0 )] * w2;
|
||||
matY += matrices[int( joint + 1 )] * w2;
|
||||
matZ += matrices[int( joint + 2 )] * w2;
|
||||
|
||||
joint = int(vertex.color.w * 255.1 * 3.0);
|
||||
matX += matrices[int(joint+0)] * w3;
|
||||
matY += matrices[int(joint+1)] * w3;
|
||||
matZ += matrices[int(joint+2)] * w3;
|
||||
joint = int( vertex.color.w * 255.1 * 3.0 );
|
||||
matX += matrices[int( joint + 0 )] * w3;
|
||||
matY += matrices[int( joint + 1 )] * w3;
|
||||
matZ += matrices[int( joint + 2 )] * w3;
|
||||
|
||||
float3 normal;
|
||||
normal.x = dot3( matX, vNormal );
|
||||
|
@ -174,7 +177,7 @@ void main( VS_IN vertex, out VS_OUT result ) {
|
|||
|
||||
//# calculate normalized vector to viewer in R1
|
||||
float4 toView = normalize( rpLocalViewOrigin - modelPosition );
|
||||
|
||||
|
||||
//# add together to become the half angle vector in object space (non-normalized)
|
||||
float4 halfAngleVector = toLight + toView;
|
||||
|
||||
|
@ -193,7 +196,7 @@ void main( VS_IN vertex, out VS_OUT result ) {
|
|||
//# generate the vertex color, which can be 1.0, color, or 1.0 - color
|
||||
//# for 1.0 : env[16] = 0, env[17] = 1
|
||||
//# for color : env[16] = 1, env[17] = 0
|
||||
//# for 1.0-color : env[16] = -1, env[17] = 1
|
||||
//# for 1.0-color : env[16] = -1, env[17] = 1
|
||||
result.color = ( swizzleColor( vertex.color ) * rpVertexColorModulate ) + rpVertexColorAdd;
|
||||
#endif
|
||||
}
|
|
@ -2,10 +2,10 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 2013-2015 Robert Beckebans
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
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
|
||||
|
@ -33,6 +33,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
uniform matrices_ubo { float4 matrices[408]; };
|
||||
#endif
|
||||
|
||||
// *INDENT-OFF*
|
||||
struct VS_IN {
|
||||
float4 position : POSITION;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
|
@ -53,8 +54,10 @@ struct VS_OUT {
|
|||
float4 texcoord6 : TEXCOORD6;
|
||||
float4 color : COLOR0;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
void main( VS_IN vertex, out VS_OUT result ) {
|
||||
void main( VS_IN vertex, out VS_OUT result )
|
||||
{
|
||||
|
||||
float4 vNormal = vertex.normal * 2.0 - 1.0;
|
||||
float4 vTangent = vertex.tangent * 2.0 - 1.0;
|
||||
|
@ -72,25 +75,25 @@ void main( VS_IN vertex, out VS_OUT result ) {
|
|||
const float w3 = vertex.color2.w;
|
||||
|
||||
float4 matX, matY, matZ; // must be float4 for vec4
|
||||
int joint = int(vertex.color.x * 255.1 * 3.0);
|
||||
matX = matrices[int(joint+0)] * w0;
|
||||
matY = matrices[int(joint+1)] * w0;
|
||||
matZ = matrices[int(joint+2)] * w0;
|
||||
int joint = int( vertex.color.x * 255.1 * 3.0 );
|
||||
matX = matrices[int( joint + 0 )] * w0;
|
||||
matY = matrices[int( joint + 1 )] * w0;
|
||||
matZ = matrices[int( joint + 2 )] * w0;
|
||||
|
||||
joint = int(vertex.color.y * 255.1 * 3.0);
|
||||
matX += matrices[int(joint+0)] * w1;
|
||||
matY += matrices[int(joint+1)] * w1;
|
||||
matZ += matrices[int(joint+2)] * w1;
|
||||
joint = int( vertex.color.y * 255.1 * 3.0 );
|
||||
matX += matrices[int( joint + 0 )] * w1;
|
||||
matY += matrices[int( joint + 1 )] * w1;
|
||||
matZ += matrices[int( joint + 2 )] * w1;
|
||||
|
||||
joint = int(vertex.color.z * 255.1 * 3.0);
|
||||
matX += matrices[int(joint+0)] * w2;
|
||||
matY += matrices[int(joint+1)] * w2;
|
||||
matZ += matrices[int(joint+2)] * w2;
|
||||
joint = int( vertex.color.z * 255.1 * 3.0 );
|
||||
matX += matrices[int( joint + 0 )] * w2;
|
||||
matY += matrices[int( joint + 1 )] * w2;
|
||||
matZ += matrices[int( joint + 2 )] * w2;
|
||||
|
||||
joint = int(vertex.color.w * 255.1 * 3.0);
|
||||
matX += matrices[int(joint+0)] * w3;
|
||||
matY += matrices[int(joint+1)] * w3;
|
||||
matZ += matrices[int(joint+2)] * w3;
|
||||
joint = int( vertex.color.w * 255.1 * 3.0 );
|
||||
matX += matrices[int( joint + 0 )] * w3;
|
||||
matY += matrices[int( joint + 1 )] * w3;
|
||||
matZ += matrices[int( joint + 2 )] * w3;
|
||||
|
||||
float3 normal;
|
||||
normal.x = dot3( matX, vNormal );
|
||||
|
@ -158,7 +161,7 @@ void main( VS_IN vertex, out VS_OUT result ) {
|
|||
result.texcoord3.x = dot3( toEye, rpModelMatrixX );
|
||||
result.texcoord3.y = dot3( toEye, rpModelMatrixY );
|
||||
result.texcoord3.z = dot3( toEye, rpModelMatrixZ );
|
||||
|
||||
|
||||
result.texcoord4.x = dot3( tangent, rpModelMatrixX );
|
||||
result.texcoord5.x = dot3( tangent, rpModelMatrixY );
|
||||
result.texcoord6.x = dot3( tangent, rpModelMatrixZ );
|
||||
|
@ -180,7 +183,7 @@ void main( VS_IN vertex, out VS_OUT result ) {
|
|||
//# generate the vertex color, which can be 1.0, color, or 1.0 - color
|
||||
//# for 1.0 : env[16] = 0, env[17] = 1
|
||||
//# for color : env[16] = 1, env[17] = 0
|
||||
//# for 1.0-color : env[16] = -1, env[17] = 1
|
||||
//# for 1.0-color : env[16] = -1, env[17] = 1
|
||||
result.color = ( swizzleColor( vertex.color ) * rpVertexColorModulate ) + rpVertexColorAdd;
|
||||
#endif
|
||||
}
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
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").
|
||||
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
|
||||
|
@ -28,6 +28,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#include "global.inc.hlsl"
|
||||
|
||||
// *INDENT-OFF*
|
||||
uniform sampler2D samp0 : register(s0); // Y
|
||||
uniform sampler2D samp1 : register(s1); // Cr
|
||||
uniform sampler2D samp2 : register(s2); // Cb
|
||||
|
@ -40,8 +41,10 @@ struct PS_IN {
|
|||
struct PS_OUT {
|
||||
float4 color : COLOR;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
void main( PS_IN fragment, out PS_OUT result ) {
|
||||
void main( PS_IN fragment, out PS_OUT result )
|
||||
{
|
||||
const float3 crc = float3( 1.595794678, -0.813476563, 0 );
|
||||
const float3 crb = float3( 0, -0.391448975, 2.017822266 );
|
||||
const float3 adj = float3( -0.87065506, 0.529705048f, -1.081668854f );
|
||||
|
@ -58,6 +61,6 @@ void main( PS_IN fragment, out PS_OUT result ) {
|
|||
color.xyz = p;
|
||||
color.w = 1.0;
|
||||
color *= rpColor;
|
||||
|
||||
|
||||
result.color = sRGBAToLinearRGBA( color );
|
||||
}
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
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").
|
||||
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
|
||||
|
@ -28,6 +28,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#include "global.inc.hlsl"
|
||||
|
||||
// *INDENT-OFF*
|
||||
struct VS_IN {
|
||||
float4 position : POSITION;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
|
@ -40,8 +41,10 @@ struct VS_OUT {
|
|||
float4 position : POSITION;
|
||||
float2 texcoord0 : TEXCOORD0;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
void main( VS_IN vertex, out VS_OUT result ) {
|
||||
void main( VS_IN vertex, out VS_OUT result )
|
||||
{
|
||||
result.position.x = dot4( vertex.position, rpMVPmatrixX );
|
||||
result.position.y = dot4( vertex.position, rpMVPmatrixY );
|
||||
result.position.z = dot4( vertex.position, rpMVPmatrixZ );
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
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").
|
||||
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
|
||||
|
@ -28,6 +28,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#include "global.inc.hlsl"
|
||||
|
||||
// *INDENT-OFF*
|
||||
uniform sampler2D samp0 : register(s0); // Y
|
||||
uniform sampler2D samp1 : register(s1); // Cr
|
||||
uniform sampler2D samp2 : register(s2); // Cb
|
||||
|
@ -42,8 +43,10 @@ struct PS_IN {
|
|||
struct PS_OUT {
|
||||
float4 color : COLOR;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
void main( PS_IN fragment, out PS_OUT result ) {
|
||||
void main( PS_IN fragment, out PS_OUT result )
|
||||
{
|
||||
const float3 crc = float3( 1.595794678, -0.813476563, 0 );
|
||||
const float3 crb = float3( 0, -0.391448975, 2.017822266 );
|
||||
const float3 adj = float3( -0.87065506, 0.529705048f, -1.081668854f );
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 2013 Robert Beckebans
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
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
|
||||
|
@ -29,6 +29,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#include "global.inc.hlsl"
|
||||
|
||||
// *INDENT-OFF*
|
||||
struct VS_IN {
|
||||
float4 position : POSITION;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
|
@ -44,8 +45,10 @@ struct VS_OUT {
|
|||
float4 texcoord1 : TEXCOORD1;
|
||||
float4 color : COLOR0;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
void main( VS_IN vertex, out VS_OUT result ) {
|
||||
void main( VS_IN vertex, out VS_OUT result )
|
||||
{
|
||||
result.position.x = dot4( vertex.position, rpMVPmatrixX );
|
||||
result.position.y = dot4( vertex.position, rpMVPmatrixY );
|
||||
result.position.z = dot4( vertex.position, rpMVPmatrixZ );
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
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").
|
||||
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
|
||||
|
@ -28,6 +28,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#include "global.inc.hlsl"
|
||||
|
||||
// *INDENT-OFF*
|
||||
uniform sampler2D samp0 : register(s0);
|
||||
uniform sampler2D samp1 : register(s1);
|
||||
|
||||
|
@ -40,7 +41,9 @@ struct PS_IN {
|
|||
struct PS_OUT {
|
||||
float4 color : COLOR;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
void main( PS_IN fragment, out PS_OUT result ) {
|
||||
void main( PS_IN fragment, out PS_OUT result )
|
||||
{
|
||||
result.color = idtex2Dproj( samp0, fragment.texcoord0 ) * tex2D( samp1, fragment.texcoord1 ) * rpColor;
|
||||
}
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
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").
|
||||
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
|
||||
|
@ -28,6 +28,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#include "global.inc.hlsl"
|
||||
|
||||
// *INDENT-OFF*
|
||||
struct VS_IN {
|
||||
float4 position : POSITION;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
|
@ -42,8 +43,10 @@ struct VS_OUT {
|
|||
float4 texcoord0 : TEXCOORD0;
|
||||
float2 texcoord1 : TEXCOORD1;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
void main( VS_IN vertex, out VS_OUT result ) {
|
||||
void main( VS_IN vertex, out VS_OUT result )
|
||||
{
|
||||
result.position.x = dot4( vertex.position, rpMVPmatrixX );
|
||||
result.position.y = dot4( vertex.position, rpMVPmatrixY );
|
||||
result.position.z = dot4( vertex.position, rpMVPmatrixZ );
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
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").
|
||||
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
|
||||
|
@ -28,6 +28,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#include "global.inc.hlsl"
|
||||
|
||||
// *INDENT-OFF*
|
||||
uniform sampler2D samp0 : register(s0); //_accum
|
||||
uniform sampler2D samp1 : register(s1); //_currentRender
|
||||
uniform sampler2D samp2 : register(s2); //mask
|
||||
|
@ -41,8 +42,10 @@ struct PS_IN {
|
|||
struct PS_OUT {
|
||||
float4 color : COLOR;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
void main( PS_IN fragment, out PS_OUT result ) {
|
||||
void main( PS_IN fragment, out PS_OUT result )
|
||||
{
|
||||
|
||||
float4 accumSample = tex2D( samp0, fragment.texcoord0 );
|
||||
float4 maskSample = tex2D( samp2, fragment.texcoord1 );
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
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").
|
||||
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
|
||||
|
@ -28,6 +28,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#include "global.inc.hlsl"
|
||||
|
||||
// *INDENT-OFF*
|
||||
uniform float4 rpUser0 : register( c128 ); //rpCenterScale
|
||||
|
||||
struct VS_IN {
|
||||
|
@ -43,8 +44,10 @@ struct VS_OUT {
|
|||
float2 texcoord0 : TEXCOORD0;
|
||||
float2 texcoord1 : TEXCOORD1;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
void main( VS_IN vertex, out VS_OUT result ) {
|
||||
void main( VS_IN vertex, out VS_OUT result )
|
||||
{
|
||||
result.position.x = dot4( vertex.position, rpMVPmatrixX );
|
||||
result.position.y = dot4( vertex.position, rpMVPmatrixY );
|
||||
result.position.z = dot4( vertex.position, rpMVPmatrixZ );
|
||||
|
@ -54,6 +57,6 @@ void main( VS_IN vertex, out VS_OUT result ) {
|
|||
const float4 centerScale = rpUser0;
|
||||
result.texcoord0 = CenterScale( vertex.texcoord, centerScale.xy );
|
||||
|
||||
// pass through texcoords
|
||||
// pass through texcoords
|
||||
result.texcoord1 = vertex.texcoord;
|
||||
}
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
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").
|
||||
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
|
||||
|
@ -28,6 +28,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#include "global.inc.hlsl"
|
||||
|
||||
// *INDENT-OFF*
|
||||
uniform sampler2D samp0 : register(s0); //_accum
|
||||
uniform sampler2D samp1 : register(s1); //_currentRender
|
||||
uniform sampler2D samp2 : register(s2); //mask
|
||||
|
@ -43,8 +44,10 @@ struct PS_IN {
|
|||
struct PS_OUT {
|
||||
float4 color : COLOR;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
void main( PS_IN fragment, out PS_OUT result ) {
|
||||
void main( PS_IN fragment, out PS_OUT result )
|
||||
{
|
||||
|
||||
float4 redTint = float4( 1, 0.98, 0.98, 1 );
|
||||
float4 accumSample = tex2D( samp0, fragment.texcoord0 ) * redTint;
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
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").
|
||||
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
|
||||
|
@ -28,6 +28,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#include "global.inc.hlsl"
|
||||
|
||||
// *INDENT-OFF*
|
||||
uniform float4 rpUser0 : register( c128 ); //rpCenterScaleTex0
|
||||
uniform float4 rpUser1 : register( c129 ); //rpRotateTex0
|
||||
uniform float4 rpUser2 : register( c130 ); //rpCenterScaleTex1
|
||||
|
@ -46,8 +47,10 @@ struct VS_OUT {
|
|||
float2 texcoord1 : TEXCOORD1;
|
||||
float2 texcoord2 : TEXCOORD2;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
void main( VS_IN vertex, out VS_OUT result ) {
|
||||
void main( VS_IN vertex, out VS_OUT result )
|
||||
{
|
||||
result.position.x = dot4( vertex.position, rpMVPmatrixX );
|
||||
result.position.y = dot4( vertex.position, rpMVPmatrixY );
|
||||
result.position.z = dot4( vertex.position, rpMVPmatrixZ );
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
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").
|
||||
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
|
||||
|
@ -28,6 +28,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#include "global.inc.hlsl"
|
||||
|
||||
// *INDENT-OFF*
|
||||
uniform sampler2D samp0 : register(s0); //_accum
|
||||
uniform sampler2D samp1 : register(s1); //_currentRender
|
||||
uniform sampler2D samp2 : register(s2); //mask
|
||||
|
@ -44,8 +45,10 @@ struct PS_IN {
|
|||
struct PS_OUT {
|
||||
float4 color : COLOR;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
void main( PS_IN fragment, out PS_OUT result ) {
|
||||
void main( PS_IN fragment, out PS_OUT result )
|
||||
{
|
||||
float colorFactor = fragment.texcoord4.x;
|
||||
|
||||
float4 color0 = float4( 1.0f - colorFactor, 1.0f - colorFactor, 1.0f, 1.0f );
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
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").
|
||||
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
|
||||
|
@ -28,6 +28,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#include "global.inc.hlsl"
|
||||
|
||||
// *INDENT-OFF*
|
||||
uniform float4 rpUser0 : register( c128 ); //rpCenterScaleTex
|
||||
uniform float4 rpUser1 : register( c129 ); //rpRotateTex
|
||||
uniform float4 rpUser2 : register( c130 ); //rpColorFactor
|
||||
|
@ -48,8 +49,10 @@ struct VS_OUT {
|
|||
float2 texcoord3 : TEXCOORD3;
|
||||
float2 texcoord4 : TEXCOORD4;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
void main( VS_IN vertex, out VS_OUT result ) {
|
||||
void main( VS_IN vertex, out VS_OUT result )
|
||||
{
|
||||
result.position.x = dot4( vertex.position, rpMVPmatrixX );
|
||||
result.position.y = dot4( vertex.position, rpMVPmatrixY );
|
||||
result.position.z = dot4( vertex.position, rpMVPmatrixZ );
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
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").
|
||||
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
|
||||
|
@ -28,6 +28,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#include "global.inc.hlsl"
|
||||
|
||||
// *INDENT-OFF*
|
||||
uniform sampler2D samp0 : register(s0); //_accum
|
||||
uniform sampler2D samp1 : register(s1); //_currentRender
|
||||
uniform sampler2D samp2 : register(s2); //mask
|
||||
|
@ -40,8 +41,10 @@ struct PS_IN {
|
|||
struct PS_OUT {
|
||||
float4 color : COLOR;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
void main( PS_IN fragment, out PS_OUT result ) {
|
||||
void main( PS_IN fragment, out PS_OUT result )
|
||||
{
|
||||
|
||||
float4 accumSample = tex2D( samp0, fragment.texcoord0 );
|
||||
float4 currentRenderSample = tex2D( samp1, fragment.texcoord0 );
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
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").
|
||||
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
|
||||
|
@ -28,6 +28,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#include "global.inc.hlsl"
|
||||
|
||||
// *INDENT-OFF*
|
||||
struct VS_IN {
|
||||
float4 position : POSITION;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
|
@ -40,8 +41,10 @@ struct VS_OUT {
|
|||
float4 position : POSITION;
|
||||
float2 texcoord0 : TEXCOORD0;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
void main( VS_IN vertex, out VS_OUT result ) {
|
||||
void main( VS_IN vertex, out VS_OUT result )
|
||||
{
|
||||
result.position.x = dot4( vertex.position, rpMVPmatrixX );
|
||||
result.position.y = dot4( vertex.position, rpMVPmatrixY );
|
||||
result.position.z = dot4( vertex.position, rpMVPmatrixZ );
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 2013 Robert Beckebans
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
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
|
||||
|
@ -29,6 +29,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#include "global.inc.hlsl"
|
||||
|
||||
// *INDENT-OFF*
|
||||
uniform samplerCUBE samp0 : register(s0); // texture 0 is the cube map
|
||||
uniform sampler2D samp1 : register(s1); // normal map
|
||||
|
||||
|
@ -45,8 +46,10 @@ struct PS_IN {
|
|||
struct PS_OUT {
|
||||
float4 color : COLOR;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
void main( PS_IN fragment, out PS_OUT result ) {
|
||||
void main( PS_IN fragment, out PS_OUT result )
|
||||
{
|
||||
|
||||
float4 bump = tex2D( samp1, fragment.texcoord0 ) * 2.0f - 1.0f;
|
||||
// RB begin
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
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").
|
||||
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
|
||||
|
@ -28,6 +28,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#include "global.inc.hlsl"
|
||||
|
||||
// *INDENT-OFF*
|
||||
struct VS_IN {
|
||||
float4 position : POSITION;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
|
@ -45,8 +46,10 @@ struct VS_OUT {
|
|||
float3 texcoord4 : TEXCOORD4;
|
||||
float4 color : COLOR0;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
void main( VS_IN vertex, out VS_OUT result ) {
|
||||
void main( VS_IN vertex, out VS_OUT result )
|
||||
{
|
||||
|
||||
float4 normal = vertex.normal * 2.0 - 1.0;
|
||||
float4 tangent = vertex.tangent * 2.0 - 1.0;
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 2013 Robert Beckebans
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
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
|
||||
|
@ -29,6 +29,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#include "global.inc.hlsl"
|
||||
|
||||
// *INDENT-OFF*
|
||||
uniform samplerCUBE samp0 : register(s0); // texture 0 is the cube map
|
||||
uniform sampler2D samp1 : register(s1); // normal map
|
||||
|
||||
|
@ -45,11 +46,13 @@ struct PS_IN {
|
|||
struct PS_OUT {
|
||||
float4 color : COLOR;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
void main( PS_IN fragment, out PS_OUT result ) {
|
||||
void main( PS_IN fragment, out PS_OUT result )
|
||||
{
|
||||
|
||||
float4 bump = tex2D( samp1, fragment.texcoord0 ) * 2.0f - 1.0f;
|
||||
|
||||
|
||||
// RB begin
|
||||
float3 localNormal;
|
||||
#if defined(GLES2)
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 2014 Robert Beckebans
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
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
|
||||
|
@ -29,6 +29,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#include "global.inc.hlsl"
|
||||
|
||||
// *INDENT-OFF*
|
||||
uniform matrices_ubo { float4 matrices[408]; };
|
||||
|
||||
struct VS_IN {
|
||||
|
@ -49,8 +50,10 @@ struct VS_OUT {
|
|||
float3 texcoord4 : TEXCOORD4;
|
||||
float4 color : COLOR0;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
void main( VS_IN vertex, out VS_OUT result ) {
|
||||
void main( VS_IN vertex, out VS_OUT result )
|
||||
{
|
||||
float4 vNormal = vertex.normal * 2.0 - 1.0;
|
||||
float4 vTangent = vertex.tangent * 2.0 - 1.0;
|
||||
float3 vBinormal = cross( vNormal.xyz, vTangent.xyz ) * vTangent.w;
|
||||
|
@ -66,25 +69,25 @@ void main( VS_IN vertex, out VS_OUT result ) {
|
|||
const float w3 = vertex.color2.w;
|
||||
|
||||
float4 matX, matY, matZ; // must be float4 for vec4
|
||||
int joint = int(vertex.color.x * 255.1 * 3.0);
|
||||
matX = matrices[int(joint+0)] * w0;
|
||||
matY = matrices[int(joint+1)] * w0;
|
||||
matZ = matrices[int(joint+2)] * w0;
|
||||
int joint = int( vertex.color.x * 255.1 * 3.0 );
|
||||
matX = matrices[int( joint + 0 )] * w0;
|
||||
matY = matrices[int( joint + 1 )] * w0;
|
||||
matZ = matrices[int( joint + 2 )] * w0;
|
||||
|
||||
joint = int(vertex.color.y * 255.1 * 3.0);
|
||||
matX += matrices[int(joint+0)] * w1;
|
||||
matY += matrices[int(joint+1)] * w1;
|
||||
matZ += matrices[int(joint+2)] * w1;
|
||||
joint = int( vertex.color.y * 255.1 * 3.0 );
|
||||
matX += matrices[int( joint + 0 )] * w1;
|
||||
matY += matrices[int( joint + 1 )] * w1;
|
||||
matZ += matrices[int( joint + 2 )] * w1;
|
||||
|
||||
joint = int(vertex.color.z * 255.1 * 3.0);
|
||||
matX += matrices[int(joint+0)] * w2;
|
||||
matY += matrices[int(joint+1)] * w2;
|
||||
matZ += matrices[int(joint+2)] * w2;
|
||||
joint = int( vertex.color.z * 255.1 * 3.0 );
|
||||
matX += matrices[int( joint + 0 )] * w2;
|
||||
matY += matrices[int( joint + 1 )] * w2;
|
||||
matZ += matrices[int( joint + 2 )] * w2;
|
||||
|
||||
joint = int(vertex.color.w * 255.1 * 3.0);
|
||||
matX += matrices[int(joint+0)] * w3;
|
||||
matY += matrices[int(joint+1)] * w3;
|
||||
matZ += matrices[int(joint+2)] * w3;
|
||||
joint = int( vertex.color.w * 255.1 * 3.0 );
|
||||
matX += matrices[int( joint + 0 )] * w3;
|
||||
matY += matrices[int( joint + 1 )] * w3;
|
||||
matZ += matrices[int( joint + 2 )] * w3;
|
||||
|
||||
float3 normal;
|
||||
normal.x = dot3( matX, vNormal );
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
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").
|
||||
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
|
||||
|
@ -28,12 +28,15 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#include "global.inc.hlsl"
|
||||
|
||||
// *INDENT-OFF*
|
||||
uniform sampler2D samp0 : register(s0);
|
||||
|
||||
struct PS_OUT {
|
||||
float4 color : COLOR;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
void main( out PS_OUT result ) {
|
||||
void main( out PS_OUT result )
|
||||
{
|
||||
result.color = rpColor;
|
||||
}
|
|
@ -2,10 +2,10 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 2013-2014 Robert Beckebans
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
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
|
||||
|
@ -33,6 +33,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
uniform matrices_ubo { float4 matrices[408]; };
|
||||
#endif
|
||||
|
||||
// *INDENT-OFF*
|
||||
struct VS_IN {
|
||||
float4 position : POSITION;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
|
@ -45,6 +46,7 @@ struct VS_IN {
|
|||
struct VS_OUT {
|
||||
float4 position : POSITION;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
void main( VS_IN vertex, out VS_OUT result )
|
||||
{
|
||||
|
@ -60,25 +62,25 @@ void main( VS_IN vertex, out VS_OUT result )
|
|||
const float w3 = vertex.color2.w;
|
||||
|
||||
float4 matX, matY, matZ; // must be float4 for vec4
|
||||
int joint = int(vertex.color.x * 255.1 * 3.0);
|
||||
matX = matrices[int(joint+0)] * w0;
|
||||
matY = matrices[int(joint+1)] * w0;
|
||||
matZ = matrices[int(joint+2)] * w0;
|
||||
int joint = int( vertex.color.x * 255.1 * 3.0 );
|
||||
matX = matrices[int( joint + 0 )] * w0;
|
||||
matY = matrices[int( joint + 1 )] * w0;
|
||||
matZ = matrices[int( joint + 2 )] * w0;
|
||||
|
||||
joint = int(vertex.color.y * 255.1 * 3.0);
|
||||
matX += matrices[int(joint+0)] * w1;
|
||||
matY += matrices[int(joint+1)] * w1;
|
||||
matZ += matrices[int(joint+2)] * w1;
|
||||
joint = int( vertex.color.y * 255.1 * 3.0 );
|
||||
matX += matrices[int( joint + 0 )] * w1;
|
||||
matY += matrices[int( joint + 1 )] * w1;
|
||||
matZ += matrices[int( joint + 2 )] * w1;
|
||||
|
||||
joint = int(vertex.color.z * 255.1 * 3.0);
|
||||
matX += matrices[int(joint+0)] * w2;
|
||||
matY += matrices[int(joint+1)] * w2;
|
||||
matZ += matrices[int(joint+2)] * w2;
|
||||
joint = int( vertex.color.z * 255.1 * 3.0 );
|
||||
matX += matrices[int( joint + 0 )] * w2;
|
||||
matY += matrices[int( joint + 1 )] * w2;
|
||||
matZ += matrices[int( joint + 2 )] * w2;
|
||||
|
||||
joint = int(vertex.color.w * 255.1 * 3.0);
|
||||
matX += matrices[int(joint+0)] * w3;
|
||||
matY += matrices[int(joint+1)] * w3;
|
||||
matZ += matrices[int(joint+2)] * w3;
|
||||
joint = int( vertex.color.w * 255.1 * 3.0 );
|
||||
matX += matrices[int( joint + 0 )] * w3;
|
||||
matY += matrices[int( joint + 1 )] * w3;
|
||||
matZ += matrices[int( joint + 2 )] * w3;
|
||||
|
||||
float4 modelPosition;
|
||||
modelPosition.x = dot4( matX, vertex.position );
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
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").
|
||||
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
|
||||
|
@ -28,6 +28,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#include "global.inc.hlsl"
|
||||
|
||||
// *INDENT-OFF*
|
||||
uniform sampler2D samp0 : register(s0);
|
||||
|
||||
struct PS_IN {
|
||||
|
@ -39,8 +40,10 @@ struct PS_IN {
|
|||
struct PS_OUT {
|
||||
float4 color : COLOR;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
void main( PS_IN fragment, out PS_OUT result ) {
|
||||
void main( PS_IN fragment, out PS_OUT result )
|
||||
{
|
||||
float4 src = tex2D( samp0, fragment.texcoord0.xy );
|
||||
float4 target = fragment.color * dot3( float3( 0.333, 0.333, 0.333 ), src );
|
||||
result.color = lerp( src, target, fragment.texcoord0.z );
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
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").
|
||||
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
|
||||
|
@ -28,6 +28,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#include "global.inc.hlsl"
|
||||
|
||||
// *INDENT-OFF*
|
||||
uniform float4 rpUser0 : register(c128); //rpFraction
|
||||
uniform float4 rpUser1 : register(c129); //rpTargetHue
|
||||
|
||||
|
@ -45,15 +46,17 @@ struct VS_OUT {
|
|||
float4 color : COLOR0;
|
||||
float3 texcoord0 : TEXCOORD0;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
void main( VS_IN vertex, out VS_OUT result ) {
|
||||
void main( VS_IN vertex, out VS_OUT result )
|
||||
{
|
||||
result.position.x = dot4( vertex.position, rpMVPmatrixX );
|
||||
result.position.y = dot4( vertex.position, rpMVPmatrixY );
|
||||
result.position.z = dot4( vertex.position, rpMVPmatrixZ );
|
||||
result.position.w = dot4( vertex.position, rpMVPmatrixW );
|
||||
|
||||
|
||||
result.color = rpUser1; // targetHue
|
||||
|
||||
|
||||
result.texcoord0.x = vertex.texcoord.x;
|
||||
result.texcoord0.y = 1.0f - vertex.texcoord.y;
|
||||
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 2014 Robert Beckebans
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
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
|
||||
|
@ -29,6 +29,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#include "global.inc.hlsl"
|
||||
|
||||
// *INDENT-OFF*
|
||||
uniform sampler2DArray samp0 : register(s0);
|
||||
|
||||
struct PS_IN
|
||||
|
@ -41,6 +42,7 @@ struct PS_OUT
|
|||
{
|
||||
float4 color : COLOR;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
void main( PS_IN fragment, out PS_OUT result )
|
||||
{
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
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").
|
||||
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
|
||||
|
@ -28,6 +28,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#include "global.inc.hlsl"
|
||||
|
||||
// *INDENT-OFF*
|
||||
struct VS_IN {
|
||||
float4 position : POSITION;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
|
@ -40,18 +41,23 @@ struct VS_OUT {
|
|||
float4 position : POSITION;
|
||||
float2 texcoord0 : TEXCOORD0;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
void main( VS_IN vertex, out VS_OUT result ) {
|
||||
void main( VS_IN vertex, out VS_OUT result )
|
||||
{
|
||||
result.position.x = dot4( vertex.position, rpMVPmatrixX );
|
||||
result.position.y = dot4( vertex.position, rpMVPmatrixY );
|
||||
result.position.z = dot4( vertex.position, rpMVPmatrixZ );
|
||||
result.position.w = dot4( vertex.position, rpMVPmatrixW );
|
||||
|
||||
// compute oldschool texgen or multiply by texture matrix
|
||||
BRANCH if ( rpTexGen0Enabled.x > 0.0 ) {
|
||||
BRANCH if( rpTexGen0Enabled.x > 0.0 )
|
||||
{
|
||||
result.texcoord0.x = dot4( vertex.position, rpTexGen0S );
|
||||
result.texcoord0.y = dot4( vertex.position, rpTexGen0T );
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
result.texcoord0.x = dot4( vertex.texcoord.xy, rpTextureMatrixS );
|
||||
result.texcoord0.y = dot4( vertex.texcoord.xy, rpTextureMatrixT );
|
||||
}
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
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").
|
||||
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
|
||||
|
@ -28,11 +28,15 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#include "global.inc.hlsl"
|
||||
|
||||
// *INDENT-OFF*
|
||||
uniform sampler2D samp0 : register(s0);
|
||||
|
||||
struct PS_OUT {
|
||||
float4 color : COLOR;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
void main( out PS_OUT result ) {
|
||||
void main( out PS_OUT result )
|
||||
{
|
||||
result.color = float4( 0.0, 0.0, 0.0, 1.0 );
|
||||
}
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
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").
|
||||
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
|
||||
|
@ -28,6 +28,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#include "global.inc.hlsl"
|
||||
|
||||
// *INDENT-OFF*
|
||||
struct VS_IN {
|
||||
float4 position : POSITION;
|
||||
};
|
||||
|
@ -35,8 +36,10 @@ struct VS_IN {
|
|||
struct VS_OUT {
|
||||
float4 position : POSITION;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
void main( VS_IN vertex, out VS_OUT result ) {
|
||||
void main( VS_IN vertex, out VS_OUT result )
|
||||
{
|
||||
result.position.x = dot4( vertex.position, rpMVPmatrixX );
|
||||
result.position.y = dot4( vertex.position, rpMVPmatrixY );
|
||||
result.position.z = dot4( vertex.position, rpMVPmatrixZ );
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
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").
|
||||
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
|
||||
|
@ -28,11 +28,15 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#include "global.inc.hlsl"
|
||||
|
||||
// *INDENT-OFF*
|
||||
uniform sampler2D samp0 : register(s0);
|
||||
|
||||
struct PS_OUT {
|
||||
float4 color : COLOR;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
void main( out PS_OUT result ) {
|
||||
void main( out PS_OUT result )
|
||||
{
|
||||
result.color = float4( 0.0, 0.0, 0.0, 1.0 );
|
||||
}
|
|
@ -2,10 +2,10 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 2014 Robert Beckebans
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
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
|
||||
|
@ -31,6 +31,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
uniform matrices_ubo { float4 matrices[408]; };
|
||||
|
||||
// *INDENT-OFF*
|
||||
struct VS_IN {
|
||||
float4 position : POSITION;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
|
@ -43,8 +44,10 @@ struct VS_IN {
|
|||
struct VS_OUT {
|
||||
float4 position : POSITION;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
void main( VS_IN vertex, out VS_OUT result ) {
|
||||
void main( VS_IN vertex, out VS_OUT result )
|
||||
{
|
||||
//--------------------------------------------------------------
|
||||
// GPU transformation of the normal / binormal / bitangent
|
||||
//
|
||||
|
@ -56,25 +59,25 @@ void main( VS_IN vertex, out VS_OUT result ) {
|
|||
const float w3 = vertex.color2.w;
|
||||
|
||||
float4 matX, matY, matZ; // must be float4 for vec4
|
||||
int joint = int(vertex.color.x * 255.1 * 3.0);
|
||||
matX = matrices[int(joint+0)] * w0;
|
||||
matY = matrices[int(joint+1)] * w0;
|
||||
matZ = matrices[int(joint+2)] * w0;
|
||||
int joint = int( vertex.color.x * 255.1 * 3.0 );
|
||||
matX = matrices[int( joint + 0 )] * w0;
|
||||
matY = matrices[int( joint + 1 )] * w0;
|
||||
matZ = matrices[int( joint + 2 )] * w0;
|
||||
|
||||
joint = int(vertex.color.y * 255.1 * 3.0);
|
||||
matX += matrices[int(joint+0)] * w1;
|
||||
matY += matrices[int(joint+1)] * w1;
|
||||
matZ += matrices[int(joint+2)] * w1;
|
||||
joint = int( vertex.color.y * 255.1 * 3.0 );
|
||||
matX += matrices[int( joint + 0 )] * w1;
|
||||
matY += matrices[int( joint + 1 )] * w1;
|
||||
matZ += matrices[int( joint + 2 )] * w1;
|
||||
|
||||
joint = int(vertex.color.z * 255.1 * 3.0);
|
||||
matX += matrices[int(joint+0)] * w2;
|
||||
matY += matrices[int(joint+1)] * w2;
|
||||
matZ += matrices[int(joint+2)] * w2;
|
||||
joint = int( vertex.color.z * 255.1 * 3.0 );
|
||||
matX += matrices[int( joint + 0 )] * w2;
|
||||
matY += matrices[int( joint + 1 )] * w2;
|
||||
matZ += matrices[int( joint + 2 )] * w2;
|
||||
|
||||
joint = int(vertex.color.w * 255.1 * 3.0);
|
||||
matX += matrices[int(joint+0)] * w3;
|
||||
matY += matrices[int(joint+1)] * w3;
|
||||
matZ += matrices[int(joint+2)] * w3;
|
||||
joint = int( vertex.color.w * 255.1 * 3.0 );
|
||||
matX += matrices[int( joint + 0 )] * w3;
|
||||
matY += matrices[int( joint + 1 )] * w3;
|
||||
matZ += matrices[int( joint + 2 )] * w3;
|
||||
|
||||
float4 modelPosition;
|
||||
modelPosition.x = dot4( matX, vertex.position );
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
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").
|
||||
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
|
||||
|
@ -28,6 +28,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#include "global.inc.hlsl"
|
||||
|
||||
// *INDENT-OFF*
|
||||
uniform sampler2D samp0 : register(s0); // texture 0 is _current Render
|
||||
uniform sampler2D samp1 : register(s1); // texture 1 is the per-surface bump map
|
||||
|
||||
|
@ -40,11 +41,13 @@ struct PS_IN {
|
|||
struct PS_OUT {
|
||||
float4 color : COLOR;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
void main( PS_IN fragment, out PS_OUT result ) {
|
||||
void main( PS_IN fragment, out PS_OUT result )
|
||||
{
|
||||
|
||||
float2 screenTexCoord = fragment.texcoord;
|
||||
|
||||
|
||||
// compute warp factor
|
||||
float4 warpFactor = 1.0 - ( tex2D( samp1, screenTexCoord.xy ) * fragment.color );
|
||||
screenTexCoord -= float2( 0.5, 0.5 );
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
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").
|
||||
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
|
||||
|
@ -30,6 +30,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
// User Renderparms start at 128 as per renderprogs.h
|
||||
|
||||
// *INDENT-OFF*
|
||||
uniform float4 rpUser0 : register(c128); // rpScroll
|
||||
uniform float4 rpUser1 : register(c129); // rpDeformMagnitude
|
||||
|
||||
|
@ -46,15 +47,16 @@ struct VS_OUT {
|
|||
float2 texcoord : TEXCOORD0;
|
||||
float4 color : COLOR;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
|
||||
void main( VS_IN vertex, out VS_OUT result ) {
|
||||
void main( VS_IN vertex, out VS_OUT result )
|
||||
{
|
||||
|
||||
result.position.x = dot4( vertex.position, rpMVPmatrixX );
|
||||
result.position.y = dot4( vertex.position, rpMVPmatrixY );
|
||||
result.position.z = dot4( vertex.position, rpMVPmatrixZ );
|
||||
result.position.w = dot4( vertex.position, rpMVPmatrixW );
|
||||
|
||||
|
||||
result.texcoord = vertex.texcoord.xy;
|
||||
|
||||
const float4 deformMagnitude = rpUser1;
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
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").
|
||||
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
|
||||
|
@ -28,6 +28,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#include "global.inc.hlsl"
|
||||
|
||||
// *INDENT-OFF*
|
||||
uniform samplerCUBE samp0 : register(s0); // texture 0 is the cube map
|
||||
|
||||
struct PS_IN {
|
||||
|
@ -40,8 +41,10 @@ struct PS_IN {
|
|||
struct PS_OUT {
|
||||
float4 color : COLOR;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
void main( PS_IN fragment, out PS_OUT result ) {
|
||||
void main( PS_IN fragment, out PS_OUT result )
|
||||
{
|
||||
|
||||
float3 globalNormal = normalize( fragment.texcoord1 );
|
||||
float3 globalEye = normalize( fragment.texcoord0 );
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
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").
|
||||
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
|
||||
|
@ -28,6 +28,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#include "global.inc.hlsl"
|
||||
|
||||
// *INDENT-OFF*
|
||||
struct VS_IN {
|
||||
float4 position : POSITION;
|
||||
float4 normal : NORMAL;
|
||||
|
@ -40,8 +41,10 @@ struct VS_OUT {
|
|||
float3 texcoord1 : TEXCOORD1;
|
||||
float4 color : COLOR0;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
void main( VS_IN vertex, out VS_OUT result ) {
|
||||
void main( VS_IN vertex, out VS_OUT result )
|
||||
{
|
||||
|
||||
float4 vNormal = vertex.normal * 2.0 - 1.0;
|
||||
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
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").
|
||||
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
|
||||
|
@ -28,6 +28,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#include "global.inc.hlsl"
|
||||
|
||||
// *INDENT-OFF*
|
||||
uniform samplerCUBE samp0 : register(s0); // texture 0 is the cube map
|
||||
|
||||
struct PS_IN {
|
||||
|
@ -40,8 +41,10 @@ struct PS_IN {
|
|||
struct PS_OUT {
|
||||
float4 color : COLOR;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
void main( PS_IN fragment, out PS_OUT result ) {
|
||||
void main( PS_IN fragment, out PS_OUT result )
|
||||
{
|
||||
|
||||
float3 globalNormal = normalize( fragment.texcoord1 );
|
||||
float3 globalEye = normalize( fragment.texcoord0 );
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 2014 Robert Beckebans
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
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
|
||||
|
@ -31,6 +31,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
uniform matrices_ubo { float4 matrices[408]; };
|
||||
|
||||
// *INDENT-OFF*
|
||||
struct VS_IN {
|
||||
float4 position : POSITION;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
|
@ -46,8 +47,10 @@ struct VS_OUT {
|
|||
float3 texcoord1 : TEXCOORD1;
|
||||
float4 color : COLOR0;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
void main( VS_IN vertex, out VS_OUT result ) {
|
||||
void main( VS_IN vertex, out VS_OUT result )
|
||||
{
|
||||
float4 vNormal = vertex.normal * 2.0 - 1.0;
|
||||
|
||||
//--------------------------------------------------------------
|
||||
|
@ -61,25 +64,25 @@ void main( VS_IN vertex, out VS_OUT result ) {
|
|||
const float w3 = vertex.color2.w;
|
||||
|
||||
float4 matX, matY, matZ; // must be float4 for vec4
|
||||
int joint = int(vertex.color.x * 255.1 * 3.0);
|
||||
matX = matrices[int(joint+0)] * w0;
|
||||
matY = matrices[int(joint+1)] * w0;
|
||||
matZ = matrices[int(joint+2)] * w0;
|
||||
int joint = int( vertex.color.x * 255.1 * 3.0 );
|
||||
matX = matrices[int( joint + 0 )] * w0;
|
||||
matY = matrices[int( joint + 1 )] * w0;
|
||||
matZ = matrices[int( joint + 2 )] * w0;
|
||||
|
||||
joint = int(vertex.color.y * 255.1 * 3.0);
|
||||
matX += matrices[int(joint+0)] * w1;
|
||||
matY += matrices[int(joint+1)] * w1;
|
||||
matZ += matrices[int(joint+2)] * w1;
|
||||
joint = int( vertex.color.y * 255.1 * 3.0 );
|
||||
matX += matrices[int( joint + 0 )] * w1;
|
||||
matY += matrices[int( joint + 1 )] * w1;
|
||||
matZ += matrices[int( joint + 2 )] * w1;
|
||||
|
||||
joint = int(vertex.color.z * 255.1 * 3.0);
|
||||
matX += matrices[int(joint+0)] * w2;
|
||||
matY += matrices[int(joint+1)] * w2;
|
||||
matZ += matrices[int(joint+2)] * w2;
|
||||
joint = int( vertex.color.z * 255.1 * 3.0 );
|
||||
matX += matrices[int( joint + 0 )] * w2;
|
||||
matY += matrices[int( joint + 1 )] * w2;
|
||||
matZ += matrices[int( joint + 2 )] * w2;
|
||||
|
||||
joint = int(vertex.color.w * 255.1 * 3.0);
|
||||
matX += matrices[int(joint+0)] * w3;
|
||||
matY += matrices[int(joint+1)] * w3;
|
||||
matZ += matrices[int(joint+2)] * w3;
|
||||
joint = int( vertex.color.w * 255.1 * 3.0 );
|
||||
matX += matrices[int( joint + 0 )] * w3;
|
||||
matY += matrices[int( joint + 1 )] * w3;
|
||||
matZ += matrices[int( joint + 2 )] * w3;
|
||||
|
||||
float3 vNormalSkinned;
|
||||
vNormalSkinned.x = dot3( matX, vNormal );
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
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").
|
||||
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
|
||||
|
@ -28,6 +28,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#include "global.inc.hlsl"
|
||||
|
||||
// *INDENT-OFF*
|
||||
uniform sampler2D samp0 : register(s0);
|
||||
uniform sampler2D samp1 : register(s1);
|
||||
|
||||
|
@ -40,8 +41,10 @@ struct PS_IN {
|
|||
struct PS_OUT {
|
||||
float4 color : COLOR;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
void main( PS_IN fragment, out PS_OUT result ) {
|
||||
void main( PS_IN fragment, out PS_OUT result )
|
||||
{
|
||||
result.color = tex2D( samp0, fragment.texcoord0 ) * tex2D( samp1, fragment.texcoord1 ) * sRGBAToLinearRGBA( rpColor );
|
||||
}
|
||||
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
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").
|
||||
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
|
||||
|
@ -28,6 +28,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#include "global.inc.hlsl"
|
||||
|
||||
// *INDENT-OFF*
|
||||
struct VS_IN {
|
||||
float4 position : POSITION;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
|
@ -41,8 +42,10 @@ struct VS_OUT {
|
|||
float2 texcoord0 : TEXCOORD0;
|
||||
float2 texcoord1 : TEXCOORD1;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
void main( VS_IN vertex, out VS_OUT result ) {
|
||||
void main( VS_IN vertex, out VS_OUT result )
|
||||
{
|
||||
result.position.x = dot4( vertex.position, rpMVPmatrixX );
|
||||
result.position.y = dot4( vertex.position, rpMVPmatrixY );
|
||||
result.position.z = dot4( vertex.position, rpMVPmatrixZ );
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
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").
|
||||
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
|
||||
|
@ -28,6 +28,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#include "global.inc.hlsl"
|
||||
|
||||
// *INDENT-OFF*
|
||||
uniform sampler2D samp0 : register(s0);
|
||||
uniform sampler2D samp1 : register(s1);
|
||||
|
||||
|
@ -40,8 +41,10 @@ struct PS_IN {
|
|||
struct PS_OUT {
|
||||
float4 color : COLOR;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
void main( PS_IN fragment, out PS_OUT result ) {
|
||||
void main( PS_IN fragment, out PS_OUT result )
|
||||
{
|
||||
result.color = tex2D( samp0, fragment.texcoord0 ) * tex2D( samp1, fragment.texcoord1 ) * sRGBAToLinearRGBA( rpColor );
|
||||
}
|
||||
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 2014 Robert Beckebans
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
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
|
||||
|
@ -31,6 +31,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
uniform matrices_ubo { float4 matrices[408]; };
|
||||
|
||||
// *INDENT-OFF*
|
||||
struct VS_IN {
|
||||
float4 position : POSITION;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
|
@ -45,8 +46,10 @@ struct VS_OUT {
|
|||
float2 texcoord0 : TEXCOORD0;
|
||||
float2 texcoord1 : TEXCOORD1;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
void main( VS_IN vertex, out VS_OUT result ) {
|
||||
void main( VS_IN vertex, out VS_OUT result )
|
||||
{
|
||||
//--------------------------------------------------------------
|
||||
// GPU transformation of the normal / binormal / bitangent
|
||||
//
|
||||
|
@ -58,25 +61,25 @@ void main( VS_IN vertex, out VS_OUT result ) {
|
|||
const float w3 = vertex.color2.w;
|
||||
|
||||
float4 matX, matY, matZ; // must be float4 for vec4
|
||||
int joint = int(vertex.color.x * 255.1 * 3.0);
|
||||
matX = matrices[int(joint+0)] * w0;
|
||||
matY = matrices[int(joint+1)] * w0;
|
||||
matZ = matrices[int(joint+2)] * w0;
|
||||
int joint = int( vertex.color.x * 255.1 * 3.0 );
|
||||
matX = matrices[int( joint + 0 )] * w0;
|
||||
matY = matrices[int( joint + 1 )] * w0;
|
||||
matZ = matrices[int( joint + 2 )] * w0;
|
||||
|
||||
joint = int(vertex.color.y * 255.1 * 3.0);
|
||||
matX += matrices[int(joint+0)] * w1;
|
||||
matY += matrices[int(joint+1)] * w1;
|
||||
matZ += matrices[int(joint+2)] * w1;
|
||||
joint = int( vertex.color.y * 255.1 * 3.0 );
|
||||
matX += matrices[int( joint + 0 )] * w1;
|
||||
matY += matrices[int( joint + 1 )] * w1;
|
||||
matZ += matrices[int( joint + 2 )] * w1;
|
||||
|
||||
joint = int(vertex.color.z * 255.1 * 3.0);
|
||||
matX += matrices[int(joint+0)] * w2;
|
||||
matY += matrices[int(joint+1)] * w2;
|
||||
matZ += matrices[int(joint+2)] * w2;
|
||||
joint = int( vertex.color.z * 255.1 * 3.0 );
|
||||
matX += matrices[int( joint + 0 )] * w2;
|
||||
matY += matrices[int( joint + 1 )] * w2;
|
||||
matZ += matrices[int( joint + 2 )] * w2;
|
||||
|
||||
joint = int(vertex.color.w * 255.1 * 3.0);
|
||||
matX += matrices[int(joint+0)] * w3;
|
||||
matY += matrices[int(joint+1)] * w3;
|
||||
matZ += matrices[int(joint+2)] * w3;
|
||||
joint = int( vertex.color.w * 255.1 * 3.0 );
|
||||
matX += matrices[int( joint + 0 )] * w3;
|
||||
matY += matrices[int( joint + 1 )] * w3;
|
||||
matZ += matrices[int( joint + 2 )] * w3;
|
||||
|
||||
float4 modelPosition;
|
||||
modelPosition.x = dot4( matX, vertex.position );
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
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").
|
||||
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
|
||||
|
@ -31,6 +31,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#define FXAA_EARLY_EXIT 0
|
||||
#include "Fxaa3_11.h"
|
||||
|
||||
// *INDENT-OFF*
|
||||
uniform sampler2D samp0 : register(s0);
|
||||
uniform sampler2D samp1 : register(s1); // exponent bias -1
|
||||
uniform sampler2D samp2 : register(s2); // exponent bias -2
|
||||
|
@ -51,8 +52,10 @@ struct PS_IN {
|
|||
struct PS_OUT {
|
||||
float4 color : COLOR;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
void main( PS_IN fragment, out PS_OUT result ) {
|
||||
void main( PS_IN fragment, out PS_OUT result )
|
||||
{
|
||||
|
||||
const float4 FXAAQualityRCPFrame = rpUser0;
|
||||
const float4 FXAAConsoleRcpFrameOpt = rpUser1;
|
||||
|
@ -105,6 +108,6 @@ void main( PS_IN fragment, out PS_OUT result ) {
|
|||
fxaaConsoleEdgeThreshold,
|
||||
fxaaConsoleEdgeThresholdMin,
|
||||
fxaaConsole360ConstDir );
|
||||
|
||||
|
||||
result.color = colorSample;
|
||||
}
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
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").
|
||||
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
|
||||
|
@ -28,6 +28,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#include "global.inc.hlsl"
|
||||
|
||||
// *INDENT-OFF*
|
||||
struct VS_IN {
|
||||
float4 position : POSITION;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
|
@ -40,8 +41,10 @@ struct VS_OUT {
|
|||
float4 position : POSITION;
|
||||
float2 texcoord0 : TEXCOORD0;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
void main( VS_IN vertex, out VS_OUT result ) {
|
||||
void main( VS_IN vertex, out VS_OUT result )
|
||||
{
|
||||
result.position = vertex.position;
|
||||
result.texcoord0 = vertex.texcoord;
|
||||
}
|
|
@ -2,10 +2,10 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 2016 Robert Beckebans
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
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
|
||||
|
@ -29,6 +29,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#include "global.inc.hlsl"
|
||||
|
||||
// *INDENT-OFF*
|
||||
uniform sampler2D samp0 : register(s0); // normal map
|
||||
|
||||
struct PS_IN
|
||||
|
@ -46,11 +47,12 @@ struct PS_OUT
|
|||
{
|
||||
float4 color : COLOR;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
void main( PS_IN fragment, out PS_OUT result )
|
||||
{
|
||||
float4 bump = tex2D( samp0, fragment.texcoord0 ) * 2.0f - 1.0f;
|
||||
|
||||
|
||||
// RB begin
|
||||
float3 localNormal;
|
||||
#if defined(USE_NORMAL_FMT_RGB8)
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 2016 Robert Beckebans
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
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
|
||||
|
@ -33,6 +33,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
uniform matrices_ubo { float4 matrices[408]; };
|
||||
#endif
|
||||
|
||||
// *INDENT-OFF*
|
||||
struct VS_IN {
|
||||
float4 position : POSITION;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
|
@ -51,9 +52,11 @@ struct VS_OUT {
|
|||
float3 texcoord4 : TEXCOORD4;
|
||||
float4 color : COLOR0;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
void main( VS_IN vertex, out VS_OUT result )
|
||||
{
|
||||
|
||||
void main( VS_IN vertex, out VS_OUT result ) {
|
||||
|
||||
float4 vNormal = vertex.normal * 2.0 - 1.0;
|
||||
float4 vTangent = vertex.tangent * 2.0 - 1.0;
|
||||
float3 vBitangent = cross( vNormal.xyz, vTangent.xyz ) * vTangent.w;
|
||||
|
@ -70,25 +73,25 @@ void main( VS_IN vertex, out VS_OUT result ) {
|
|||
const float w3 = vertex.color2.w;
|
||||
|
||||
float4 matX, matY, matZ; // must be float4 for vec4
|
||||
int joint = int(vertex.color.x * 255.1 * 3.0);
|
||||
matX = matrices[int(joint+0)] * w0;
|
||||
matY = matrices[int(joint+1)] * w0;
|
||||
matZ = matrices[int(joint+2)] * w0;
|
||||
int joint = int( vertex.color.x * 255.1 * 3.0 );
|
||||
matX = matrices[int( joint + 0 )] * w0;
|
||||
matY = matrices[int( joint + 1 )] * w0;
|
||||
matZ = matrices[int( joint + 2 )] * w0;
|
||||
|
||||
joint = int(vertex.color.y * 255.1 * 3.0);
|
||||
matX += matrices[int(joint+0)] * w1;
|
||||
matY += matrices[int(joint+1)] * w1;
|
||||
matZ += matrices[int(joint+2)] * w1;
|
||||
joint = int( vertex.color.y * 255.1 * 3.0 );
|
||||
matX += matrices[int( joint + 0 )] * w1;
|
||||
matY += matrices[int( joint + 1 )] * w1;
|
||||
matZ += matrices[int( joint + 2 )] * w1;
|
||||
|
||||
joint = int(vertex.color.z * 255.1 * 3.0);
|
||||
matX += matrices[int(joint+0)] * w2;
|
||||
matY += matrices[int(joint+1)] * w2;
|
||||
matZ += matrices[int(joint+2)] * w2;
|
||||
joint = int( vertex.color.z * 255.1 * 3.0 );
|
||||
matX += matrices[int( joint + 0 )] * w2;
|
||||
matY += matrices[int( joint + 1 )] * w2;
|
||||
matZ += matrices[int( joint + 2 )] * w2;
|
||||
|
||||
joint = int(vertex.color.w * 255.1 * 3.0);
|
||||
matX += matrices[int(joint+0)] * w3;
|
||||
matY += matrices[int(joint+1)] * w3;
|
||||
matZ += matrices[int(joint+2)] * w3;
|
||||
joint = int( vertex.color.w * 255.1 * 3.0 );
|
||||
matX += matrices[int( joint + 0 )] * w3;
|
||||
matY += matrices[int( joint + 1 )] * w3;
|
||||
matZ += matrices[int( joint + 2 )] * w3;
|
||||
|
||||
float3 normal;
|
||||
normal.x = dot3( matX, vNormal );
|
||||
|
@ -147,8 +150,8 @@ void main( VS_IN vertex, out VS_OUT result ) {
|
|||
|
||||
result.texcoord2.z = dot3( normal, rpModelMatrixX );
|
||||
result.texcoord3.z = dot3( normal, rpModelMatrixY );
|
||||
result.texcoord4.z = dot3( normal, rpModelMatrixZ );
|
||||
|
||||
result.texcoord4.z = dot3( normal, rpModelMatrixZ );
|
||||
|
||||
#else
|
||||
// rotate into view space
|
||||
result.texcoord2.x = dot3( tangent, rpModelViewMatrixX );
|
||||
|
@ -161,7 +164,7 @@ void main( VS_IN vertex, out VS_OUT result ) {
|
|||
|
||||
result.texcoord2.z = dot3( normal, rpModelViewMatrixX );
|
||||
result.texcoord3.z = dot3( normal, rpModelViewMatrixY );
|
||||
result.texcoord4.z = dot3( normal, rpModelViewMatrixZ );
|
||||
result.texcoord4.z = dot3( normal, rpModelViewMatrixZ );
|
||||
#endif
|
||||
|
||||
#if defined( USE_GPU_SKINNING )
|
||||
|
@ -173,7 +176,7 @@ void main( VS_IN vertex, out VS_OUT result ) {
|
|||
//# generate the vertex color, which can be 1.0, color, or 1.0 - color
|
||||
//# for 1.0 : env[16] = 0, env[17] = 1
|
||||
//# for color : env[16] = 1, env[17] = 0
|
||||
//# for 1.0-color : env[16] = -1, env[17] = 1
|
||||
//# for 1.0-color : env[16] = -1, env[17] = 1
|
||||
result.color = ( swizzleColor( vertex.color ) * rpVertexColorModulate ) + rpVertexColorAdd;
|
||||
#endif
|
||||
}
|
|
@ -2,10 +2,10 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 2013-2020 Robert Beckebans
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
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
|
||||
|
@ -27,6 +27,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
===========================================================================
|
||||
*/
|
||||
|
||||
// *INDENT-OFF*
|
||||
uniform float4 rpScreenCorrectionFactor : register(c0);
|
||||
uniform float4 rpWindowCoord : register(c1);
|
||||
uniform float4 rpDiffuseModifier : register(c2);
|
||||
|
@ -119,9 +120,11 @@ static float dot3( float4 a, float4 b ) { return dot( a.xyz, b.xyz ); }
|
|||
static float dot4( float4 a, float4 b ) { return dot( a, b ); }
|
||||
static float dot4( float2 a, float4 b ) { return dot( float4( a, 0, 1 ), b ); }
|
||||
|
||||
// *INDENT-ON*
|
||||
|
||||
// RB begin
|
||||
#ifndef PI
|
||||
#define PI 3.14159265358979323846
|
||||
#define PI 3.14159265358979323846
|
||||
#endif
|
||||
|
||||
#define DEG2RAD( a ) ( ( a ) * PI / 180.0f )
|
||||
|
@ -174,16 +177,17 @@ half4 LinearRGBToSRGB( half4 rgba )
|
|||
// ----------------------
|
||||
// YCoCg Color Conversion
|
||||
// ----------------------
|
||||
static const half4 matrixRGB1toCoCg1YX = half4( 0.50, 0.0, -0.50, 0.50196078 ); // Co
|
||||
static const half4 matrixRGB1toCoCg1YX = half4( 0.50, 0.0, -0.50, 0.50196078 ); // Co
|
||||
static const half4 matrixRGB1toCoCg1YY = half4( -0.25, 0.5, -0.25, 0.50196078 ); // Cg
|
||||
static const half4 matrixRGB1toCoCg1YZ = half4( 0.0, 0.0, 0.0, 1.0 ); // 1.0
|
||||
static const half4 matrixRGB1toCoCg1YW = half4( 0.25, 0.5, 0.25, 0.0 ); // Y
|
||||
static const half4 matrixRGB1toCoCg1YZ = half4( 0.0, 0.0, 0.0, 1.0 ); // 1.0
|
||||
static const half4 matrixRGB1toCoCg1YW = half4( 0.25, 0.5, 0.25, 0.0 ); // Y
|
||||
|
||||
static const half4 matrixCoCg1YtoRGB1X = half4( 1.0, -1.0, 0.0, 1.0 );
|
||||
static const half4 matrixCoCg1YtoRGB1Y = half4( 0.0, 1.0, -0.50196078, 1.0 ); // -0.5 * 256.0 / 255.0
|
||||
static const half4 matrixCoCg1YtoRGB1X = half4( 1.0, -1.0, 0.0, 1.0 );
|
||||
static const half4 matrixCoCg1YtoRGB1Y = half4( 0.0, 1.0, -0.50196078, 1.0 ); // -0.5 * 256.0 / 255.0
|
||||
static const half4 matrixCoCg1YtoRGB1Z = half4( -1.0, -1.0, 1.00392156, 1.0 ); // +1.0 * 256.0 / 255.0
|
||||
|
||||
static half3 ConvertYCoCgToRGB( half4 YCoCg ) {
|
||||
static half3 ConvertYCoCgToRGB( half4 YCoCg )
|
||||
{
|
||||
half3 rgbColor;
|
||||
|
||||
YCoCg.z = ( YCoCg.z * 31.875 ) + 1.0; //z = z * 255.0/8.0 + 1.0
|
||||
|
@ -195,7 +199,8 @@ static half3 ConvertYCoCgToRGB( half4 YCoCg ) {
|
|||
return rgbColor;
|
||||
}
|
||||
|
||||
static float2 CenterScale( float2 inTC, float2 centerScale ) {
|
||||
static float2 CenterScale( float2 inTC, float2 centerScale )
|
||||
{
|
||||
float scaleX = centerScale.x;
|
||||
float scaleY = centerScale.y;
|
||||
float4 tc0 = float4( scaleX, 0, 0, 0.5 - ( 0.5f * scaleX ) );
|
||||
|
@ -207,7 +212,8 @@ static float2 CenterScale( float2 inTC, float2 centerScale ) {
|
|||
return finalTC;
|
||||
}
|
||||
|
||||
static float2 Rotate2D( float2 inTC, float2 cs ) {
|
||||
static float2 Rotate2D( float2 inTC, float2 cs )
|
||||
{
|
||||
float sinValue = cs.y;
|
||||
float cosValue = cs.x;
|
||||
|
||||
|
@ -221,8 +227,9 @@ static float2 Rotate2D( float2 inTC, float2 cs ) {
|
|||
}
|
||||
|
||||
// better noise function available at https://github.com/ashima/webgl-noise
|
||||
float rand( float2 co ) {
|
||||
return frac( sin( dot( co.xy, float2( 12.9898, 78.233 ) ) ) * 43758.5453 );
|
||||
float rand( float2 co )
|
||||
{
|
||||
return frac( sin( dot( co.xy, float2( 12.9898, 78.233 ) ) ) * 43758.5453 );
|
||||
}
|
||||
|
||||
#define square( x ) ( x * x )
|
||||
|
@ -238,13 +245,19 @@ static const half4 LUMINANCE_LINEAR = half4( 0.299, 0.587, 0.144, 0.0 );
|
|||
#define _float4( x ) float4( x )
|
||||
|
||||
#define VPOS WPOS
|
||||
static float4 idtex2Dproj( sampler2D samp, float4 texCoords ) { return tex2Dproj( samp, texCoords.xyw ); }
|
||||
static float4 swizzleColor( float4 c )
|
||||
{
|
||||
return c;
|
||||
//return sRGBAToLinearRGBA( c );
|
||||
static float4 idtex2Dproj( sampler2D samp, float4 texCoords )
|
||||
{
|
||||
return tex2Dproj( samp, texCoords.xyw );
|
||||
}
|
||||
static float4 swizzleColor( float4 c )
|
||||
{
|
||||
return c;
|
||||
//return sRGBAToLinearRGBA( c );
|
||||
}
|
||||
static float2 vposToScreenPosTexCoord( float2 vpos )
|
||||
{
|
||||
return vpos.xy * rpWindowCoord.xy;
|
||||
}
|
||||
static float2 vposToScreenPosTexCoord( float2 vpos ) { return vpos.xy * rpWindowCoord.xy; }
|
||||
|
||||
#define BRANCH
|
||||
#define IFANY
|
||||
|
@ -265,7 +278,7 @@ float RemapNoiseTriErp( const float v )
|
|||
// http://advances.realtimerendering.com/s2014/index.html
|
||||
float InterleavedGradientNoise( float2 uv )
|
||||
{
|
||||
|
||||
|
||||
const float3 magic = float3( 0.06711056, 0.00583715, 52.9829189 );
|
||||
float rnd = fract( magic.z * fract( dot( uv, magic.xy ) ) );
|
||||
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
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").
|
||||
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
|
||||
|
@ -28,6 +28,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#include "global.inc.hlsl"
|
||||
|
||||
// *INDENT-OFF*
|
||||
uniform sampler2D samp0 : register(s0);
|
||||
|
||||
struct PS_IN {
|
||||
|
@ -40,8 +41,10 @@ struct PS_IN {
|
|||
struct PS_OUT {
|
||||
float4 color : COLOR;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
void main( PS_IN fragment, out PS_OUT result ) {
|
||||
void main( PS_IN fragment, out PS_OUT result )
|
||||
{
|
||||
float4 color = ( tex2D( samp0, fragment.texcoord0 ) * fragment.color ) + fragment.texcoord1;
|
||||
result.color.xyz = color.xyz * color.w;
|
||||
result.color.w = color.w;
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 2013 Robert Beckebans
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
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
|
||||
|
@ -29,6 +29,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#include "global.inc.hlsl"
|
||||
|
||||
// *INDENT-OFF*
|
||||
struct VS_IN {
|
||||
float4 position : POSITION;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
|
@ -44,8 +45,10 @@ struct VS_OUT {
|
|||
float4 texcoord1 : TEXCOORD1;
|
||||
float4 color : COLOR0;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
void main( VS_IN vertex, out VS_OUT result ) {
|
||||
void main( VS_IN vertex, out VS_OUT result )
|
||||
{
|
||||
result.position.x = dot4( vertex.position, rpMVPmatrixX );
|
||||
result.position.y = dot4( vertex.position, rpMVPmatrixY );
|
||||
result.position.z = dot4( vertex.position, rpMVPmatrixZ );
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 2014-2015 Robert Beckebans
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
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
|
||||
|
@ -29,6 +29,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#include "global.inc.hlsl"
|
||||
|
||||
// *INDENT-OFF*
|
||||
uniform sampler2D samp0 : register(s0);
|
||||
|
||||
struct PS_IN
|
||||
|
@ -41,6 +42,7 @@ struct PS_OUT
|
|||
{
|
||||
float4 color : COLOR;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
float linterp( float t )
|
||||
{
|
||||
|
@ -65,63 +67,63 @@ float3 spectrumoffset( float t )
|
|||
void main( PS_IN fragment, out PS_OUT result )
|
||||
{
|
||||
float2 st = fragment.texcoord0;
|
||||
|
||||
|
||||
// base color with tone mapping applied
|
||||
float4 color = tex2D( samp0, st );
|
||||
|
||||
const float gaussFact[9] = float[9](0.13298076, 0.12579441, 0.10648267, 0.08065691, 0.05467002, 0.03315905, 0.01799699, 0.00874063, 0.00379866);
|
||||
|
||||
|
||||
const float gaussFact[9] = float[9]( 0.13298076, 0.12579441, 0.10648267, 0.08065691, 0.05467002, 0.03315905, 0.01799699, 0.00874063, 0.00379866 );
|
||||
|
||||
const float3 chromaticOffsets[9] = float3[](
|
||||
float3(0.5, 0.5, 0.5), // w
|
||||
float3(0.8, 0.3, 0.3),
|
||||
float3( 0.5, 0.5, 0.5 ), // w
|
||||
float3( 0.8, 0.3, 0.3 ),
|
||||
// float3(1.0, 0.2, 0.2), // r
|
||||
float3(0.5, 0.2, 0.8),
|
||||
float3(0.2, 0.2, 1.0), // b
|
||||
float3(0.2, 0.3, 0.9),
|
||||
float3(0.2, 0.9, 0.2), // g
|
||||
float3(0.3, 0.5, 0.3),
|
||||
float3(0.3, 0.5, 0.3),
|
||||
float3(0.3, 0.5, 0.3)
|
||||
//float3(0.3, 0.5, 0.3)
|
||||
);
|
||||
|
||||
float3( 0.5, 0.2, 0.8 ),
|
||||
float3( 0.2, 0.2, 1.0 ), // b
|
||||
float3( 0.2, 0.3, 0.9 ),
|
||||
float3( 0.2, 0.9, 0.2 ), // g
|
||||
float3( 0.3, 0.5, 0.3 ),
|
||||
float3( 0.3, 0.5, 0.3 ),
|
||||
float3( 0.3, 0.5, 0.3 )
|
||||
//float3(0.3, 0.5, 0.3)
|
||||
);
|
||||
|
||||
float3 sumColor = float3( 0.0 );
|
||||
float3 sumSpectrum = float3( 0.0 );
|
||||
|
||||
const int tap = 4;
|
||||
const int samples = 9;
|
||||
|
||||
|
||||
float scale = 13.0; // bloom width
|
||||
const float weightScale = 2.3; // bloom strength
|
||||
|
||||
|
||||
for( int i = 0; i < samples; i++ )
|
||||
{
|
||||
//float t = ( ( float( 4 + ( i ) ) ) / ( float( samples ) - 1.0 ) );
|
||||
{
|
||||
//float t = ( ( float( 4 + ( i ) ) ) / ( float( samples ) - 1.0 ) );
|
||||
//float t = log2( float( i ) / ( float( samples ) - 1.0 ) );
|
||||
//float t = ( float( i ) / ( float( samples ) - 1.0 ) );
|
||||
|
||||
|
||||
//float3 so = spectrumoffset( t );
|
||||
float3 so = chromaticOffsets[ i ];
|
||||
float4 color = tex2D( samp0, st + float2( float( i ), 0 ) * rpWindowCoord.xy * scale );
|
||||
|
||||
|
||||
float weight = gaussFact[ i ];
|
||||
sumColor += color.rgb * ( so.rgb * weight * weightScale );
|
||||
}
|
||||
|
||||
|
||||
#if 1
|
||||
for( int i = 1; i < samples; i++ )
|
||||
{
|
||||
//float t = ( ( float( 4 + ( i ) ) ) / ( float( samples ) - 1.0 ) );
|
||||
|
||||
{
|
||||
//float t = ( ( float( 4 + ( i ) ) ) / ( float( samples ) - 1.0 ) );
|
||||
|
||||
//float3 so = spectrumoffset( t );
|
||||
float3 so = chromaticOffsets[ i ];
|
||||
float4 color = tex2D( samp0, st + float2( float( -i ), 0 ) * rpWindowCoord.xy * scale );
|
||||
|
||||
|
||||
float weight = gaussFact[ i ];
|
||||
sumColor += color.rgb * ( so.rgb * weight * weightScale );
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
result.color = float4( sumColor, 1.0 );
|
||||
//result.color = float4( sumColor / float(samples), 1.0 );
|
||||
//result.color = float4( sumColor / sumSpectrum, 1.0 );
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
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").
|
||||
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
|
||||
|
@ -28,6 +28,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#include "global.inc.hlsl"
|
||||
|
||||
// *INDENT-OFF*
|
||||
struct VS_IN {
|
||||
float4 position : POSITION;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
|
@ -40,8 +41,10 @@ struct VS_OUT {
|
|||
float4 position : POSITION;
|
||||
float2 texcoord0 : TEXCOORD0;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
void main( VS_IN vertex, out VS_OUT result ) {
|
||||
void main( VS_IN vertex, out VS_OUT result )
|
||||
{
|
||||
result.position = vertex.position;
|
||||
|
||||
//result.position.x = vertex.position; //dot4( vertex.position, rpMVPmatrixX );
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
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").
|
||||
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
|
||||
|
@ -28,6 +28,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#include "global.inc.hlsl"
|
||||
|
||||
// *INDENT-OFF*
|
||||
uniform sampler2D samp0 : register(s0); // texture 0 is _current Render
|
||||
uniform sampler2D samp1 : register(s1); // texture 1 is the per-surface bump map
|
||||
uniform sampler2D samp2 : register(s2); // texture 2 is the mask texture
|
||||
|
@ -42,8 +43,10 @@ struct PS_IN {
|
|||
struct PS_OUT {
|
||||
float4 color : COLOR;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
void main( PS_IN fragment, out PS_OUT result ) {
|
||||
void main( PS_IN fragment, out PS_OUT result )
|
||||
{
|
||||
|
||||
// load the distortion map
|
||||
float4 mask = tex2D( samp2, fragment.texcoord0.xy );
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 2013 Robert Beckebans
|
||||
Copyright (C) 2013 Robert Beckebans
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
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
|
||||
|
@ -35,6 +35,7 @@ uniform matrices_ubo { float4 matrices[408]; };
|
|||
#endif
|
||||
// RB end
|
||||
|
||||
// *INDENT-OFF*
|
||||
uniform float4 rpUser0 : register(c128); // rpScroll
|
||||
uniform float4 rpUser1 : register(c129); // rpDeformMagnitude
|
||||
|
||||
|
@ -53,10 +54,12 @@ struct VS_OUT {
|
|||
float4 texcoord1 : TEXCOORD1;
|
||||
float4 texcoord2 : TEXCOORD2;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
void main( VS_IN vertex, out VS_OUT result ) {
|
||||
void main( VS_IN vertex, out VS_OUT result )
|
||||
{
|
||||
|
||||
#include "skinning.inc.hlsl"
|
||||
#include "skinning.inc.hlsl"
|
||||
|
||||
// texture 0 takes the texture coordinates unmodified
|
||||
result.texcoord0 = float4( vertex.texcoord.xy, 0, 0 );
|
||||
|
@ -69,12 +72,12 @@ void main( VS_IN vertex, out VS_OUT result ) {
|
|||
float4 vec = float4( 0, 1, 0, 1 );
|
||||
vec.z = dot4( modelPosition, rpModelViewMatrixZ );
|
||||
|
||||
// magicProjectionAdjust is a magic scalar that scales the projection since we changed from
|
||||
// using the X axis to the Y axis to calculate R1. It is an approximation to closely match
|
||||
// magicProjectionAdjust is a magic scalar that scales the projection since we changed from
|
||||
// using the X axis to the Y axis to calculate R1. It is an approximation to closely match
|
||||
// what the original game did
|
||||
const float magicProjectionAdjust = 0.43f;
|
||||
float x = dot4 ( vec, rpProjectionMatrixY ) * magicProjectionAdjust;
|
||||
float w = dot4 ( vec, rpProjectionMatrixW );
|
||||
float x = dot4( vec, rpProjectionMatrixY ) * magicProjectionAdjust;
|
||||
float w = dot4( vec, rpProjectionMatrixW );
|
||||
|
||||
// don't let the recip get near zero for polygons that cross the view plane
|
||||
w = max( w, 1.0 );
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
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").
|
||||
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
|
||||
|
@ -28,6 +28,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#include "global.inc.hlsl"
|
||||
|
||||
// *INDENT-OFF*
|
||||
uniform sampler2D samp0 : register(s0); // texture 0 is _current Render
|
||||
uniform sampler2D samp1 : register(s1); // texture 1 is the per-surface bump map
|
||||
uniform sampler2D samp2 : register(s2); // texture 2 is the mask texture
|
||||
|
@ -43,8 +44,10 @@ struct PS_IN {
|
|||
struct PS_OUT {
|
||||
float4 color : COLOR;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
void main( PS_IN fragment, out PS_OUT result ) {
|
||||
void main( PS_IN fragment, out PS_OUT result )
|
||||
{
|
||||
|
||||
// load the distortion map
|
||||
float4 mask = tex2D( samp2, fragment.texcoord0.xy );
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 2013 Robert Beckebans
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 2013 Robert Beckebans
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
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
|
||||
|
@ -35,6 +35,7 @@ uniform matrices_ubo { float4 matrices[408]; };
|
|||
#endif
|
||||
// RB end
|
||||
|
||||
// *INDENT-OFF*
|
||||
uniform float4 rpUser0 : register(c128); // rpScroll
|
||||
uniform float4 rpUser1 : register(c129); // rpDeformMagnitude
|
||||
|
||||
|
@ -54,10 +55,12 @@ struct VS_OUT {
|
|||
float4 texcoord2 : TEXCOORD2;
|
||||
float4 color : COLOR0;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
void main( VS_IN vertex, out VS_OUT result ) {
|
||||
void main( VS_IN vertex, out VS_OUT result )
|
||||
{
|
||||
|
||||
#include "skinning.inc.hlsl"
|
||||
#include "skinning.inc.hlsl"
|
||||
|
||||
// texture 0 takes the texture coordinates unmodified
|
||||
result.texcoord0 = float4( vertex.texcoord, 0 , 0 );
|
||||
|
@ -70,11 +73,11 @@ void main( VS_IN vertex, out VS_OUT result ) {
|
|||
float4 vec = float4( 0, 1, 0, 1 );
|
||||
vec.z = dot4( modelPosition, rpModelViewMatrixZ );
|
||||
|
||||
// magicProjectionAdjust is a magic scalar that scales the projection since we changed from
|
||||
// using the X axis to the Y axis to calculate x. It is an approximation to closely match
|
||||
// magicProjectionAdjust is a magic scalar that scales the projection since we changed from
|
||||
// using the X axis to the Y axis to calculate x. It is an approximation to closely match
|
||||
// what the original game did
|
||||
const float magicProjectionAdjust = 0.43f;
|
||||
float x = dot4 ( vec, rpProjectionMatrixY ) * magicProjectionAdjust;
|
||||
float x = dot4( vec, rpProjectionMatrixY ) * magicProjectionAdjust;
|
||||
float w = dot4( vec, rpProjectionMatrixW );
|
||||
|
||||
// don't let the recip get near zero for polygons that cross the view plane
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 2013-2014 Robert Beckebans
|
||||
Copyright (C) 2013-2014 Robert Beckebans
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
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
|
||||
|
@ -29,6 +29,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#include "global.inc.hlsl"
|
||||
|
||||
// *INDENT-OFF*
|
||||
uniform sampler2D samp0 : register(s0); // texture 0 is _current Render
|
||||
uniform sampler2D samp1 : register(s1); // texture 1 is the per-surface bump map
|
||||
|
||||
|
@ -41,8 +42,10 @@ struct PS_IN {
|
|||
struct PS_OUT {
|
||||
float4 color : COLOR;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
void main( PS_IN fragment, out PS_OUT result ) {
|
||||
void main( PS_IN fragment, out PS_OUT result )
|
||||
{
|
||||
|
||||
// load the filtered normal map and convert to -1 to 1 range
|
||||
float4 bumpMap = ( tex2D( samp1, fragment.texcoord0.xy ) * 2.0f ) - 1.0f;
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 2013 Robert Beckebans
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
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
|
||||
|
@ -31,6 +31,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
// User Renderparms start at 128 as per renderprogs.h
|
||||
|
||||
// *INDENT-OFF*
|
||||
uniform float4 rpUser0 : register(c128); // rpScroll
|
||||
uniform float4 rpUser1 : register(c129); // rpDeformMagnitude
|
||||
|
||||
|
@ -54,10 +55,12 @@ struct VS_OUT {
|
|||
float4 texcoord0 : TEXCOORD0;
|
||||
float4 texcoord1 : TEXCOORD1;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
void main( VS_IN vertex, out VS_OUT result ) {
|
||||
void main( VS_IN vertex, out VS_OUT result )
|
||||
{
|
||||
|
||||
#include "skinning.inc.hlsl"
|
||||
#include "skinning.inc.hlsl"
|
||||
|
||||
//texture 0 takes the texture coordinates and adds a scroll
|
||||
const float4 textureScroll = rpUser0;
|
||||
|
@ -67,8 +70,8 @@ void main( VS_IN vertex, out VS_OUT result ) {
|
|||
float4 vec = float4( 0, 1, 0, 1 );
|
||||
vec.z = dot4( modelPosition, rpModelViewMatrixZ ); // this is the modelview matrix
|
||||
|
||||
// magicProjectionAdjust is a magic scalar that scales the projection since we changed from
|
||||
// using the X axis to the Y axis to calculate x. It is an approximation to closely match
|
||||
// magicProjectionAdjust is a magic scalar that scales the projection since we changed from
|
||||
// using the X axis to the Y axis to calculate x. It is an approximation to closely match
|
||||
// what the original game did
|
||||
const float magicProjectionAdjust = 0.43f;
|
||||
float x = dot4( vec, rpProjectionMatrixY ) * magicProjectionAdjust;
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 2013-2020 Robert Beckebans
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
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
|
||||
|
@ -30,6 +30,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#include "global.inc.hlsl"
|
||||
#include "BRDF.inc.hlsl"
|
||||
|
||||
// *INDENT-OFF*
|
||||
uniform sampler2D samp0 : register(s0); // texture 1 is the per-surface normal map
|
||||
uniform sampler2D samp1 : register(s1); // texture 3 is the per-surface specular or roughness/metallic/AO mixer map
|
||||
uniform sampler2D samp2 : register(s2); // texture 2 is the per-surface baseColor map
|
||||
|
@ -53,12 +54,13 @@ struct PS_OUT
|
|||
{
|
||||
half4 color : COLOR;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
void main( PS_IN fragment, out PS_OUT result )
|
||||
{
|
||||
half4 bumpMap = tex2D( samp0, fragment.texcoord1.xy );
|
||||
half4 lightFalloff = ( idtex2Dproj( samp3, fragment.texcoord2 ) );
|
||||
half4 lightProj = ( idtex2Dproj( samp4, fragment.texcoord3 ) );
|
||||
half4 lightProj = ( idtex2Dproj( samp4, fragment.texcoord3 ) );
|
||||
half4 YCoCG = tex2D( samp2, fragment.texcoord4.xy );
|
||||
half4 specMapSRGB = tex2D( samp1, fragment.texcoord5.xy );
|
||||
half4 specMap = sRGBAToLinearRGBA( specMapSRGB );
|
||||
|
@ -77,7 +79,7 @@ void main( PS_IN fragment, out PS_OUT result )
|
|||
// RB end
|
||||
localNormal.z = sqrt( abs( dot( localNormal.xy, localNormal.xy ) - 0.25 ) );
|
||||
localNormal = normalize( localNormal );
|
||||
|
||||
|
||||
// traditional very dark Lambert light model used in Doom 3
|
||||
half ldotN = saturate( dot3( localNormal, lightVector ) );
|
||||
|
||||
|
@ -97,7 +99,7 @@ void main( PS_IN fragment, out PS_OUT result )
|
|||
half hdotN = clamp( dot3( halfAngleVector, localNormal ), 0.0, 1.0 );
|
||||
|
||||
#if 1
|
||||
|
||||
|
||||
#if defined( USE_PBR )
|
||||
const half metallic = specMapSRGB.g;
|
||||
const half roughness = specMapSRGB.r;
|
||||
|
@ -105,84 +107,84 @@ void main( PS_IN fragment, out PS_OUT result )
|
|||
|
||||
// the vast majority of real-world materials (anything not metal or gems) have F(0°)
|
||||
// values in a very narrow range (~0.02 - 0.08)
|
||||
|
||||
|
||||
// approximate non-metals with linear RGB 0.04 which is 0.08 * 0.5 (default in UE4)
|
||||
const half3 dielectricColor = half3( 0.04 );
|
||||
|
||||
|
||||
// derive diffuse and specular from albedo(m) base color
|
||||
const half3 baseColor = diffuseMap;
|
||||
|
||||
|
||||
half3 diffuseColor = baseColor * ( 1.0 - metallic );
|
||||
half3 specularColor = lerp( dielectricColor, baseColor, metallic );
|
||||
#else
|
||||
// HACK calculate roughness from D3 gloss maps
|
||||
float Y = dot( LUMINANCE_SRGB.rgb, specMapSRGB.rgb );
|
||||
|
||||
|
||||
//const float glossiness = clamp( 1.0 - specMapSRGB.r, 0.0, 0.98 );
|
||||
const float glossiness = clamp( pow( Y, 1.0 / 2.0 ), 0.0, 0.98 );
|
||||
|
||||
|
||||
const float roughness = 1.0 - glossiness;
|
||||
|
||||
|
||||
half3 diffuseColor = diffuseMap;
|
||||
half3 specularColor = specMapSRGB.rgb; // RB: should be linear but it looks too flat
|
||||
half3 specularColor = specMapSRGB.rgb; // RB: should be linear but it looks too flat
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
// RB: compensate r_lightScale 3 and the division of Pi
|
||||
//lambert *= 1.3;
|
||||
|
||||
|
||||
// rpDiffuseModifier contains light color multiplier
|
||||
half3 lightColor = sRGBToLinearRGB( lightProj.xyz * lightFalloff.xyz );// * rpDiffuseModifier.xyz;
|
||||
|
||||
|
||||
half vdotN = clamp( dot3( viewVector, localNormal ), 0.0, 1.0 );
|
||||
half vdotH = clamp( dot3( viewVector, halfAngleVector ), 0.0, 1.0 );
|
||||
half ldotH = clamp( dot3( lightVector, halfAngleVector ), 0.0, 1.0 );
|
||||
|
||||
|
||||
// compensate r_lightScale 3 * 2
|
||||
half3 reflectColor = specularColor * rpSpecularModifier.rgb * 1.0;// * 0.5;
|
||||
|
||||
|
||||
// cheap approximation by ARM with only one division
|
||||
// http://community.arm.com/servlet/JiveServlet/download/96891546-19496/siggraph2015-mmg-renaldas-slides.pdf
|
||||
// page 26
|
||||
|
||||
|
||||
float rr = roughness * roughness;
|
||||
float rrrr = rr * rr;
|
||||
|
||||
|
||||
// disney GGX
|
||||
float D = ( hdotN * hdotN ) * ( rrrr - 1.0 ) + 1.0;
|
||||
float VFapprox = ( ldotH * ldotH ) * ( roughness + 0.5 );
|
||||
half3 specularBRDF = ( rrrr / ( 4.0 * PI * D * D * VFapprox ) ) * ldotN * reflectColor;
|
||||
//specularBRDF = half3( 0.0 );
|
||||
|
||||
|
||||
#if 0
|
||||
result.color = float4( _half3( VFapprox ), 1.0 );
|
||||
return;
|
||||
#endif
|
||||
|
||||
|
||||
// see http://seblagarde.wordpress.com/2012/01/08/pi-or-not-to-pi-in-game-lighting-equation/
|
||||
//lambert /= PI;
|
||||
|
||||
|
||||
//half3 diffuseColor = mix( diffuseMap, F0, metal ) * rpDiffuseModifier.xyz;
|
||||
half3 diffuseBRDF = diffuseColor * lambert * sRGBToLinearRGB( rpDiffuseModifier.xyz );
|
||||
|
||||
|
||||
result.color.xyz = ( diffuseBRDF + specularBRDF ) * lightColor * fragment.color.rgb;
|
||||
result.color.w = 1.0;
|
||||
|
||||
|
||||
#else
|
||||
|
||||
|
||||
/*
|
||||
OLD Blinn Phong
|
||||
*/
|
||||
|
||||
const half specularPower = 10.0f;
|
||||
|
||||
|
||||
// RB: added abs
|
||||
half3 specularContribution = _half3( pow( hdotN, specularPower ) );
|
||||
|
||||
half3 diffuseColor = diffuseMap * sRGBToLinearRGB( rpDiffuseModifier.xyz );
|
||||
half3 specularColor = specMap.xyz * specularContribution * sRGBToLinearRGB( rpSpecularModifier.xyz );
|
||||
half3 lightColor = sRGBToLinearRGB( lightProj.xyz * lightFalloff.xyz );
|
||||
|
||||
|
||||
/*
|
||||
half rim = 1.0f - saturate( hdotN );
|
||||
half rimPower = 16.0f;
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 2014 Robert Beckebans
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
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
|
||||
|
@ -33,6 +33,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
uniform matrices_ubo { float4 matrices[408]; };
|
||||
#endif
|
||||
|
||||
// *INDENT-OFF*
|
||||
struct VS_IN {
|
||||
float4 position : POSITION;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
|
@ -53,8 +54,10 @@ struct VS_OUT {
|
|||
float4 texcoord6 : TEXCOORD6;
|
||||
float4 color : COLOR0;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
void main( VS_IN vertex, out VS_OUT result ) {
|
||||
void main( VS_IN vertex, out VS_OUT result )
|
||||
{
|
||||
|
||||
float4 vNormal = vertex.normal * 2.0 - 1.0;
|
||||
float4 vTangent = vertex.tangent * 2.0 - 1.0;
|
||||
|
@ -72,25 +75,25 @@ void main( VS_IN vertex, out VS_OUT result ) {
|
|||
const float w3 = vertex.color2.w;
|
||||
|
||||
float4 matX, matY, matZ; // must be float4 for vec4
|
||||
int joint = int(vertex.color.x * 255.1 * 3.0);
|
||||
matX = matrices[int(joint+0)] * w0;
|
||||
matY = matrices[int(joint+1)] * w0;
|
||||
matZ = matrices[int(joint+2)] * w0;
|
||||
int joint = int( vertex.color.x * 255.1 * 3.0 );
|
||||
matX = matrices[int( joint + 0 )] * w0;
|
||||
matY = matrices[int( joint + 1 )] * w0;
|
||||
matZ = matrices[int( joint + 2 )] * w0;
|
||||
|
||||
joint = int(vertex.color.y * 255.1 * 3.0);
|
||||
matX += matrices[int(joint+0)] * w1;
|
||||
matY += matrices[int(joint+1)] * w1;
|
||||
matZ += matrices[int(joint+2)] * w1;
|
||||
joint = int( vertex.color.y * 255.1 * 3.0 );
|
||||
matX += matrices[int( joint + 0 )] * w1;
|
||||
matY += matrices[int( joint + 1 )] * w1;
|
||||
matZ += matrices[int( joint + 2 )] * w1;
|
||||
|
||||
joint = int(vertex.color.z * 255.1 * 3.0);
|
||||
matX += matrices[int(joint+0)] * w2;
|
||||
matY += matrices[int(joint+1)] * w2;
|
||||
matZ += matrices[int(joint+2)] * w2;
|
||||
joint = int( vertex.color.z * 255.1 * 3.0 );
|
||||
matX += matrices[int( joint + 0 )] * w2;
|
||||
matY += matrices[int( joint + 1 )] * w2;
|
||||
matZ += matrices[int( joint + 2 )] * w2;
|
||||
|
||||
joint = int(vertex.color.w * 255.1 * 3.0);
|
||||
matX += matrices[int(joint+0)] * w3;
|
||||
matY += matrices[int(joint+1)] * w3;
|
||||
matZ += matrices[int(joint+2)] * w3;
|
||||
joint = int( vertex.color.w * 255.1 * 3.0 );
|
||||
matX += matrices[int( joint + 0 )] * w3;
|
||||
matY += matrices[int( joint + 1 )] * w3;
|
||||
matZ += matrices[int( joint + 2 )] * w3;
|
||||
|
||||
float3 normal;
|
||||
normal.x = dot3( matX, vNormal );
|
||||
|
@ -173,7 +176,7 @@ void main( VS_IN vertex, out VS_OUT result ) {
|
|||
|
||||
//# calculate normalized vector to viewer in R1
|
||||
float4 toView = normalize( rpLocalViewOrigin - modelPosition );
|
||||
|
||||
|
||||
//# put into texture space
|
||||
result.texcoord6.x = dot3( tangent, toView );
|
||||
result.texcoord6.y = dot3( bitangent, toView );
|
||||
|
@ -189,7 +192,7 @@ void main( VS_IN vertex, out VS_OUT result ) {
|
|||
//# generate the vertex color, which can be 1.0, color, or 1.0 - color
|
||||
//# for 1.0 : env[16] = 0, env[17] = 1
|
||||
//# for color : env[16] = 1, env[17] = 0
|
||||
//# for 1.0-color : env[16] = -1, env[17] = 1
|
||||
//# for 1.0-color : env[16] = -1, env[17] = 1
|
||||
result.color = ( swizzleColor( vertex.color ) * rpVertexColorModulate ) + rpVertexColorAdd;
|
||||
#endif
|
||||
}
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
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").
|
||||
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
|
||||
|
@ -28,6 +28,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#include "global.inc.hlsl"
|
||||
|
||||
// *INDENT-OFF*
|
||||
uniform sampler2D samp0 : register(s0); // texture 1 is the per-surface normal map
|
||||
uniform sampler2D samp1 : register(s1); // texture 3 is the per-surface specular or roughness/metallic/AO mixer map
|
||||
uniform sampler2D samp2 : register(s2); // texture 2 is the per-surface baseColor map
|
||||
|
@ -48,8 +49,10 @@ struct PS_IN {
|
|||
struct PS_OUT {
|
||||
half4 color : COLOR;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
void main( PS_IN fragment, out PS_OUT result ) {
|
||||
void main( PS_IN fragment, out PS_OUT result )
|
||||
{
|
||||
half4 bumpMap = tex2D( samp0, fragment.texcoord1.xy );
|
||||
half4 lightFalloff = idtex2Dproj( samp3, fragment.texcoord2 );
|
||||
half4 lightProj = idtex2Dproj( samp4, fragment.texcoord3 );
|
||||
|
@ -70,7 +73,7 @@ void main( PS_IN fragment, out PS_OUT result ) {
|
|||
// RB end
|
||||
localNormal.z = sqrt( abs( dot( localNormal.xy, localNormal.xy ) - 0.25 ) );
|
||||
localNormal = normalize( localNormal );
|
||||
|
||||
|
||||
// traditional very dark Lambert light model used in Doom 3
|
||||
half ldotN = saturate( dot3( localNormal, lightVector ) );
|
||||
|
||||
|
@ -83,7 +86,7 @@ void main( PS_IN fragment, out PS_OUT result ) {
|
|||
#else
|
||||
half lambert = ldotN;
|
||||
#endif
|
||||
|
||||
|
||||
const half specularPower = 10.0f;
|
||||
half hDotN = dot3( normalize( fragment.texcoord6.xyz ), localNormal );
|
||||
// RB: added abs
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
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").
|
||||
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
|
||||
|
@ -28,6 +28,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#include "global.inc.hlsl"
|
||||
|
||||
// *INDENT-OFF*
|
||||
struct VS_IN {
|
||||
float4 position : POSITION;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
|
@ -46,8 +47,10 @@ struct VS_OUT {
|
|||
float4 texcoord6 : TEXCOORD6;
|
||||
float4 color : COLOR0;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
void main( VS_IN vertex, out VS_OUT result ) {
|
||||
void main( VS_IN vertex, out VS_OUT result )
|
||||
{
|
||||
|
||||
float4 normal = vertex.normal * 2.0 - 1.0;
|
||||
float4 tangent = vertex.tangent * 2.0 - 1.0;
|
||||
|
@ -95,7 +98,7 @@ void main( VS_IN vertex, out VS_OUT result ) {
|
|||
|
||||
//# calculate normalized vector to viewer in R1
|
||||
float4 toView = normalize( rpLocalViewOrigin - vertex.position );
|
||||
|
||||
|
||||
//# add together to become the half angle vector in object space (non-normalized)
|
||||
float4 halfAngleVector = toLight + toView;
|
||||
|
||||
|
@ -108,6 +111,6 @@ void main( VS_IN vertex, out VS_OUT result ) {
|
|||
//# generate the vertex color, which can be 1.0, color, or 1.0 - color
|
||||
//# for 1.0 : env[16] = 0, env[17] = 1
|
||||
//# for color : env[16] = 1, env[17] = 0
|
||||
//# for 1.0-color : env[16] = -1, env[17] = 1
|
||||
//# for 1.0-color : env[16] = -1, env[17] = 1
|
||||
result.color = ( swizzleColor( vertex.color ) * rpVertexColorModulate ) + rpVertexColorAdd;
|
||||
}
|
|
@ -2,10 +2,10 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 2013 Robert Beckebans
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
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
|
||||
|
@ -29,6 +29,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#include "global.inc.hlsl"
|
||||
|
||||
// *INDENT-OFF*
|
||||
uniform sampler2D samp0 : register(s0); // texture 1 is the per-surface normal map
|
||||
uniform sampler2D samp1 : register(s1); // texture 3 is the per-surface specular or roughness/metallic/AO mixer map
|
||||
uniform sampler2D samp2 : register(s2); // texture 2 is the per-surface baseColor map
|
||||
|
@ -49,8 +50,10 @@ struct PS_IN {
|
|||
struct PS_OUT {
|
||||
half4 color : COLOR;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
void main( PS_IN fragment, out PS_OUT result ) {
|
||||
void main( PS_IN fragment, out PS_OUT result )
|
||||
{
|
||||
half4 bumpMap = tex2D( samp0, fragment.texcoord1.xy );
|
||||
half4 lightFalloff = idtex2Dproj( samp3, fragment.texcoord2 );
|
||||
half4 lightProj = idtex2Dproj( samp4, fragment.texcoord3 );
|
||||
|
@ -71,7 +74,7 @@ void main( PS_IN fragment, out PS_OUT result ) {
|
|||
// RB end
|
||||
localNormal.z = sqrt( abs( dot( localNormal.xy, localNormal.xy ) - 0.25 ) );
|
||||
localNormal = normalize( localNormal );
|
||||
|
||||
|
||||
// traditional very dark Lambert light model used in Doom 3
|
||||
half ldotN = saturate( dot3( localNormal, lightVector ) );
|
||||
|
||||
|
@ -84,7 +87,7 @@ void main( PS_IN fragment, out PS_OUT result ) {
|
|||
#else
|
||||
half lambert = ldotN;
|
||||
#endif
|
||||
|
||||
|
||||
const half specularPower = 10.0f;
|
||||
half hDotN = dot3( normalize( fragment.texcoord6.xyz ), localNormal );
|
||||
// RB: added abs
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 2014 Robert Beckebans
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
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
|
||||
|
@ -31,6 +31,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
uniform matrices_ubo { float4 matrices[408]; };
|
||||
|
||||
// *INDENT-OFF*
|
||||
struct VS_IN {
|
||||
float4 position : POSITION;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
|
@ -50,8 +51,10 @@ struct VS_OUT {
|
|||
float4 texcoord6 : TEXCOORD6;
|
||||
float4 color : COLOR0;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
void main( VS_IN vertex, out VS_OUT result ) {
|
||||
void main( VS_IN vertex, out VS_OUT result )
|
||||
{
|
||||
|
||||
float4 vNormal = vertex.normal * 2.0 - 1.0;
|
||||
float4 vTangent = vertex.tangent * 2.0 - 1.0;
|
||||
|
@ -68,25 +71,25 @@ void main( VS_IN vertex, out VS_OUT result ) {
|
|||
const float w3 = vertex.color2.w;
|
||||
|
||||
float4 matX, matY, matZ; // must be float4 for vec4
|
||||
int joint = int(vertex.color.x * 255.1 * 3.0);
|
||||
matX = matrices[int(joint+0)] * w0;
|
||||
matY = matrices[int(joint+1)] * w0;
|
||||
matZ = matrices[int(joint+2)] * w0;
|
||||
int joint = int( vertex.color.x * 255.1 * 3.0 );
|
||||
matX = matrices[int( joint + 0 )] * w0;
|
||||
matY = matrices[int( joint + 1 )] * w0;
|
||||
matZ = matrices[int( joint + 2 )] * w0;
|
||||
|
||||
joint = int(vertex.color.y * 255.1 * 3.0);
|
||||
matX += matrices[int(joint+0)] * w1;
|
||||
matY += matrices[int(joint+1)] * w1;
|
||||
matZ += matrices[int(joint+2)] * w1;
|
||||
joint = int( vertex.color.y * 255.1 * 3.0 );
|
||||
matX += matrices[int( joint + 0 )] * w1;
|
||||
matY += matrices[int( joint + 1 )] * w1;
|
||||
matZ += matrices[int( joint + 2 )] * w1;
|
||||
|
||||
joint = int(vertex.color.z * 255.1 * 3.0);
|
||||
matX += matrices[int(joint+0)] * w2;
|
||||
matY += matrices[int(joint+1)] * w2;
|
||||
matZ += matrices[int(joint+2)] * w2;
|
||||
joint = int( vertex.color.z * 255.1 * 3.0 );
|
||||
matX += matrices[int( joint + 0 )] * w2;
|
||||
matY += matrices[int( joint + 1 )] * w2;
|
||||
matZ += matrices[int( joint + 2 )] * w2;
|
||||
|
||||
joint = int(vertex.color.w * 255.1 * 3.0);
|
||||
matX += matrices[int(joint+0)] * w3;
|
||||
matY += matrices[int(joint+1)] * w3;
|
||||
matZ += matrices[int(joint+2)] * w3;
|
||||
joint = int( vertex.color.w * 255.1 * 3.0 );
|
||||
matX += matrices[int( joint + 0 )] * w3;
|
||||
matY += matrices[int( joint + 1 )] * w3;
|
||||
matZ += matrices[int( joint + 2 )] * w3;
|
||||
|
||||
float3 normal;
|
||||
normal.x = dot3( matX, vNormal );
|
||||
|
@ -154,7 +157,7 @@ void main( VS_IN vertex, out VS_OUT result ) {
|
|||
|
||||
//# calculate normalized vector to viewer in R1
|
||||
float4 toView = normalize( rpLocalViewOrigin - modelPosition );
|
||||
|
||||
|
||||
//# add together to become the half angle vector in object space (non-normalized)
|
||||
float4 halfAngleVector = toLight + toView;
|
||||
|
||||
|
@ -167,6 +170,6 @@ void main( VS_IN vertex, out VS_OUT result ) {
|
|||
//# generate the vertex color, which can be 1.0, color, or 1.0 - color
|
||||
//# for 1.0 : env[16] = 0, env[17] = 1
|
||||
//# for color : env[16] = 1, env[17] = 0
|
||||
//# for 1.0-color : env[16] = -1, env[17] = 1
|
||||
//# for 1.0-color : env[16] = -1, env[17] = 1
|
||||
result.color = ( swizzleColor( vertex.color ) * rpVertexColorModulate ) + rpVertexColorAdd;
|
||||
}
|
|
@ -2,10 +2,10 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 2013-2020 Robert Beckebans
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
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
|
||||
|
@ -30,6 +30,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#include "global.inc.hlsl"
|
||||
#include "BRDF.inc.hlsl"
|
||||
|
||||
// *INDENT-OFF*
|
||||
uniform sampler2D samp0 : register(s0); // texture 1 is the per-surface normal map
|
||||
uniform sampler2D samp1 : register(s1); // texture 3 is the per-surface specular or roughness/metallic/AO mixer map
|
||||
uniform sampler2D samp2 : register(s2); // texture 2 is the per-surface baseColor map
|
||||
|
@ -58,26 +59,26 @@ struct PS_OUT
|
|||
{
|
||||
half4 color : COLOR;
|
||||
};
|
||||
|
||||
// *INDENT-ON*
|
||||
|
||||
float BlueNoise( float2 n, float x )
|
||||
{
|
||||
float noise = tex2D( samp6, ( n.xy / 256.0 ) ).r;
|
||||
|
||||
noise = fract( noise + 0.61803398875 * rpJitterTexOffset.z * x );
|
||||
|
||||
noise = RemapNoiseTriErp( noise );
|
||||
|
||||
//noise = noise * 2.0 - 1.0;
|
||||
|
||||
return noise;
|
||||
float noise = tex2D( samp6, ( n.xy / 256.0 ) ).r;
|
||||
|
||||
noise = fract( noise + 0.61803398875 * rpJitterTexOffset.z * x );
|
||||
|
||||
noise = RemapNoiseTriErp( noise );
|
||||
|
||||
//noise = noise * 2.0 - 1.0;
|
||||
|
||||
return noise;
|
||||
}
|
||||
|
||||
void main( PS_IN fragment, out PS_OUT result )
|
||||
{
|
||||
half4 bumpMap = tex2D( samp0, fragment.texcoord1.xy );
|
||||
half4 lightFalloff = ( idtex2Dproj( samp3, fragment.texcoord2 ) );
|
||||
half4 lightProj = ( idtex2Dproj( samp4, fragment.texcoord3 ) );
|
||||
half4 lightProj = ( idtex2Dproj( samp4, fragment.texcoord3 ) );
|
||||
half4 YCoCG = tex2D( samp2, fragment.texcoord4.xy );
|
||||
half4 specMapSRGB = tex2D( samp1, fragment.texcoord5.xy );
|
||||
half4 specMap = sRGBAToLinearRGBA( specMapSRGB );
|
||||
|
@ -96,7 +97,7 @@ void main( PS_IN fragment, out PS_OUT result )
|
|||
// RB end
|
||||
localNormal.z = sqrt( abs( dot( localNormal.xy, localNormal.xy ) - 0.25 ) );
|
||||
localNormal = normalize( localNormal );
|
||||
|
||||
|
||||
// traditional very dark Lambert light model used in Doom 3
|
||||
half ldotN = saturate( dot3( localNormal, lightVector ) );
|
||||
|
||||
|
@ -116,10 +117,10 @@ void main( PS_IN fragment, out PS_OUT result )
|
|||
// shadow mapping
|
||||
//
|
||||
int shadowIndex = 0;
|
||||
|
||||
|
||||
#if defined( LIGHT_POINT )
|
||||
float3 toLightGlobal = normalize( fragment.texcoord8.xyz );
|
||||
|
||||
|
||||
float axis[6];
|
||||
axis[0] = -toLightGlobal.x;
|
||||
axis[1] = toLightGlobal.x;
|
||||
|
@ -139,9 +140,9 @@ void main( PS_IN fragment, out PS_OUT result )
|
|||
#endif // #if defined( POINTLIGHT )
|
||||
|
||||
#if defined( LIGHT_PARALLEL )
|
||||
|
||||
|
||||
float viewZ = -fragment.texcoord9.z;
|
||||
|
||||
|
||||
shadowIndex = 4;
|
||||
for( int i = 0; i < 4; i++ )
|
||||
{
|
||||
|
@ -152,7 +153,7 @@ void main( PS_IN fragment, out PS_OUT result )
|
|||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if 0
|
||||
if( shadowIndex == 0 )
|
||||
{
|
||||
|
@ -178,33 +179,33 @@ void main( PS_IN fragment, out PS_OUT result )
|
|||
{
|
||||
result.color = float4( 0.0, 1.0, 1.0, 1.0 );
|
||||
}
|
||||
|
||||
|
||||
//result.color.xyz *= lightColor;
|
||||
return;
|
||||
#endif
|
||||
|
||||
|
||||
float4 shadowMatrixX = rpShadowMatrices[ int ( shadowIndex * 4 + 0 ) ];
|
||||
float4 shadowMatrixY = rpShadowMatrices[ int ( shadowIndex * 4 + 1 ) ];
|
||||
float4 shadowMatrixZ = rpShadowMatrices[ int ( shadowIndex * 4 + 2 ) ];
|
||||
float4 shadowMatrixW = rpShadowMatrices[ int ( shadowIndex * 4 + 3 ) ];
|
||||
|
||||
|
||||
float4 modelPosition = float4( fragment.texcoord7.xyz, 1.0 );
|
||||
float4 shadowTexcoord;
|
||||
shadowTexcoord.x = dot4( modelPosition, shadowMatrixX );
|
||||
shadowTexcoord.y = dot4( modelPosition, shadowMatrixY );
|
||||
shadowTexcoord.z = dot4( modelPosition, shadowMatrixZ );
|
||||
shadowTexcoord.w = dot4( modelPosition, shadowMatrixW );
|
||||
|
||||
|
||||
//float bias = 0.005 * tan( acos( ldotN ) );
|
||||
//bias = clamp( bias, 0, 0.01 );
|
||||
float bias = 0.001;
|
||||
|
||||
|
||||
shadowTexcoord.xyz /= shadowTexcoord.w;
|
||||
|
||||
|
||||
shadowTexcoord.z = shadowTexcoord.z * rpScreenCorrectionFactor.w;
|
||||
//shadowTexcoord.z = shadowTexcoord.z * 0.999991;
|
||||
//shadowTexcoord.z = shadowTexcoord.z - bias;
|
||||
shadowTexcoord.w = float(shadowIndex);
|
||||
shadowTexcoord.w = float( shadowIndex );
|
||||
|
||||
#if 0
|
||||
result.color.xyz = float3( shadowTexcoord.z, shadowTexcoord.z, shadowTexcoord.z );
|
||||
|
@ -213,126 +214,126 @@ void main( PS_IN fragment, out PS_OUT result )
|
|||
#endif
|
||||
|
||||
// multiple taps
|
||||
|
||||
|
||||
#if 0
|
||||
float4 base = shadowTexcoord;
|
||||
|
||||
|
||||
base.xy += rpJitterTexScale.xy * -0.5;
|
||||
|
||||
|
||||
float shadow = 0.0;
|
||||
|
||||
|
||||
//float stepSize = 1.0 / 16.0;
|
||||
float numSamples = 16;
|
||||
float stepSize = 1.0 / numSamples;
|
||||
|
||||
|
||||
float4 jitterTC = ( fragment.position * rpScreenCorrectionFactor ) + rpJitterTexOffset;
|
||||
for( float i = 0.0; i < numSamples; i += 1.0 )
|
||||
{
|
||||
float4 jitter = base + tex2D( samp6, jitterTC.xy ) * rpJitterTexScale;
|
||||
jitter.zw = shadowTexcoord.zw;
|
||||
|
||||
|
||||
shadow += texture( samp5, jitter.xywz );
|
||||
jitterTC.x += stepSize;
|
||||
}
|
||||
|
||||
|
||||
shadow *= stepSize;
|
||||
|
||||
#elif 0
|
||||
|
||||
|
||||
const float2 poissonDisk[12] = float2[](
|
||||
float2(0.6111618, 0.1050905),
|
||||
float2(0.1088336, 0.1127091),
|
||||
float2(0.3030421, -0.6292974),
|
||||
float2(0.4090526, 0.6716492),
|
||||
float2(-0.1608387, -0.3867823),
|
||||
float2(0.7685862, -0.6118501),
|
||||
float2(-0.1935026, -0.856501),
|
||||
float2(-0.4028573, 0.07754025),
|
||||
float2(-0.6411021, -0.4748057),
|
||||
float2(-0.1314865, 0.8404058),
|
||||
float2(-0.7005203, 0.4596822),
|
||||
float2(-0.9713828, -0.06329931) );
|
||||
|
||||
float2( 0.6111618, 0.1050905 ),
|
||||
float2( 0.1088336, 0.1127091 ),
|
||||
float2( 0.3030421, -0.6292974 ),
|
||||
float2( 0.4090526, 0.6716492 ),
|
||||
float2( -0.1608387, -0.3867823 ),
|
||||
float2( 0.7685862, -0.6118501 ),
|
||||
float2( -0.1935026, -0.856501 ),
|
||||
float2( -0.4028573, 0.07754025 ),
|
||||
float2( -0.6411021, -0.4748057 ),
|
||||
float2( -0.1314865, 0.8404058 ),
|
||||
float2( -0.7005203, 0.4596822 ),
|
||||
float2( -0.9713828, -0.06329931 ) );
|
||||
|
||||
float shadow = 0.0;
|
||||
|
||||
|
||||
// RB: casting a float to int and using it as index can really kill the performance ...
|
||||
float numSamples = 12.0; //int(rpScreenCorrectionFactor.w);
|
||||
float stepSize = 1.0 / numSamples;
|
||||
|
||||
|
||||
float4 jitterTC = ( fragment.position * rpScreenCorrectionFactor ) + rpJitterTexOffset;
|
||||
float4 random = tex2D( samp6, jitterTC.xy ) * PI;
|
||||
//float4 random = fragment.position;
|
||||
|
||||
|
||||
float2 rot;
|
||||
rot.x = cos( random.x );
|
||||
rot.y = sin( random.x );
|
||||
|
||||
|
||||
float shadowTexelSize = rpScreenCorrectionFactor.z * rpJitterTexScale.x;
|
||||
for( int i = 0; i < 12; i++ )
|
||||
{
|
||||
float2 jitter = poissonDisk[i];
|
||||
for( int i = 0; i < 12; i++ )
|
||||
{
|
||||
float2 jitter = poissonDisk[i];
|
||||
float2 jitterRotated;
|
||||
jitterRotated.x = jitter.x * rot.x - jitter.y * rot.y;
|
||||
jitterRotated.y = jitter.x * rot.y + jitter.y * rot.x;
|
||||
|
||||
|
||||
float4 shadowTexcoordJittered = float4( shadowTexcoord.xy + jitterRotated * shadowTexelSize, shadowTexcoord.z, shadowTexcoord.w );
|
||||
|
||||
shadow += texture( samp5, shadowTexcoordJittered.xywz);
|
||||
}
|
||||
|
||||
shadow *= stepSize;
|
||||
shadow += texture( samp5, shadowTexcoordJittered.xywz );
|
||||
}
|
||||
|
||||
shadow *= stepSize;
|
||||
|
||||
|
||||
#elif 1
|
||||
|
||||
const float2 poissonDisk[12] = float2[](
|
||||
float2( 0.6111618, 0.1050905 ),
|
||||
float2( 0.1088336, 0.1127091 ),
|
||||
float2( 0.3030421, -0.6292974 ),
|
||||
float2( 0.4090526, 0.6716492 ),
|
||||
float2( -0.1608387, -0.3867823 ),
|
||||
float2( 0.7685862, -0.6118501 ),
|
||||
float2( -0.1935026, -0.856501 ),
|
||||
float2( -0.4028573, 0.07754025 ),
|
||||
float2( -0.6411021, -0.4748057 ),
|
||||
float2( -0.1314865, 0.8404058 ),
|
||||
float2( -0.7005203, 0.4596822 ),
|
||||
float2( -0.9713828, -0.06329931 ) );
|
||||
|
||||
|
||||
#elif 1
|
||||
|
||||
const float2 poissonDisk[12] = float2[](
|
||||
float2(0.6111618, 0.1050905),
|
||||
float2(0.1088336, 0.1127091),
|
||||
float2(0.3030421, -0.6292974),
|
||||
float2(0.4090526, 0.6716492),
|
||||
float2(-0.1608387, -0.3867823),
|
||||
float2(0.7685862, -0.6118501),
|
||||
float2(-0.1935026, -0.856501),
|
||||
float2(-0.4028573, 0.07754025),
|
||||
float2(-0.6411021, -0.4748057),
|
||||
float2(-0.1314865, 0.8404058),
|
||||
float2(-0.7005203, 0.4596822),
|
||||
float2(-0.9713828, -0.06329931) );
|
||||
|
||||
float shadow = 0.0;
|
||||
|
||||
|
||||
// RB: casting a float to int and using it as index can really kill the performance ...
|
||||
float numSamples = 6.0; //int(rpScreenCorrectionFactor.w);
|
||||
float stepSize = 1.0 / numSamples;
|
||||
|
||||
|
||||
//float4 jitterTC = ( fragment.position * rpScreenCorrectionFactor ) + rpJitterTexOffset;
|
||||
//float random = tex2D( samp6, jitterTC.xy ).x;
|
||||
|
||||
float random = BlueNoise( fragment.position.xy * 1.0, 100.0 );
|
||||
|
||||
//float random = InterleavedGradientNoise( fragment.position.xy );
|
||||
|
||||
random *= PI;
|
||||
|
||||
|
||||
float random = BlueNoise( fragment.position.xy * 1.0, 100.0 );
|
||||
|
||||
//float random = InterleavedGradientNoise( fragment.position.xy );
|
||||
|
||||
random *= PI;
|
||||
|
||||
float2 rot;
|
||||
rot.x = cos( random );
|
||||
rot.y = sin( random );
|
||||
|
||||
|
||||
float shadowTexelSize = rpScreenCorrectionFactor.z * rpJitterTexScale.x;
|
||||
for( int i = 0; i < 6; i++ )
|
||||
{
|
||||
float2 jitter = poissonDisk[i];
|
||||
for( int i = 0; i < 6; i++ )
|
||||
{
|
||||
float2 jitter = poissonDisk[i];
|
||||
float2 jitterRotated;
|
||||
jitterRotated.x = jitter.x * rot.x - jitter.y * rot.y;
|
||||
jitterRotated.y = jitter.x * rot.y + jitter.y * rot.x;
|
||||
|
||||
float4 shadowTexcoordJittered = float4( shadowTexcoord.xy + jitterRotated * shadowTexelSize, shadowTexcoord.z, shadowTexcoord.w );
|
||||
|
||||
shadow += texture( samp5, shadowTexcoordJittered.xywz);
|
||||
}
|
||||
|
||||
shadow *= stepSize;
|
||||
|
||||
float4 shadowTexcoordJittered = float4( shadowTexcoord.xy + jitterRotated * shadowTexelSize, shadowTexcoord.z, shadowTexcoord.w );
|
||||
|
||||
shadow += texture( samp5, shadowTexcoordJittered.xywz );
|
||||
}
|
||||
|
||||
shadow *= stepSize;
|
||||
|
||||
#else
|
||||
|
||||
float shadow = texture( samp5, shadowTexcoord.xywz );
|
||||
|
@ -343,7 +344,7 @@ void main( PS_IN fragment, out PS_OUT result )
|
|||
half hdotN = clamp( dot3( halfAngleVector, localNormal ), 0.0, 1.0 );
|
||||
|
||||
#if 1
|
||||
|
||||
|
||||
#if defined( USE_PBR )
|
||||
const half metallic = specMapSRGB.g;
|
||||
const half roughness = specMapSRGB.r;
|
||||
|
@ -351,85 +352,85 @@ void main( PS_IN fragment, out PS_OUT result )
|
|||
|
||||
// the vast majority of real-world materials (anything not metal or gems) have F(0°)
|
||||
// values in a very narrow range (~0.02 - 0.08)
|
||||
|
||||
|
||||
// approximate non-metals with linear RGB 0.04 which is 0.08 * 0.5 (default in UE4)
|
||||
const half3 dielectricColor = half3( 0.04 );
|
||||
|
||||
|
||||
// derive diffuse and specular from albedo(m) base color
|
||||
const half3 baseColor = diffuseMap;
|
||||
|
||||
|
||||
half3 diffuseColor = baseColor * ( 1.0 - metallic );
|
||||
half3 specularColor = lerp( dielectricColor, baseColor, metallic );
|
||||
#else
|
||||
// HACK calculate roughness from D3 gloss maps
|
||||
float Y = dot( LUMINANCE_SRGB.rgb, specMapSRGB.rgb );
|
||||
|
||||
|
||||
//const float glossiness = clamp( 1.0 - specMapSRGB.r, 0.0, 0.98 );
|
||||
const float glossiness = clamp( pow( Y, 1.0 / 2.0 ), 0.0, 0.98 );
|
||||
|
||||
|
||||
const float roughness = 1.0 - glossiness;
|
||||
|
||||
|
||||
half3 diffuseColor = diffuseMap;
|
||||
half3 specularColor = specMapSRGB.rgb; // RB: should be linear but it looks too flat
|
||||
#endif
|
||||
|
||||
//diffuseColor = half3( 1.0 );
|
||||
|
||||
|
||||
//diffuseColor = half3( 1.0 );
|
||||
|
||||
// RB: compensate r_lightScale 3 and the division of Pi
|
||||
//lambert *= 1.3;
|
||||
|
||||
|
||||
// rpDiffuseModifier contains light color multiplier
|
||||
half3 lightColor = sRGBToLinearRGB( lightProj.xyz * lightFalloff.xyz );// * rpDiffuseModifier.xyz;
|
||||
|
||||
|
||||
half vdotN = clamp( dot3( viewVector, localNormal ), 0.0, 1.0 );
|
||||
half vdotH = clamp( dot3( viewVector, halfAngleVector ), 0.0, 1.0 );
|
||||
half ldotH = clamp( dot3( lightVector, halfAngleVector ), 0.0, 1.0 );
|
||||
|
||||
|
||||
// compensate r_lightScale 3 * 2
|
||||
half3 reflectColor = specularColor * rpSpecularModifier.rgb * 1.0;// * 0.5;
|
||||
|
||||
|
||||
// cheap approximation by ARM with only one division
|
||||
// http://community.arm.com/servlet/JiveServlet/download/96891546-19496/siggraph2015-mmg-renaldas-slides.pdf
|
||||
// page 26
|
||||
|
||||
|
||||
float rr = roughness * roughness;
|
||||
float rrrr = rr * rr;
|
||||
|
||||
|
||||
// disney GGX
|
||||
float D = ( hdotN * hdotN ) * ( rrrr - 1.0 ) + 1.0;
|
||||
float VFapprox = ( ldotH * ldotH ) * ( roughness + 0.5 );
|
||||
half3 specularBRDF = ( rrrr / ( 4.0 * PI * D * D * VFapprox ) ) * ldotN * reflectColor;
|
||||
//specularBRDF = half3( 0.0 );
|
||||
|
||||
|
||||
#if 0
|
||||
result.color = float4( _half3( VFapprox ), 1.0 );
|
||||
return;
|
||||
#endif
|
||||
|
||||
|
||||
// see http://seblagarde.wordpress.com/2012/01/08/pi-or-not-to-pi-in-game-lighting-equation/
|
||||
//lambert /= PI;
|
||||
|
||||
|
||||
//half3 diffuseColor = mix( diffuseMap, F0, metal ) * rpDiffuseModifier.xyz;
|
||||
half3 diffuseBRDF = diffuseColor * lambert * sRGBToLinearRGB( rpDiffuseModifier.xyz );
|
||||
|
||||
|
||||
result.color.xyz = ( diffuseBRDF + specularBRDF ) * lightColor * fragment.color.rgb * shadow;
|
||||
result.color.w = 1.0;
|
||||
|
||||
|
||||
#else
|
||||
|
||||
|
||||
/*
|
||||
OLD Blinn Phong
|
||||
*/
|
||||
|
||||
const half specularPower = 10.0f;
|
||||
|
||||
|
||||
// RB: added abs
|
||||
half3 specularContribution = _half3( pow( hdotN, specularPower ) );
|
||||
|
||||
half3 diffuseColor = diffuseMap * sRGBToLinearRGB( rpDiffuseModifier.xyz );
|
||||
half3 specularColor = specMap.xyz * specularContribution * sRGBToLinearRGB( rpSpecularModifier.xyz );
|
||||
half3 lightColor = sRGBToLinearRGB( lightProj.xyz * lightFalloff.xyz );
|
||||
|
||||
|
||||
/*
|
||||
half rim = 1.0f - saturate( hdotN );
|
||||
half rimPower = 16.0f;
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 2014 Robert Beckebans
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
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
|
||||
|
@ -33,6 +33,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
uniform matrices_ubo { float4 matrices[408]; };
|
||||
#endif
|
||||
|
||||
// *INDENT-OFF*
|
||||
struct VS_IN {
|
||||
float4 position : POSITION;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
|
@ -56,8 +57,10 @@ struct VS_OUT {
|
|||
float4 texcoord9 : TEXCOORD9;
|
||||
float4 color : COLOR0;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
void main( VS_IN vertex, out VS_OUT result ) {
|
||||
void main( VS_IN vertex, out VS_OUT result )
|
||||
{
|
||||
|
||||
float4 vNormal = vertex.normal * 2.0 - 1.0;
|
||||
float4 vTangent = vertex.tangent * 2.0 - 1.0;
|
||||
|
@ -75,25 +78,25 @@ void main( VS_IN vertex, out VS_OUT result ) {
|
|||
const float w3 = vertex.color2.w;
|
||||
|
||||
float4 matX, matY, matZ; // must be float4 for vec4
|
||||
int joint = int(vertex.color.x * 255.1 * 3.0);
|
||||
matX = matrices[int(joint+0)] * w0;
|
||||
matY = matrices[int(joint+1)] * w0;
|
||||
matZ = matrices[int(joint+2)] * w0;
|
||||
int joint = int( vertex.color.x * 255.1 * 3.0 );
|
||||
matX = matrices[int( joint + 0 )] * w0;
|
||||
matY = matrices[int( joint + 1 )] * w0;
|
||||
matZ = matrices[int( joint + 2 )] * w0;
|
||||
|
||||
joint = int(vertex.color.y * 255.1 * 3.0);
|
||||
matX += matrices[int(joint+0)] * w1;
|
||||
matY += matrices[int(joint+1)] * w1;
|
||||
matZ += matrices[int(joint+2)] * w1;
|
||||
joint = int( vertex.color.y * 255.1 * 3.0 );
|
||||
matX += matrices[int( joint + 0 )] * w1;
|
||||
matY += matrices[int( joint + 1 )] * w1;
|
||||
matZ += matrices[int( joint + 2 )] * w1;
|
||||
|
||||
joint = int(vertex.color.z * 255.1 * 3.0);
|
||||
matX += matrices[int(joint+0)] * w2;
|
||||
matY += matrices[int(joint+1)] * w2;
|
||||
matZ += matrices[int(joint+2)] * w2;
|
||||
joint = int( vertex.color.z * 255.1 * 3.0 );
|
||||
matX += matrices[int( joint + 0 )] * w2;
|
||||
matY += matrices[int( joint + 1 )] * w2;
|
||||
matZ += matrices[int( joint + 2 )] * w2;
|
||||
|
||||
joint = int(vertex.color.w * 255.1 * 3.0);
|
||||
matX += matrices[int(joint+0)] * w3;
|
||||
matY += matrices[int(joint+1)] * w3;
|
||||
matZ += matrices[int(joint+2)] * w3;
|
||||
joint = int( vertex.color.w * 255.1 * 3.0 );
|
||||
matX += matrices[int( joint + 0 )] * w3;
|
||||
matY += matrices[int( joint + 1 )] * w3;
|
||||
matZ += matrices[int( joint + 2 )] * w3;
|
||||
|
||||
float3 normal;
|
||||
normal.x = dot3( matX, vNormal );
|
||||
|
@ -176,31 +179,31 @@ void main( VS_IN vertex, out VS_OUT result ) {
|
|||
|
||||
//# calculate normalized vector to viewer in R1
|
||||
float4 toView = normalize( rpLocalViewOrigin - modelPosition );
|
||||
|
||||
|
||||
//# put into texture space
|
||||
result.texcoord6.x = dot3( tangent, toView );
|
||||
result.texcoord6.y = dot3( bitangent, toView );
|
||||
result.texcoord6.z = dot3( normal, toView );
|
||||
result.texcoord6.w = 1.0f;
|
||||
|
||||
|
||||
result.texcoord7 = modelPosition;
|
||||
|
||||
|
||||
float4 worldPosition;
|
||||
worldPosition.x = dot4( modelPosition, rpModelMatrixX );
|
||||
worldPosition.y = dot4( modelPosition, rpModelMatrixY );
|
||||
worldPosition.z = dot4( modelPosition, rpModelMatrixZ );
|
||||
worldPosition.w = dot4( modelPosition, rpModelMatrixW );
|
||||
|
||||
|
||||
float4 toLightGlobal = rpGlobalLightOrigin - worldPosition;
|
||||
|
||||
|
||||
result.texcoord8 = toLightGlobal;
|
||||
|
||||
|
||||
float4 viewPosition;
|
||||
viewPosition.x = dot4( modelPosition, rpModelViewMatrixX );
|
||||
viewPosition.y = dot4( modelPosition, rpModelViewMatrixY );
|
||||
viewPosition.z = dot4( modelPosition, rpModelViewMatrixZ );
|
||||
viewPosition.w = dot4( modelPosition, rpModelViewMatrixW );
|
||||
|
||||
|
||||
result.texcoord9 = viewPosition;
|
||||
|
||||
#if defined( USE_GPU_SKINNING )
|
||||
|
@ -212,7 +215,7 @@ void main( VS_IN vertex, out VS_OUT result ) {
|
|||
//# generate the vertex color, which can be 1.0, color, or 1.0 - color
|
||||
//# for 1.0 : env[16] = 0, env[17] = 1
|
||||
//# for color : env[16] = 1, env[17] = 0
|
||||
//# for 1.0-color : env[16] = -1, env[17] = 1
|
||||
//# for 1.0-color : env[16] = -1, env[17] = 1
|
||||
result.color = ( swizzleColor( vertex.color ) * rpVertexColorModulate ) + rpVertexColorAdd;
|
||||
#endif
|
||||
}
|
|
@ -2,10 +2,10 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 2014 Robert Beckebans
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
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
|
||||
|
@ -29,6 +29,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#include "global.inc.hlsl"
|
||||
|
||||
// *INDENT-OFF*
|
||||
uniform sampler2D samp0 : register(s0); // view color
|
||||
uniform sampler2D samp1 : register(s1); // view depth
|
||||
|
||||
|
@ -39,16 +40,20 @@ struct PS_IN {
|
|||
struct PS_OUT {
|
||||
float4 color : COLOR;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
void main( PS_IN fragment, out PS_OUT result ) {
|
||||
void main( PS_IN fragment, out PS_OUT result )
|
||||
{
|
||||
#if 0
|
||||
if ( fragment.texcoord0.x < 0.5 ) {
|
||||
// only draw on half the screen for comparison
|
||||
discard;
|
||||
}
|
||||
if( fragment.texcoord0.x < 0.5 )
|
||||
{
|
||||
// only draw on half the screen for comparison
|
||||
discard;
|
||||
}
|
||||
#endif
|
||||
// don't motion blur the hands, which were drawn with alpha = 0
|
||||
if ( tex2D( samp0, fragment.texcoord0 ).w == 0.0 ) {
|
||||
if( tex2D( samp0, fragment.texcoord0 ).w == 0.0 )
|
||||
{
|
||||
discard;
|
||||
}
|
||||
|
||||
|
@ -80,7 +85,8 @@ void main( PS_IN fragment, out PS_OUT result ) {
|
|||
float goodSamples = 0.0;
|
||||
float samples = rpOverbright.x;
|
||||
|
||||
for ( float i = 0.0 ; i < samples ; i = i + 1.0 ) {
|
||||
for( float i = 0.0 ; i < samples ; i = i + 1.0 )
|
||||
{
|
||||
float2 pos = fragment.texcoord0 + delta * ( ( i / ( samples - 1.0 ) ) - 0.5 );
|
||||
float4 color = tex2D( samp0, pos );
|
||||
// only take the values that are not part of the weapon
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
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").
|
||||
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
|
||||
|
@ -28,6 +28,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#include "global.inc.hlsl"
|
||||
|
||||
// *INDENT-OFF*
|
||||
struct VS_IN {
|
||||
float4 position : POSITION;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
|
@ -37,8 +38,10 @@ struct VS_OUT {
|
|||
float4 position : POSITION;
|
||||
float2 texcoord0 : TEXCOORD0;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
void main( VS_IN vertex, out VS_OUT result ) {
|
||||
void main( VS_IN vertex, out VS_OUT result )
|
||||
{
|
||||
result.position = vertex.position;
|
||||
result.texcoord0 = vertex.texcoord;
|
||||
}
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
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").
|
||||
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
|
||||
|
@ -28,6 +28,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#include "global.inc.hlsl"
|
||||
|
||||
// *INDENT-OFF*
|
||||
struct VS_IN {
|
||||
float4 position : POSITION;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
|
@ -40,8 +41,10 @@ struct VS_OUT {
|
|||
float4 position : POSITION;
|
||||
float2 texcoord0 : TEXCOORD0;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
void main( VS_IN vertex, out VS_OUT result ) {
|
||||
void main( VS_IN vertex, out VS_OUT result )
|
||||
{
|
||||
result.position = vertex.position;
|
||||
|
||||
//result.position.x = vertex.position; //dot4( vertex.position, rpMVPmatrixX );
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 2014 Robert Beckebans
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
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
|
||||
|
@ -29,6 +29,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#include "global.inc.hlsl"
|
||||
|
||||
// *INDENT-OFF*
|
||||
uniform sampler2D samp0 : register(s0);
|
||||
|
||||
struct PS_IN
|
||||
|
@ -41,11 +42,12 @@ struct PS_OUT
|
|||
{
|
||||
float4 color : COLOR;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
void main( PS_IN fragment, out PS_OUT result )
|
||||
{
|
||||
float2 tCoords = fragment.texcoord0;
|
||||
|
||||
|
||||
float4 color = tex2D( samp0, tCoords );
|
||||
result.color = color;
|
||||
}
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
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").
|
||||
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
|
||||
|
@ -28,6 +28,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#include "global.inc.hlsl"
|
||||
|
||||
// *INDENT-OFF*
|
||||
struct VS_IN {
|
||||
float4 position : POSITION;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
|
@ -40,8 +41,10 @@ struct VS_OUT {
|
|||
float4 position : POSITION;
|
||||
float2 texcoord0 : TEXCOORD0;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
void main( VS_IN vertex, out VS_OUT result ) {
|
||||
void main( VS_IN vertex, out VS_OUT result )
|
||||
{
|
||||
result.position = vertex.position;
|
||||
|
||||
//result.position.x = vertex.position; //dot4( vertex.position, rpMVPmatrixX );
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
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").
|
||||
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
|
||||
|
@ -28,11 +28,15 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#include "global.inc.hlsl"
|
||||
|
||||
// *INDENT-OFF*
|
||||
uniform sampler2D samp0 : register(s0);
|
||||
|
||||
struct PS_OUT {
|
||||
float4 color : COLOR;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
void main( out PS_OUT result ) {
|
||||
void main( out PS_OUT result )
|
||||
{
|
||||
result.color = rpColor;
|
||||
}
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
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").
|
||||
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
|
||||
|
@ -28,6 +28,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#include "global.inc.hlsl"
|
||||
|
||||
// *INDENT-OFF*
|
||||
struct VS_IN {
|
||||
float4 position : POSITION;
|
||||
};
|
||||
|
@ -35,8 +36,10 @@ struct VS_IN {
|
|||
struct VS_OUT {
|
||||
float4 position : POSITION;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
void main( VS_IN vertex, out VS_OUT result ) {
|
||||
void main( VS_IN vertex, out VS_OUT result )
|
||||
{
|
||||
float4 vPos = vertex.position - rpLocalLightOrigin;
|
||||
vPos = ( vPos.wwww * rpLocalLightOrigin ) + vPos;
|
||||
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
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").
|
||||
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
|
||||
|
@ -28,11 +28,15 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#include "global.inc.hlsl"
|
||||
|
||||
// *INDENT-OFF*
|
||||
uniform sampler2D samp0 : register(s0);
|
||||
|
||||
struct PS_OUT {
|
||||
float4 color : COLOR;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
void main( out PS_OUT result ) {
|
||||
void main( out PS_OUT result )
|
||||
{
|
||||
result.color = rpColor;
|
||||
}
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
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").
|
||||
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
|
||||
|
@ -28,6 +28,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#include "global.inc.hlsl"
|
||||
|
||||
// *INDENT-OFF*
|
||||
struct VS_IN {
|
||||
float4 position : POSITION;
|
||||
};
|
||||
|
@ -35,8 +36,10 @@ struct VS_IN {
|
|||
struct VS_OUT {
|
||||
float4 position : POSITION;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
void main( VS_IN vertex, out VS_OUT result ) {
|
||||
void main( VS_IN vertex, out VS_OUT result )
|
||||
{
|
||||
float4 vPos = vertex.position - rpLocalLightOrigin;
|
||||
vPos = ( vPos.wwww * rpLocalLightOrigin ) + vPos;
|
||||
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
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").
|
||||
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
|
||||
|
@ -28,11 +28,15 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#include "global.inc.hlsl"
|
||||
|
||||
// *INDENT-OFF*
|
||||
uniform sampler2D samp0 : register(s0);
|
||||
|
||||
struct PS_OUT {
|
||||
float4 color : COLOR;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
void main( out PS_OUT result ) {
|
||||
void main( out PS_OUT result )
|
||||
{
|
||||
result.color = rpColor;
|
||||
}
|
|
@ -2,10 +2,10 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 2014 Robert Beckebans
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
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
|
||||
|
@ -31,6 +31,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
uniform matrices_ubo { float4 matrices[408]; };
|
||||
|
||||
// *INDENT-OFF*
|
||||
struct VS_IN {
|
||||
float4 position : POSITION;
|
||||
float4 color : COLOR0;
|
||||
|
@ -40,8 +41,10 @@ struct VS_IN {
|
|||
struct VS_OUT {
|
||||
float4 position : POSITION;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
void main( VS_IN vertex, out VS_OUT result ) {
|
||||
void main( VS_IN vertex, out VS_OUT result )
|
||||
{
|
||||
//--------------------------------------------------------------
|
||||
// GPU transformation of the normal / binormal / bitangent
|
||||
//
|
||||
|
@ -53,25 +56,25 @@ void main( VS_IN vertex, out VS_OUT result ) {
|
|||
const float w3 = vertex.color2.w;
|
||||
|
||||
float4 matX, matY, matZ; // must be float4 for vec4
|
||||
int joint = int(vertex.color.x * 255.1 * 3.0);
|
||||
matX = matrices[int(joint+0)] * w0;
|
||||
matY = matrices[int(joint+1)] * w0;
|
||||
matZ = matrices[int(joint+2)] * w0;
|
||||
int joint = int( vertex.color.x * 255.1 * 3.0 );
|
||||
matX = matrices[int( joint + 0 )] * w0;
|
||||
matY = matrices[int( joint + 1 )] * w0;
|
||||
matZ = matrices[int( joint + 2 )] * w0;
|
||||
|
||||
joint = int(vertex.color.y * 255.1 * 3.0);
|
||||
matX += matrices[int(joint+0)] * w1;
|
||||
matY += matrices[int(joint+1)] * w1;
|
||||
matZ += matrices[int(joint+2)] * w1;
|
||||
joint = int( vertex.color.y * 255.1 * 3.0 );
|
||||
matX += matrices[int( joint + 0 )] * w1;
|
||||
matY += matrices[int( joint + 1 )] * w1;
|
||||
matZ += matrices[int( joint + 2 )] * w1;
|
||||
|
||||
joint = int(vertex.color.z * 255.1 * 3.0);
|
||||
matX += matrices[int(joint+0)] * w2;
|
||||
matY += matrices[int(joint+1)] * w2;
|
||||
matZ += matrices[int(joint+2)] * w2;
|
||||
joint = int( vertex.color.z * 255.1 * 3.0 );
|
||||
matX += matrices[int( joint + 0 )] * w2;
|
||||
matY += matrices[int( joint + 1 )] * w2;
|
||||
matZ += matrices[int( joint + 2 )] * w2;
|
||||
|
||||
joint = int(vertex.color.w * 255.1 * 3.0);
|
||||
matX += matrices[int(joint+0)] * w3;
|
||||
matY += matrices[int(joint+1)] * w3;
|
||||
matZ += matrices[int(joint+2)] * w3;
|
||||
joint = int( vertex.color.w * 255.1 * 3.0 );
|
||||
matX += matrices[int( joint + 0 )] * w3;
|
||||
matY += matrices[int( joint + 1 )] * w3;
|
||||
matZ += matrices[int( joint + 2 )] * w3;
|
||||
|
||||
float4 vertexPosition = vertex.position;
|
||||
vertexPosition.w = 1.0;
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
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").
|
||||
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
|
||||
|
@ -28,11 +28,15 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#include "global.inc.hlsl"
|
||||
|
||||
// *INDENT-OFF*
|
||||
uniform sampler2D samp0 : register(s0);
|
||||
|
||||
struct PS_OUT {
|
||||
float4 color : COLOR;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
void main( out PS_OUT result ) {
|
||||
void main( out PS_OUT result )
|
||||
{
|
||||
result.color = rpColor;
|
||||
}
|
|
@ -2,10 +2,10 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Coypright (C) 2014 Robert Beckebans
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
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
|
||||
|
@ -29,6 +29,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#include "global.inc.hlsl"
|
||||
|
||||
// *INDENT-OFF*
|
||||
uniform matrices_ubo { float4 matrices[408]; };
|
||||
|
||||
struct VS_IN {
|
||||
|
@ -40,8 +41,10 @@ struct VS_IN {
|
|||
struct VS_OUT {
|
||||
float4 position : POSITION;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
void main( VS_IN vertex, out VS_OUT result ) {
|
||||
void main( VS_IN vertex, out VS_OUT result )
|
||||
{
|
||||
//--------------------------------------------------------------
|
||||
// GPU transformation of the normal / binormal / bitangent
|
||||
//
|
||||
|
@ -53,25 +56,25 @@ void main( VS_IN vertex, out VS_OUT result ) {
|
|||
const float w3 = vertex.color2.w;
|
||||
|
||||
float4 matX, matY, matZ; // must be float4 for vec4
|
||||
int joint = int(vertex.color.x * 255.1 * 3.0);
|
||||
matX = matrices[int(joint+0)] * w0;
|
||||
matY = matrices[int(joint+1)] * w0;
|
||||
matZ = matrices[int(joint+2)] * w0;
|
||||
int joint = int( vertex.color.x * 255.1 * 3.0 );
|
||||
matX = matrices[int( joint + 0 )] * w0;
|
||||
matY = matrices[int( joint + 1 )] * w0;
|
||||
matZ = matrices[int( joint + 2 )] * w0;
|
||||
|
||||
joint = int(vertex.color.y * 255.1 * 3.0);
|
||||
matX += matrices[int(joint+0)] * w1;
|
||||
matY += matrices[int(joint+1)] * w1;
|
||||
matZ += matrices[int(joint+2)] * w1;
|
||||
joint = int( vertex.color.y * 255.1 * 3.0 );
|
||||
matX += matrices[int( joint + 0 )] * w1;
|
||||
matY += matrices[int( joint + 1 )] * w1;
|
||||
matZ += matrices[int( joint + 2 )] * w1;
|
||||
|
||||
joint = int(vertex.color.z * 255.1 * 3.0);
|
||||
matX += matrices[int(joint+0)] * w2;
|
||||
matY += matrices[int(joint+1)] * w2;
|
||||
matZ += matrices[int(joint+2)] * w2;
|
||||
joint = int( vertex.color.z * 255.1 * 3.0 );
|
||||
matX += matrices[int( joint + 0 )] * w2;
|
||||
matY += matrices[int( joint + 1 )] * w2;
|
||||
matZ += matrices[int( joint + 2 )] * w2;
|
||||
|
||||
joint = int(vertex.color.w * 255.1 * 3.0);
|
||||
matX += matrices[int(joint+0)] * w3;
|
||||
matY += matrices[int(joint+1)] * w3;
|
||||
matZ += matrices[int(joint+2)] * w3;
|
||||
joint = int( vertex.color.w * 255.1 * 3.0 );
|
||||
matX += matrices[int( joint + 0 )] * w3;
|
||||
matY += matrices[int( joint + 1 )] * w3;
|
||||
matZ += matrices[int( joint + 2 )] * w3;
|
||||
|
||||
float4 vertexPosition = vertex.position;
|
||||
vertexPosition.w = 1.0;
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
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").
|
||||
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
|
||||
|
@ -28,6 +28,9 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#include "global.inc.hlsl"
|
||||
|
||||
// *INDENT-OFF*
|
||||
uniform sampler2D samp0 : register(s0);
|
||||
|
||||
struct PS_IN {
|
||||
float4 position : VPOS;
|
||||
float4 texcoord0 : TEXCOORD0_centroid;
|
||||
|
@ -36,8 +39,7 @@ struct PS_IN {
|
|||
struct PS_OUT {
|
||||
float4 color : COLOR;
|
||||
};
|
||||
|
||||
uniform sampler2D samp0 : register(s0);
|
||||
// *INDENT-OFF*
|
||||
|
||||
static float2 screenPosToTexcoord( float2 pos, float4 bias_scale ) { return ( pos * bias_scale.zw + bias_scale.xy ); }
|
||||
|
||||
|
@ -45,7 +47,7 @@ void main( PS_IN fragment, out PS_OUT result ) {
|
|||
const float renderWidth = 1280.0f;
|
||||
const float renderHeight = 720.0f;
|
||||
const float4 positionToViewTexture = float4( 0.5f / renderWidth, 0.5f / renderHeight, 1.0f / renderWidth, 1.0f / renderHeight );
|
||||
|
||||
|
||||
float interpolatedZOverW = ( 1.0 - ( fragment.texcoord0.z / fragment.texcoord0.w ) );
|
||||
|
||||
float3 pos;
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
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").
|
||||
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
|
||||
|
@ -28,6 +28,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#include "global.inc.hlsl"
|
||||
|
||||
// *INDENT-OFF*
|
||||
struct VS_IN {
|
||||
float4 position : POSITION;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
|
@ -40,8 +41,10 @@ struct VS_OUT {
|
|||
float4 position : POSITION;
|
||||
float4 texcoord0 : TEXCOORD0;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
void main( VS_IN vertex, out VS_OUT result ) {
|
||||
void main( VS_IN vertex, out VS_OUT result )
|
||||
{
|
||||
float4 position;
|
||||
position.x = dot4( vertex.position, rpMVPmatrixX );
|
||||
position.y = dot4( vertex.position, rpMVPmatrixY );
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 2013-2014 Robert Beckebans
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
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
|
||||
|
@ -31,7 +31,8 @@ float4 modelPosition = vertex.position;
|
|||
|
||||
// RB: no GPU skinning with ES 2.0
|
||||
#if defined(USE_GPU_SKINNING)
|
||||
BRANCH if ( rpEnableSkinning.x > 0.0 ) {
|
||||
BRANCH if( rpEnableSkinning.x > 0.0 )
|
||||
{
|
||||
//--------------------------------------------------------------
|
||||
// GPU transformation of the normal / binormal / bitangent
|
||||
//
|
||||
|
@ -43,25 +44,25 @@ BRANCH if ( rpEnableSkinning.x > 0.0 ) {
|
|||
const float w3 = vertex.color2.w;
|
||||
|
||||
float4 matX, matY, matZ; // must be float4 for vec4
|
||||
int joint = int(vertex.color.x * 255.1 * 3.0);
|
||||
matX = matrices[int(joint+0)] * w0;
|
||||
matY = matrices[int(joint+1)] * w0;
|
||||
matZ = matrices[int(joint+2)] * w0;
|
||||
int joint = int( vertex.color.x * 255.1 * 3.0 );
|
||||
matX = matrices[int( joint + 0 )] * w0;
|
||||
matY = matrices[int( joint + 1 )] * w0;
|
||||
matZ = matrices[int( joint + 2 )] * w0;
|
||||
|
||||
joint = int(vertex.color.y * 255.1 * 3.0);
|
||||
matX += matrices[int(joint+0)] * w1;
|
||||
matY += matrices[int(joint+1)] * w1;
|
||||
matZ += matrices[int(joint+2)] * w1;
|
||||
joint = int( vertex.color.y * 255.1 * 3.0 );
|
||||
matX += matrices[int( joint + 0 )] * w1;
|
||||
matY += matrices[int( joint + 1 )] * w1;
|
||||
matZ += matrices[int( joint + 2 )] * w1;
|
||||
|
||||
joint = int(vertex.color.z * 255.1 * 3.0);
|
||||
matX += matrices[int(joint+0)] * w2;
|
||||
matY += matrices[int(joint+1)] * w2;
|
||||
matZ += matrices[int(joint+2)] * w2;
|
||||
joint = int( vertex.color.z * 255.1 * 3.0 );
|
||||
matX += matrices[int( joint + 0 )] * w2;
|
||||
matY += matrices[int( joint + 1 )] * w2;
|
||||
matZ += matrices[int( joint + 2 )] * w2;
|
||||
|
||||
joint = int(vertex.color.w * 255.1 * 3.0);
|
||||
matX += matrices[int(joint+0)] * w3;
|
||||
matY += matrices[int(joint+1)] * w3;
|
||||
matZ += matrices[int(joint+2)] * w3;
|
||||
joint = int( vertex.color.w * 255.1 * 3.0 );
|
||||
matX += matrices[int( joint + 0 )] * w3;
|
||||
matY += matrices[int( joint + 1 )] * w3;
|
||||
matZ += matrices[int( joint + 2 )] * w3;
|
||||
|
||||
modelPosition.x = dot4( matX, vertex.position );
|
||||
modelPosition.y = dot4( matY, vertex.position );
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
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").
|
||||
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
|
||||
|
@ -28,6 +28,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#include "global.inc.hlsl"
|
||||
|
||||
// *INDENT-OFF*
|
||||
uniform samplerCUBE samp0 : register(s0);
|
||||
|
||||
struct PS_IN {
|
||||
|
@ -39,7 +40,9 @@ struct PS_IN {
|
|||
struct PS_OUT {
|
||||
float4 color : COLOR;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
void main( PS_IN fragment, out PS_OUT result ) {
|
||||
void main( PS_IN fragment, out PS_OUT result )
|
||||
{
|
||||
result.color = sRGBAToLinearRGBA( texCUBE( samp0, fragment.texcoord0 ) ) * fragment.color;
|
||||
}
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
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").
|
||||
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
|
||||
|
@ -28,6 +28,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#include "global.inc.hlsl"
|
||||
|
||||
// *INDENT-OFF*
|
||||
struct VS_IN {
|
||||
float4 position : POSITION;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
|
@ -41,14 +42,16 @@ struct VS_OUT {
|
|||
float3 texcoord0 : TEXCOORD0;
|
||||
float4 color : COLOR0;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
void main( VS_IN vertex, out VS_OUT result ) {
|
||||
void main( VS_IN vertex, out VS_OUT result )
|
||||
{
|
||||
result.position.x = dot4( vertex.position, rpMVPmatrixX );
|
||||
result.position.y = dot4( vertex.position, rpMVPmatrixY );
|
||||
result.position.z = dot4( vertex.position, rpMVPmatrixZ );
|
||||
result.position.w = dot4( vertex.position, rpMVPmatrixW );
|
||||
|
||||
result.texcoord0 = vertex.position.xyz - rpLocalViewOrigin.xyz;
|
||||
|
||||
|
||||
result.color = ( swizzleColor( vertex.color ) * rpVertexColorModulate ) + rpVertexColorAdd;
|
||||
}
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
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").
|
||||
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
|
||||
|
@ -28,12 +28,15 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#include "global.inc.hlsl"
|
||||
|
||||
// *INDENT-OFF*
|
||||
uniform sampler2D samp0 : register(s0);
|
||||
|
||||
struct PS_OUT {
|
||||
float4 color : COLOR;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
void main( out PS_OUT result ) {
|
||||
void main( out PS_OUT result )
|
||||
{
|
||||
result.color = rpColor;
|
||||
}
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
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").
|
||||
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
|
||||
|
@ -28,6 +28,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#include "global.inc.hlsl"
|
||||
|
||||
// *INDENT-OFF*
|
||||
struct VS_IN {
|
||||
float4 position : POSITION;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
|
@ -39,8 +40,10 @@ struct VS_IN {
|
|||
struct VS_OUT {
|
||||
float4 position : POSITION;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
void main( VS_IN vertex, out VS_OUT result ) {
|
||||
void main( VS_IN vertex, out VS_OUT result )
|
||||
{
|
||||
result.position.x = dot4( vertex.position, rpMVPmatrixX );
|
||||
result.position.y = dot4( vertex.position, rpMVPmatrixY );
|
||||
result.position.z = dot4( vertex.position, rpMVPmatrixZ );
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
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").
|
||||
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
|
||||
|
@ -28,6 +28,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#include "global.inc.hlsl"
|
||||
|
||||
// *INDENT-OFF*
|
||||
uniform sampler2D samp0 : register(s0);
|
||||
uniform sampler2D samp1 : register(s1);
|
||||
|
||||
|
@ -38,12 +39,17 @@ struct PS_IN {
|
|||
struct PS_OUT {
|
||||
float4 color : COLOR;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
void main( PS_IN fragment, out PS_OUT result ) {
|
||||
// texcoords will run from 0 to 1 across the entire screen
|
||||
if ( fract( fragment.position.y * 0.5 ) < 0.5 ) {
|
||||
result.color = tex2D( samp0, vec2( fragment.texcoord0 ) );
|
||||
} else {
|
||||
result.color = tex2D( samp1, vec2( fragment.texcoord0 ) );
|
||||
}
|
||||
void main( PS_IN fragment, out PS_OUT result )
|
||||
{
|
||||
// texcoords will run from 0 to 1 across the entire screen
|
||||
if( fract( fragment.position.y * 0.5 ) < 0.5 )
|
||||
{
|
||||
result.color = tex2D( samp0, vec2( fragment.texcoord0 ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
result.color = tex2D( samp1, vec2( fragment.texcoord0 ) );
|
||||
}
|
||||
}
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
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").
|
||||
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
|
||||
|
@ -28,6 +28,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#include "global.inc.hlsl"
|
||||
|
||||
// *INDENT-OFF*
|
||||
struct VS_IN {
|
||||
float4 position : POSITION;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
|
@ -37,8 +38,10 @@ struct VS_OUT {
|
|||
float4 position : POSITION;
|
||||
float2 texcoord0 : TEXCOORD0;
|
||||
};
|
||||
// *INDENT-ON*
|
||||
|
||||
void main( VS_IN vertex, out VS_OUT result ) {
|
||||
void main( VS_IN vertex, out VS_OUT result )
|
||||
{
|
||||
result.position.x = dot4( vertex.position, rpMVPmatrixX );
|
||||
result.position.y = dot4( vertex.position, rpMVPmatrixY );
|
||||
result.position.z = dot4( vertex.position, rpMVPmatrixZ );
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue