Fermat
src
renderers
psfpt.h
1
/*
2
* Fermat
3
*
4
* Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved.
5
*
6
* Redistribution and use in source and binary forms, with or without
7
* modification, are permitted provided that the following conditions are met:
8
* * Redistributions of source code must retain the above copyright
9
* notice, this list of conditions and the following disclaimer.
10
* * Redistributions in binary form must reproduce the above copyright
11
* notice, this list of conditions and the following disclaimer in the
12
* documentation and/or other materials provided with the distribution.
13
* * Neither the name of the NVIDIA CORPORATION nor the
14
* names of its contributors may be used to endorse or promote products
15
* derived from this software without specific prior written permission.
16
*
17
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20
* DISCLAIMED. IN NO EVENT SHALL NVIDIA CORPORATION BE LIABLE FOR ANY
21
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
*/
28
29
#pragma once
30
31
#include <pathtracer.h>
32
#include <types.h>
33
#include <buffers.h>
34
#include <ray.h>
35
#include <tiled_sequence.h>
36
#include <
cugar/sampling/lfsr.h
>
37
#include <
cugar/linalg/bbox.h
>
38
#include <renderer_interface.h>
39
#include <hashmap.h>
40
41
struct
RenderingContext
;
42
struct
MeshVTLStorage
;
43
struct
ClusteredRLStorage
;
44
struct
AdaptiveClusteredRLStorage
;
45
49
333
334
337
347
350
struct
PSFPTOptions
:
PTOptions
351
{
352
uint32 psf_depth;
353
float
psf_width;
354
float
psf_min_dist;
355
float
psf_max_prob;
356
uint32 psf_temporal_reuse;
357
float
firefly_filter;
358
359
PSFPTOptions
() :
360
psf_depth(1),
361
psf_width(3.0f),
362
psf_min_dist(0.1f),
363
psf_max_prob(32.0f),
364
psf_temporal_reuse(64),
365
firefly_filter(100.0f) {}
366
367
void
parse(
const
int
argc,
char
** argv)
368
{
369
PTOptions::parse(argc, argv);
370
371
for
(
int
i = 0; i < argc; ++i)
372
{
373
if
(strcmp(argv[i],
"-filter-depth"
) == 0)
374
psf_depth = atoi(argv[++i]);
375
else
if
(strcmp(argv[i],
"-filter-width"
) == 0)
376
psf_width = (float)atof(argv[++i]);
377
else
if
(strcmp(argv[i],
"-filter-min-dist"
) == 0)
378
psf_min_dist = (
float
)atof(argv[++i]);
379
else
if
(strcmp(argv[i],
"-filter-max-prob"
) == 0)
380
psf_max_prob = (float)atof(argv[++i]);
381
else
if
(strcmp(argv[i],
"-temporal-reuse"
) == 0)
382
psf_temporal_reuse = atoi(argv[++i]);
383
else
if
(strcmp(argv[i],
"-firefly-filter"
) == 0 ||
384
strcmp(argv[i],
"-ff"
) == 0)
385
firefly_filter = (
float
)atof(argv[++i]);
386
}
387
}
388
};
389
399
struct
PSFPT
:
RendererInterface
400
{
401
typedef
AdaptiveClusteredRLStorage
VTLRLStorage
;
402
403
enum
PassType {
404
kPresamplePass = 0,
405
kFinalPass = 1
406
};
407
408
PSFPT
();
409
410
void
init(
int
argc,
char
** argv,
RenderingContext
& renderer);
411
412
void
render_pass(
const
uint32 instance,
RenderingContext
& renderer,
const
PassType pass_type);
413
414
void
render(
const
uint32 instance,
RenderingContext
& renderer);
415
416
void
keyboard(
unsigned
char
character,
int
x,
int
y,
bool
& invalidate);
417
418
void
destroy
() {
delete
this
; }
419
420
static
RendererInterface
* factory() {
return
new
PSFPT
(); }
421
422
// general path tracing members
423
DomainBuffer<CUDA_BUFFER, uint8>
m_memory_pool;
424
425
PSFPTOptions
m_options;
426
TiledSequence
m_sequence;
427
428
cugar::LFSRGeneratorMatrix
m_generator;
429
cugar::LFSRRandomStream
m_random;
430
431
MeshVTLStorage
* m_mesh_vtls;
432
VTLRLStorage* m_vtls_rl;
433
cugar::Bbox3f
m_bbox;
434
435
float
m_time;
436
PTStats
m_stats;
437
438
// PSFPT specific members
439
DeviceHashTable
m_psf_hash;
440
DomainBuffer<CUDA_BUFFER, float4>
m_psf_values;
441
//DomainBuffer<CUDA_BUFFER, uint32> m_psf_timestamps;
442
};
443
MeshVTLStorage
Definition:
mesh_lights.h:59
PSFPT::destroy
void destroy()
Definition:
psfpt.h:418
AdaptiveClusteredRLStorage
Definition:
clustered_rl.h:161
PTOptions
Definition:
pathtracer.h:169
cugar::Bbox< Vector3f >
bbox.h
Defines an axis-aligned bounding box class.
DeviceHashTable
Definition:
hashmap.h:32
PSFPT
Definition:
psfpt.h:399
cugar::LFSRGeneratorMatrix
Definition:
lfsr.h:66
TiledSequence
Definition:
tiled_sequence.h:131
PSFPTOptions
Definition:
psfpt.h:350
RendererInterface
Definition:
renderer_interface.h:45
cugar::LFSRRandomStream
Definition:
lfsr.h:109
ClusteredRLStorage
Definition:
clustered_rl.h:87
RenderingContext
Definition:
renderer.h:52
DomainBuffer< CUDA_BUFFER, uint8 >
PTStats
Definition:
pathtracer.h:254
lfsr.h
Defines several random samplers.
Generated by
1.8.13