-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNewBidirectionalPathTracer.h
62 lines (48 loc) · 1.33 KB
/
NewBidirectionalPathTracer.h
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
#pragma once
#include "mcrenderer.h"
#include <omp.h>
#include "macros.h"
struct BidirPathState
{
vec3f origin , pos;
vec3f dir;
vec3f throughput;
BSDF bsdf;
float dVCM , dVC;
int pathLength : 15;
int specularVertexNum : 15;
int specularPath : 1;
int isFiniteLight : 1;
};
class NewBidirectionalPathTracer : public MCRenderer
{
protected:
unsigned spp;
bool usePT;
void genLightSample(Path& lightPath , BidirPathState& lightState);
vec3f colorByConnectingCamera(const Camera& camera, const BidirPathState& lightState , const Ray& ray , const Ray& lastRay , int& _x , int& _y);
void genCameraSample(const Camera& camera , Path& cameraPath , BidirPathState& cameraState);
vec3f colorByHittingLight();
public:
int controlLength;
int lightPathNum , cameraPathNum , pixelNum;
int iterations;
std::vector<BidirPathState> lightStates;
std::vector<BidirPathState> cameraStates;
std::vector<int> lightStateIndex;
std::vector<int> cameraStateIndex;
unsigned timeInterval , lastTime;
NewBidirectionalPathTracer(Renderer* renderer) : MCRenderer(renderer)
{
pixelNum = renderer->camera.height * renderer->camera.width;
lightPathNum = cameraPathNum = pixelNum;
spp = -1;
usePT = false;
lastTime = timeInterval = 3600;
}
virtual vector<vec3f> renderPixels(const Camera& camera);
float mis(const float& w)
{
return w;
}
};