nxdk_pgraph_tests
A collection of tests for the Xbox nv2a graphics processor
 
Loading...
Searching...
No Matches
LightingControlTests Class Reference

#include <lighting_control_tests.h>

Inheritance diagram for LightingControlTests:
Collaboration diagram for LightingControlTests:

Public Member Functions

 LightingControlTests (TestHost &host, std::string output_dir, const Config &config)
 
void Deinitialize () override
 Called to tear down the test suite.
 
void Initialize () override
 Called to initialize the test suite.
 
- Public Member Functions inherited from TestSuite
 TestSuite (TestHost &host, std::string output_dir, std::string suite_name, const Config &config)
 
const std::string & Name () const
 
virtual void SetupTest ()
 Called before running an individual test within this suite.
 
virtual void TearDownTest ()
 Called after running an individual test within this suite.
 
void DisableTests (const std::set< std::string > &tests_to_skip)
 
std::vector< std::string > TestNames () const
 
bool HasEnabledTests () const
 
void Run (const std::string &test_name)
 
void RunAll ()
 
void SetSavingAllowed (bool enable=true)
 

Additional Inherited Members

- Static Public Member Functions inherited from TestSuite
static void TagNV2ATrace (uint32_t num_nops)
 Inserts a pattern of NV097_NO_OPERATION's into the pushbuffer to allow identification when viewing nv2a traces.
 
- Protected Member Functions inherited from TestSuite
void SetDefaultTextureFormat () const
 
- Protected Attributes inherited from TestSuite
TestHosthost_
 
std::string output_dir_
 
std::string suite_name_
 
bool allow_saving_ {true}
 
std::map< std::string, std::function< void()> > tests_ {}
 
PGRAPHDiffToken pgraph_diff_
 
bool enable_progress_log_
 
bool enable_pgraph_region_diff_
 
uint32_t delay_milliseconds_between_tests_
 
std::shared_ptr< FTPLoggerftp_logger_
 

Detailed Description

Tests the effects of NV097_SET_LIGHT_CONTROL (0x294) in conjunction with NV097_SET_SPECULAR_ENABLE.

A number of test meshes are rendered and lit with two lights:

1) A directional light coming from the left and pointing into the screen (direction is {1, 0, 1}).

2) An attenuated point light on the right at {1.5f, 1.f, -2.5f} with a max rannge of 4. and attenuation of {0.025f, 0.15f, 0.02f}.

Both lights have ambient {0.f, 0.f, 0.05f}, diffuse {0.25f, 0.f, 0.f}, specular {0.f, 0.2f, 0.4f}.

Meshes have the specular color of each vertex at {0.f, 0.4, 0.f, 0.25f}.

All colors are taken from the material (i.e., contributed by the lights). NV097_SET_MATERIAL_ALPHA is set to 0.4 and the scene ambient is a very dark grey at 0.031373.

See also: the OpenGL 2.1 specification lighting model https://registry.khronos.org/OpenGL/specs/gl/glspec21.pdf

Notes on use with the programmable pipeline:

While it is possible to enable lights when using a vertex shader, it appears that parts of the pipeline are not fully initialized, leading to non-deterministic color effects that change with each draw and often differ across cold boots of the hardware.

Leaving lighting enabled without enabling any lights via NV097_SET_LIGHT_ENABLE_MASK will cause all vertices to be black in color, but alpha will still come from the material when allowed by the light control and specular enable settings.

Disabling specular with lighting enabled will still disable the alpha application.

Enabling specular with lighting disabled will apply the material alpha and use the vertex shader output colors.

Constructor & Destructor Documentation

◆ LightingControlTests()

