Skip to content

Commit

Permalink
• Restored working "partial scene"
Browse files Browse the repository at this point in the history
  • Loading branch information
Patapom committed Sep 15, 2018
1 parent 3746508 commit 2febff6
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 9 deletions.
4 changes: 2 additions & 2 deletions Tests/TestMSBRDF/Shaders/RenderComplete.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include "BRDF.hlsl"
#include "Scene.hlsl"

#define FULL_SCENE 1 // Define this to render the full scene (diffuse plane + specular sphere)
//#define FULL_SCENE 1 // Define this to render the full scene (diffuse plane + specular sphere)
//#define FORCE_BRDF 2 // Define this to force all surfaces as specular (1), diffuse (2)

#define DIELECTRIC_SPHERE 1 // Define this to use the full dielectric sphere model
Expand Down Expand Up @@ -269,7 +269,7 @@ float3 SampleSecondaryLight( float3 _wsPosition, float3 _wsNormal, float3 _wsVie
}

float3 ComputeIncomingRadiance( float3 _wsPosition, float3 _wsView, uint2 _seeds ) {
#if FULL_SCENE
#ifdef FULL_SCENE
// Compute secondary hit with scene
float3 wsClosestPosition = 0;
float3 wsNormal = float3( 0, 1, 0 );
Expand Down
8 changes: 5 additions & 3 deletions Tests/TestMSBRDF/Shaders/Scene.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@ float2 RayTraceScene( float3 _wsPos, float3 _wsDir, out float3 _wsNormal, out fl
return float2( t, 0 ); // Sphere hit
}

t = RayTracePlane( _wsPos, _wsDir );
if ( t < 1e4 )
return float2( t, 1 ); // Plane hit
#ifdef FULL_SCENE
t = RayTracePlane( _wsPos, _wsDir );
if ( t < 1e4 )
return float2( t, 1 ); // Plane hit
#endif

return float2( INFINITY, -1 ); // No hit...
}
Expand Down
18 changes: 14 additions & 4 deletions Tests/TestMSBRDF/TestForm.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
//#define PRECOMPUTE_BRDF // Define this to precompute the BRDF, comment to only load it ► WARNING ► This code is not functional! Tables are now generated by a mathematica notebook!
#define TEST_SH_ENVIRONMENT // Define this to test MSBRDF lighting by an SH-encoded environment
//#define TEST_LTC_AREA_LIGHT // Define this to test MSBRDF lighting by an LTC area light
//#define PRECOMPUTE_BRDF // Define this to precompute the BRDF, comment to only load it ► WARNING ► This code is not functional! Tables are now generated by a mathematica notebook!

#define TEST_COMPLETE_SCENE_SPHERE_ONLY // Define this to test MSBRDF lighting on the sphere
//#define TEST_COMPLETE_SCENE // Define this to test MSBRDF lighting on the full scene

//#define TEST_SH_ENVIRONMENT // Define this to test MSBRDF lighting by an SH-encoded environment
//#define TEST_LTC_AREA_LIGHT // Define this to test MSBRDF lighting by an LTC area light

using System;
using System.Collections.Generic;
Expand Down Expand Up @@ -185,8 +189,14 @@ protected override void OnLoad( EventArgs e ) {

floatTrackbarControlLightElevation.Value = 0.5f;

#elif TEST_COMPLETE_SCENE || TEST_COMPLETE_SCENE_SPHERE_ONLY
ShaderMacro[] macros = null;
#if TEST_COMPLETE_SCENE
macros = new ShaderMacro[] { new ShaderMacro( "FULL_SCENE", "1" ) };
#endif
m_shader_Accumulate = new Shader( m_device, new System.IO.FileInfo( "Shaders/RenderComplete.hlsl" ), VERTEX_FORMAT.Pt4, "VS", null, "PS", macros ); // Use this for a full render
#else
m_shader_Accumulate = new Shader( m_device, new System.IO.FileInfo( "Shaders/RenderComplete.hlsl" ), VERTEX_FORMAT.Pt4, "VS", null, "PS", null ); // Use this for a full render
throw new Exception( "Invalid scene!" );
#endif
} catch ( Exception _e ) {
MessageBox.Show( "Shader failed to compile!\n\n" + _e.Message, "MSBRDF Test", MessageBoxButtons.OK, MessageBoxIcon.Error );
Expand Down

0 comments on commit 2febff6

Please sign in to comment.