Shadersync from private project

This commit is contained in:
Robert Beckebans 2014-08-02 14:36:46 +02:00
parent f86bc286f6
commit f7e3f4b34d
67 changed files with 106 additions and 74 deletions

View file

@ -26,7 +26,7 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
#include "global.inc"
#include "renderprogs/global.inc"
uniform sampler2D samp0 : register(s0); // Y
uniform sampler2D samp1 : register(s1); // Cr

View file

@ -26,7 +26,7 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
#include "global.inc"
#include "renderprogs/global.inc"
struct VS_IN {
float4 position : POSITION;

View file

@ -26,7 +26,7 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
#include "global.inc"
#include "renderprogs/global.inc"
uniform sampler2D samp0 : register(s0); // Y
uniform sampler2D samp1 : register(s1); // Cr

View file

@ -27,7 +27,7 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
#include "global.inc"
#include "renderprogs/global.inc"
struct VS_IN {
float4 position : POSITION;

View file

@ -26,7 +26,7 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
#include "global.inc"
#include "renderprogs/global.inc"
uniform sampler2D samp0 : register(s0);
uniform sampler2D samp1 : register(s1);

View file

@ -26,7 +26,7 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
#include "global.inc"
#include "renderprogs/global.inc"
struct VS_IN {
float4 position : POSITION;

View file

@ -3,6 +3,7 @@
Doom 3 BFG Edition GPL Source Code
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").
@ -26,7 +27,7 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
#include "global.inc"
#include "renderprogs/global.inc"
uniform samplerCUBE samp0 : register(s0); // texture 0 is the cube map
uniform sampler2D samp1 : register(s1); // normal map
@ -48,7 +49,14 @@ struct PS_OUT {
void main( PS_IN fragment, out PS_OUT result ) {
float4 bump = tex2D( samp1, fragment.texcoord0 ) * 2.0f - 1.0f;
float3 localNormal = float3( bump.wy, 0.0f );
// RB begin
float3 localNormal;
#if defined(USE_NORMAL_FMT_RGB8)
localNormal = float3( bump.rg, 0.0f );
#else
localNormal = float3( bump.wy, 0.0f );
#endif
// RB end
localNormal.z = sqrt( 1.0f - dot3( localNormal, localNormal ) );
float3 globalNormal;

View file

@ -26,7 +26,7 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
#include "global.inc"
#include "renderprogs/global.inc"
struct VS_IN {
float4 position : POSITION;

View file

@ -3,6 +3,7 @@
Doom 3 BFG Edition GPL Source Code
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").
@ -26,7 +27,7 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
#include "global.inc"
#include "renderprogs/global.inc"
uniform samplerCUBE samp0 : register(s0); // texture 0 is the cube map
uniform sampler2D samp1 : register(s1); // normal map
@ -48,7 +49,15 @@ struct PS_OUT {
void main( PS_IN fragment, out PS_OUT result ) {
float4 bump = tex2D( samp1, fragment.texcoord0 ) * 2.0f - 1.0f;
float3 localNormal = float3( bump.wy, 0.0f );
// RB begin
float3 localNormal;
#if defined(GLES2)
localNormal = float3( bump.rg, 0.0f );
#else
localNormal = float3( bump.wy, 0.0f );
#endif
// RB end
localNormal.z = sqrt( 1.0f - dot3( localNormal, localNormal ) );
float3 globalNormal;

View file

@ -27,7 +27,7 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
#include "global.inc"
#include "renderprogs/global.inc"
uniform matrices_ubo { float4 matrices[408]; };

View file

@ -26,7 +26,7 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
#include "global.inc"
#include "renderprogs/global.inc"
uniform sampler2D samp0 : register(s0);

View file

@ -27,7 +27,7 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
#include "global.inc"
#include "renderprogs/global.inc"
#if defined(USE_GPU_SKINNING)
uniform matrices_ubo { float4 matrices[408]; };
@ -60,22 +60,22 @@ void main( VS_IN vertex, out VS_OUT result )
const float w3 = vertex.color2.w;
float4 matX, matY, matZ; // must be float4 for vec4
float joint = vertex.color.x * 255.1 * 3;
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 = vertex.color.y * 255.1 * 3;
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 = vertex.color.z * 255.1 * 3;
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 = vertex.color.w * 255.1 * 3;
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;

View file

@ -26,7 +26,7 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
#include "global.inc"
#include "renderprogs/global.inc"
uniform sampler2D samp0 : register(s0);
struct PS_OUT {

View file

@ -26,7 +26,7 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
#include "global.inc"
#include "renderprogs/global.inc"
struct VS_IN {
float4 position : POSITION;

View file

@ -26,7 +26,7 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
#include "global.inc"
#include "renderprogs/global.inc"
uniform sampler2D samp0 : register(s0);
struct PS_OUT {

View file

@ -27,7 +27,7 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
#include "global.inc"
#include "renderprogs/global.inc"
uniform matrices_ubo { float4 matrices[408]; };

View file

@ -26,7 +26,7 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
#include "global.inc"
#include "renderprogs/global.inc"
uniform samplerCUBE samp0 : register(s0); // texture 0 is the cube map

View file

@ -26,7 +26,7 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
#include "global.inc"
#include "renderprogs/global.inc"
struct VS_IN {
float4 position : POSITION;

View file

@ -26,7 +26,7 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
#include "global.inc"
#include "renderprogs/global.inc"
uniform samplerCUBE samp0 : register(s0); // texture 0 is the cube map

View file

@ -27,7 +27,7 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
#include "global.inc"
#include "renderprogs/global.inc"
uniform matrices_ubo { float4 matrices[408]; };

View file

@ -26,7 +26,7 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
#include "global.inc"
#include "renderprogs/global.inc"
uniform sampler2D samp0 : register(s0);
uniform sampler2D samp1 : register(s1);

View file

@ -26,7 +26,7 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
#include "global.inc"
#include "renderprogs/global.inc"
struct VS_IN {
float4 position : POSITION;

View file

@ -26,7 +26,7 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
#include "global.inc"
#include "renderprogs/global.inc"
uniform sampler2D samp0 : register(s0);
uniform sampler2D samp1 : register(s1);

View file

@ -27,7 +27,7 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
#include "global.inc"
#include "renderprogs/global.inc"
uniform matrices_ubo { float4 matrices[408]; };

View file

@ -26,7 +26,7 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
#include "global.inc"
#include "renderprogs/global.inc"
#define FXAA_GREEN_AS_LUMA 1
#define FXAA_EARLY_EXIT 0
#include "Fxaa3_11.h"

View file

@ -26,7 +26,7 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
#include "global.inc"
#include "renderprogs/global.inc"
struct VS_IN {
float4 position : POSITION;

View file

@ -26,7 +26,7 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
#include "global.inc"
#include "renderprogs/global.inc"
uniform sampler2D samp0 : register(s0);

View file

@ -27,7 +27,7 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
#include "global.inc"
#include "renderprogs/global.inc"
struct VS_IN {
float4 position : POSITION;

View file

@ -2,7 +2,8 @@
===========================================================================
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").

View file

@ -26,7 +26,7 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
#include "global.inc"
#include "renderprogs/global.inc"
uniform sampler2D samp0 : register(s0); // texture 1 is the per-surface bump map
uniform sampler2D samp1 : register(s1); // texture 2 is the light falloff texture
@ -61,13 +61,20 @@ void main( PS_IN fragment, out PS_OUT result ) {
half3 diffuseMap = ConvertYCoCgToRGB( YCoCG );
half3 localNormal;
// RB begin
#if defined(USE_NORMAL_FMT_RGB8)
localNormal.xy = bumpMap.rg - 0.5;
#else
localNormal.xy = bumpMap.wy - 0.5;
#endif
// RB end
localNormal.z = sqrt( abs( dot( localNormal.xy, localNormal.xy ) - 0.25 ) );
localNormal = normalize( localNormal );
const half specularPower = 10.0f;
half hDotN = dot3( normalize( fragment.texcoord6.xyz ), localNormal );
half3 specularContribution = _half3( pow( hDotN, specularPower ) );
// RB: added abs
half3 specularContribution = _half3( pow( abs( hDotN ), specularPower ) );
half3 diffuseColor = diffuseMap * rpDiffuseModifier.xyz;
half3 specularColor = specMap.xyz * specularContribution * rpSpecularModifier.xyz;

View file

@ -26,7 +26,7 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
#include "global.inc"
#include "renderprogs/global.inc"
struct VS_IN {
float4 position : POSITION;

View file

@ -3,6 +3,7 @@
Doom 3 BFG Edition GPL Source Code
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").
@ -26,7 +27,7 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
#include "global.inc"
#include "renderprogs/global.inc"
uniform sampler2D samp0 : register(s0); // texture 1 is the per-surface bump map
uniform sampler2D samp1 : register(s1); // texture 2 is the light falloff texture
@ -61,7 +62,13 @@ void main( PS_IN fragment, out PS_OUT result ) {
half3 diffuseMap = ConvertYCoCgToRGB( YCoCG );
half3 localNormal;
// RB begin
#if defined(USE_NORMAL_FMT_RGB8)
localNormal.xy = bumpMap.rg - 0.5;
#else
localNormal.xy = bumpMap.wy - 0.5;
#endif
// RB end
localNormal.z = sqrt( abs( dot( localNormal.xy, localNormal.xy ) - 0.25 ) );
localNormal = normalize( localNormal );

View file

@ -27,7 +27,7 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
#include "global.inc"
#include "renderprogs/global.inc"
uniform matrices_ubo { float4 matrices[408]; };

View file

@ -27,7 +27,7 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
#include "global.inc"
#include "renderprogs/global.inc"
uniform sampler2D samp0 : register(s0); // view color
uniform sampler2D samp1 : register(s1); // view depth

View file

@ -26,7 +26,7 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
#include "global.inc"
#include "renderprogs/global.inc"
struct VS_IN {
float4 position : POSITION;

View file

@ -26,7 +26,7 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
#include "global.inc"
#include "renderprogs/global.inc"
uniform sampler2D samp0 : register(s0);

View file

@ -26,7 +26,7 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
#include "global.inc"
#include "renderprogs/global.inc"
struct VS_IN {
float4 position : POSITION;

View file

@ -26,7 +26,7 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
#include "global.inc"
#include "renderprogs/global.inc"
uniform sampler2D samp0 : register(s0);
struct PS_OUT {

View file

@ -26,7 +26,7 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
#include "global.inc"
#include "renderprogs/global.inc"
struct VS_IN {
float4 position : POSITION;

View file

@ -26,7 +26,7 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
#include "global.inc"
#include "renderprogs/global.inc"
uniform sampler2D samp0 : register(s0);
struct PS_OUT {

View file

@ -26,7 +26,7 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
#include "global.inc"
#include "renderprogs/global.inc"
struct VS_IN {
float4 position : POSITION;

View file

@ -26,7 +26,7 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
#include "global.inc"
#include "renderprogs/global.inc"
uniform sampler2D samp0 : register(s0);
struct PS_OUT {

View file

@ -27,7 +27,7 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
#include "global.inc"
#include "renderprogs/global.inc"
uniform matrices_ubo { float4 matrices[408]; };

View file

@ -26,7 +26,7 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
#include "global.inc"
#include "renderprogs/global.inc"
uniform sampler2D samp0 : register(s0);
struct PS_OUT {

View file

@ -27,7 +27,7 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
#include "global.inc"
#include "renderprogs/global.inc"
uniform matrices_ubo { float4 matrices[408]; };

View file

@ -26,7 +26,7 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
#include "global.inc"
#include "renderprogs/global.inc"
struct PS_IN {
float4 position : VPOS;

View file

@ -26,7 +26,7 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
#include "global.inc"
#include "renderprogs/global.inc"
struct VS_IN {
float4 position : POSITION;

View file

@ -26,7 +26,7 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
#include "global.inc"
#include "renderprogs/global.inc"
uniform samplerCUBE samp0 : register(s0);

View file

@ -26,7 +26,7 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
#include "global.inc"
#include "renderprogs/global.inc"
struct VS_IN {
float4 position : POSITION;

View file

@ -26,7 +26,7 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
#include "global.inc"
#include "renderprogs/global.inc"
uniform sampler2D samp0 : register(s0);

View file

@ -26,7 +26,7 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
#include "global.inc"
#include "renderprogs/global.inc"
struct VS_IN {
float4 position : POSITION;

View file

@ -26,7 +26,7 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
#include "global.inc"
#include "renderprogs/global.inc"
uniform sampler2D samp0 : register(s0);
uniform sampler2D samp1 : register(s1);

View file

@ -26,7 +26,7 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
#include "global.inc"
#include "renderprogs/global.inc"
struct VS_IN {
float4 position : POSITION;

View file

@ -26,7 +26,7 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
#include "global.inc"
#include "renderprogs/global.inc"
/*

View file

@ -26,7 +26,7 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
#include "global.inc"
#include "renderprogs/global.inc"
struct VS_IN {
float4 position : POSITION;

View file

@ -26,7 +26,7 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
#include "global.inc"
#include "renderprogs/global.inc"
uniform sampler2D samp0 : register(s0);

View file

@ -26,7 +26,7 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
#include "global.inc"
#include "renderprogs/global.inc"
struct VS_IN {
float4 position : POSITION;

View file

@ -26,7 +26,7 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
#include "global.inc"
#include "renderprogs/global.inc"
uniform sampler2D samp0 : register(s0);

View file

@ -26,7 +26,7 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
#include "global.inc"
#include "renderprogs/global.inc"
struct VS_IN {
float4 position : POSITION;

View file

@ -26,7 +26,7 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
#include "global.inc"
#include "renderprogs/global.inc"
uniform sampler2D samp0 : register(s0);

View file

@ -27,7 +27,7 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
#include "global.inc"
#include "renderprogs/global.inc"
uniform matrices_ubo { float4 matrices[408]; };

View file

@ -26,7 +26,7 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
#include "global.inc"
#include "renderprogs/global.inc"
uniform sampler2D samp0 : register(s0);

View file

@ -26,7 +26,7 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
#include "global.inc"
#include "renderprogs/global.inc"
struct VS_IN {
float4 position : POSITION;

View file

@ -26,7 +26,7 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
#include "global.inc"
#include "renderprogs/global.inc"
uniform samplerCUBE samp0 : register(s0);

View file

@ -26,7 +26,7 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
#include "global.inc"
#include "renderprogs/global.inc"
struct VS_IN {
float4 position : POSITION;

View file

@ -26,7 +26,7 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
#include "global.inc"
#include "renderprogs/global.inc"
struct PS_OUT {
float depth : DEPTH;

View file

@ -26,7 +26,7 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
#include "global.inc"
#include "renderprogs/global.inc"
struct VS_IN {
float4 position : POSITION;