1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
|
// Copyright 2009 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
#pragma once
#include "common/DifferentialGeometry.ih"
#include "math/random.ih"
#include "render/bsdfs/BSDF.ih"
#include "render/materials/Medium.ih"
#ifdef OSPRAY_ENABLE_VOLUMES
#include "volume/VolumetricModel.ih"
#endif
// c++ shared
#include "PathTracerShared.h"
OSPRAY_BEGIN_ISPC_NAMESPACE
struct World;
struct Light;
enum PathVertexType
{
SURFACE,
VOLUME,
CAMERA,
LIGHT,
ENVIRONMENT
};
struct PathVertex
{
DifferentialGeometry dg;
vec3f wi;
vec3f wo;
vec3f albedo;
// only valid if path vertex is surface vertex
const varying BSDF *bsdf;
#ifdef OSPRAY_ENABLE_VOLUMES
// only valid if path vertex is volume vertex
const VolumetricModel *volume;
#endif
float pdf_w; // the pdf of sampling wo in solid angle measure
PathVertexType type;
uint32 numLightSamples;
};
// constant, typically uniform
struct PathContext
{
vec2f screen; // normalized coords, center of pixel, for backplate sampling
const PathTracer *uniform context;
const World *uniform world;
uniform uint32 numLights;
uniform uint32 numGeoLights;
uniform uint32 numFirstBounceLightSamples;
uniform uint32 numIndirectBounceLightSamples;
Light **uniform lights;
float *uniform lightsCDF;
#ifdef OSPRAY_PATHTRACER_DEBUG
uniform bool disableNEE; // turn off NEE contribution for debugging purposes
uniform bool disableFWD; // turn off FWD contribution for debugging purposes
bool debug;
#endif
};
// changing, typically varying
struct PathState
{
vec3f throughput;
vec3f contribution;
float time;
Medium currentMedium;
float shadowCatcherDist;
bool firstBounceLight;
uint32 scatteringEvents; // counting diffuse and glossy bounces
LDSampler ldSampler;
RandomSampler randomSampler;
bool straightPath; // path from camera did not change direction, for alpha and
// backplate
bool specularTransmissionPath; // path from camera only has specular
// transmissions, for alpha and backplate
uniform uint32 depth;
};
OSPRAY_END_ISPC_NAMESPACE
|