Add --preview switch that significantly reduces sample count

This commit is contained in:
RaveYard 2022-07-06 11:45:36 +02:00
parent e97babc617
commit 48430fb306
5 changed files with 18 additions and 7 deletions

View file

@ -17,6 +17,9 @@
extern bool VKDebug; extern bool VKDebug;
extern int NumThreads; extern int NumThreads;
extern int coverageSampleCount;
extern int bounceSampleCount;
CPURaytracer::CPURaytracer() CPURaytracer::CPURaytracer()
{ {
} }

View file

@ -92,9 +92,6 @@ private:
static void RunJob(int count, std::function<void(int i)> callback); static void RunJob(int count, std::function<void(int i)> callback);
const int coverageSampleCount = 256;
const int bounceSampleCount = 2048;
LevelMesh* mesh = nullptr; LevelMesh* mesh = nullptr;
std::vector<vec3> HemisphereVectors; std::vector<vec3> HemisphereVectors;
std::vector<CPULightInfo> Lights; std::vector<CPULightInfo> Lights;

View file

@ -29,6 +29,10 @@
extern bool VKDebug; extern bool VKDebug;
extern int coverageSampleCount;
extern int bounceSampleCount;
extern int ambientSampleCount;
GPURaytracer::GPURaytracer() GPURaytracer::GPURaytracer()
{ {
device = std::make_unique<VulkanDevice>(0, VKDebug); device = std::make_unique<VulkanDevice>(0, VKDebug);

View file

@ -90,9 +90,6 @@ private:
static float RadicalInverse_VdC(uint32_t bits); static float RadicalInverse_VdC(uint32_t bits);
static vec2 Hammersley(uint32_t i, uint32_t N); static vec2 Hammersley(uint32_t i, uint32_t N);
const int coverageSampleCount = 256;
const int bounceSampleCount = 2048;
const int ambientSampleCount = 2048;
int rayTraceImageSize = 1024; int rayTraceImageSize = 1024;
LevelMesh* mesh = nullptr; LevelMesh* mesh = nullptr;

View file

@ -119,6 +119,10 @@ bool CPURaytrace = false;
bool VKDebug = false; bool VKDebug = false;
bool DumpMesh = false; bool DumpMesh = false;
int coverageSampleCount = 256;
int bounceSampleCount = 2048;
int ambientSampleCount = 2048;
// PRIVATE DATA DEFINITIONS ------------------------------------------------ // PRIVATE DATA DEFINITIONS ------------------------------------------------
static option long_opts[] = static option long_opts[] =
@ -157,10 +161,11 @@ static option long_opts[] =
{"cpu-raytrace", no_argument, 0, 'C'}, {"cpu-raytrace", no_argument, 0, 'C'},
{"vkdebug", no_argument, 0, 'D'}, {"vkdebug", no_argument, 0, 'D'},
{"dump-mesh", no_argument, 0, 1004}, {"dump-mesh", no_argument, 0, 1004},
{"preview", no_argument, 0, 1005},
{0,0,0,0} {0,0,0,0}
}; };
static const char short_opts[] = "wVgGvbNrReEm:o:f:p:s:d:PqtzZXx5cj:S:CD:"; static const char short_opts[] = "wVgGvbNrReEm:o:f:p:s:d:PqtzZXx5cj:S:CD::";
// CODE -------------------------------------------------------------------- // CODE --------------------------------------------------------------------
@ -457,6 +462,11 @@ static void ParseArgs(int argc, char **argv)
case 1004: case 1004:
DumpMesh = true; DumpMesh = true;
break; break;
case 1005:
coverageSampleCount = 4;
bounceSampleCount = 16;
ambientSampleCount = 16;
break;
case 1000: case 1000:
ShowUsage(); ShowUsage();
exit(0); exit(0);