LightingControlTests::LightingControlTests ( TestHost host,
std::string  output_dir,
const Config config 
)
Remarks
FF_0x000000 Tests behavior using the fixed function pipeline with SET_SPECULAR_ENABLED on. Separate specular is off, causing the green of the mesh specular to be retained. Localeye is off, using a simplified model for specular highlighting, causing artifacts for the point light on the cylinder mesh. Light control alpha is forced to opaque.
FF_0x000000NoSpec Tests behavior using the fixed function pipeline with SET_SPECULAR_ENABLED off. Separate specular is ignored because SPECULAR_ENABLED is off, so the green of the mesh specular is not seen. Localeye is off, using a simplified model for specular highlighting, causing artifacts for the point light on the cylinder mesh. Light control alpha is ignored and the mesh is forced to opaque because SPECULAR_ENABLED is off. Visually equivalent to FF_0x000001.
FF_0x000001 Tests behavior using the fixed function pipeline with SET_SPECULAR_ENABLED on. Separate specular is on, so the green of the mesh specular is not seen. Localeye is off, using a simplified model for specular highlighting, causing artifacts for the point light on the cylinder mesh. Light control alpha is forced to opaque.
FF_0x000001NoSpec Tests behavior using the fixed function pipeline with SET_SPECULAR_ENABLED off. Separate specular is ignored because SPECULAR_ENABLED is off, so the green of the mesh specular is not seen. Localeye is off, using a simplified model for specular highlighting, causing artifacts for the point light on the cylinder mesh. Light control alpha is ignored and the mesh is forced to opaque because SPECULAR_ENABLED is off.
FF_0x010000 Tests behavior using the fixed function pipeline with SET_SPECULAR_ENABLED on. Separate specular is off, causing the green of the mesh specular to be retained. Localeye is on, using a slower model for specular highlighting that results in more realistic behavior for the point light on the cylinder mesh. Light control alpha is forced to opaque.
FF_0x010000NoSpec Tests behavior using the fixed function pipeline with SET_SPECULAR_ENABLED off. Separate specular is ignored because SPECULAR_ENABLED is off, so the green of the mesh specular is not seen. Localeye is on, using a slower model for specular highlighting that results in more realistic behavior for the point light on the cylinder mesh. Light control alpha is ignored and the mesh is forced to opaque because SPECULAR_ENABLED is off.
FF_0x010001 Tests behavior using the fixed function pipeline with SET_SPECULAR_ENABLED on. Separate specular is on, so the green of the mesh specular is not seen. Localeye is on, using a slower model for specular highlighting that results in more realistic behavior for the point light on the cylinder mesh. Light control alpha is forced to opaque.
FF_0x010001NoSpec Tests behavior using the fixed function pipeline with SET_SPECULAR_ENABLED off. Separate specular is ignored because SPECULAR_ENABLED is off, so the green of the mesh specular is not seen. Localeye is on, using a slower model for specular highlighting that results in more realistic behavior for the point light on the cylinder mesh. Light control alpha is ignored and the mesh is forced to opaque because SPECULAR_ENABLED is off.
FF_0x020000 Tests behavior using the fixed function pipeline with SET_SPECULAR_ENABLED on. Separate specular is off, causing the green of the mesh specular to be retained. Localeye is off, using a simplified model for specular highlighting, causing artifacts for the point light on the cylinder mesh. Light control alpha is set to compute the alpha from the specular and light effects, so the model is transluscent.
FF_0x020000NoSpec Tests behavior using the fixed function pipeline with SET_SPECULAR_ENABLED off. Separate specular is ignored because SPECULAR_ENABLED is off, so the green of the mesh specular is not seen. Localeye is off, using a simplified model for specular highlighting, causing artifacts for the point light on the cylinder mesh. Light control alpha is ignored and the mesh is forced to opaque because SPECULAR_ENABLED is off.
FF_0x020001 Tests behavior using the fixed function pipeline with SET_SPECULAR_ENABLED on. Separate specular is on, so the green of the mesh specular is not seen. Localeye is off, using a simplified model for specular highlighting, causing artifacts for the point light on the cylinder mesh. Light control alpha is set to compute the alpha from the specular and light effects, so the model is transluscent.
FF_0x020001NoSpec Tests behavior using the fixed function pipeline with SET_SPECULAR_ENABLED off. Separate specular is ignored because SPECULAR_ENABLED is off, so the green of the mesh specular is not seen. Localeye is off, using a simplified model for specular highlighting, causing artifacts for the point light on the cylinder mesh. Light control alpha is ignored and the mesh is forced to opaque because SPECULAR_ENABLED is off.
FF_0x030000 Tests behavior using the fixed function pipeline with SET_SPECULAR_ENABLED on. Separate specular is off, causing the green of the mesh specular to be retained. Localeye is on, using a slower model for specular highlighting that results in more realistic behavior for the point light on the cylinder mesh. Light control alpha is set to compute the alpha from the specular and light effects, so the model is transluscent.
FF_0x030000NoSpec Tests behavior using the fixed function pipeline with SET_SPECULAR_ENABLED off. Separate specular is ignored because SPECULAR_ENABLED is off, so the green of the mesh specular is not seen. Localeye is on, using a slower model for specular highlighting that results in more realistic behavior for the point light on the cylinder mesh. Light control alpha is ignored and the mesh is forced to opaque because SPECULAR_ENABLED is off.
FF_0x030001 Tests behavior using the fixed function pipeline with SET_SPECULAR_ENABLED on. Separate specular is on, so the green of the mesh specular is not seen. Localeye is on, using a slower model for specular highlighting that results in more realistic behavior for the point light on the cylinder mesh. Light control alpha is set to compute the alpha from the specular and light effects, so the model is transluscent.
FF_0x030001NoSpec Tests behavior using the fixed function pipeline with SET_SPECULAR_ENABLED off. Separate specular is ignored because SPECULAR_ENABLED is off, so the green of the mesh specular is not seen. Localeye is on, using a slower model for specular highlighting that results in more realistic behavior for the point light on the cylinder mesh. Light control alpha is ignored and the mesh is forced to opaque because SPECULAR_ENABLED is off.

Member Function Documentation

◆ Deinitialize()

void LightingControlTests::Deinitialize ( )
overridevirtual

Called to tear down the test suite.

Reimplemented from TestSuite.

◆ Initialize()

void LightingControlTests::Initialize ( )
overridevirtual

Called to initialize the test suite.

Reimplemented from TestSuite.


The documentation for this class was generated from the following files: