33 #include <cugar/basic/timer.h> 34 #include <cugar/basic/primitives.h> 37 #include <bpt_utils.h> 38 #include <bpt_context.h> 39 #include <bpt_kernels.h> 40 #include <bpt_control.h> 41 #include <bpt_samplers.h> 43 #define SHIFT_RES 256u 45 #define DEBUG_PIXEL (723 + 90*1600) 62 _bpt.m_light_vertices.view(),
63 _bpt.m_queues.view(_renderer.res_x * _renderer.res_y, _bpt.m_n_light_subpaths),
65 sequence(_bpt.m_sequence.view()) {}
87 FERMAT_HOST_DEVICE FERMAT_FORCEINLINE
92 _context.options.single_connection ? VertexOrdering::kRandomOrdering : VertexOrdering::kPathOrdering,
97 FERMAT_HOST_DEVICE FERMAT_FORCEINLINE
98 void visit_eye_vertex(
109 renderer.fb.gbuffer.geo(path_id) = GBufferView::pack_geometry(v.geom.position, v.geom.normal_s);
110 renderer.fb.gbuffer.uv(path_id) = make_float4(v_id.uv.x, v_id.uv.y, v.geom.texture_coords.x, v.geom.texture_coords.y);
111 renderer.fb.gbuffer.tri(path_id) = v_id.prim_id;
122 template <
bool USE_ATOMICS>
132 const uint32 channel,
134 const uint32 light_path_id,
135 const uint32 eye_path_id,
141 const float frame_weight = 1.0f / float(renderer.instance + 1);
145 cugar::atomic_add(&renderer.fb(FBufferDesc::COMPOSITED_C, eye_path_id).x, value.x * frame_weight);
146 cugar::atomic_add(&renderer.fb(FBufferDesc::COMPOSITED_C, eye_path_id).y, value.y * frame_weight);
147 cugar::atomic_add(&renderer.fb(FBufferDesc::COMPOSITED_C, eye_path_id).z, value.z * frame_weight);
149 if (channel != FBufferDesc::COMPOSITED_C)
158 renderer.fb(FBufferDesc::COMPOSITED_C, eye_path_id) += value * frame_weight;
160 if (channel != FBufferDesc::COMPOSITED_C)
161 renderer.fb(channel, eye_path_id) += value * frame_weight;
168 void sink_eye_scattering_event(
171 const uint32 eye_path_id,
178 const float frame_weight = 1.0f / float(renderer.instance + 1);
180 if (component == Bsdf::kDiffuseReflection)
181 renderer.fb(FBufferDesc::DIFFUSE_A, eye_path_id) += value * frame_weight;
182 else if (component == Bsdf::kGlossyReflection)
183 renderer.fb(FBufferDesc::SPECULAR_A, eye_path_id) += value * frame_weight;
208 m_sequence.set_instance(instance);
214 BPTConfig config(context);
221 ConnectionsSink<false> sink;
230 light_primary_coords,
239 ConnectionsSink<true> atomic_sink;
251 const float time = timer.seconds();
254 m_time = (instance == 0) ? time : time + m_time;
256 fprintf(stderr,
"\r %.1fs (%.1fms) ",
Definition: bpt_impl.h:55
void sample_paths(const uint32 n_eye_paths, const uint32 n_light_paths, TEyePrimaryCoordinates eye_primary_coords, TLightPrimaryCoordinates light_primary_coords, TSampleSink sample_sink, TBPTContext &context, const TBPTConfig &config, RenderingContext &renderer, RenderingContextView &renderer_view, const bool lazy_shadows=false)
Definition: bpt_control.h:529
void stop()
stop timing
Definition: timer.cpp:123
void start()
start timing
Definition: timer.cpp:116
CUGAR_FORCEINLINE CUGAR_HOST_DEVICE float atomic_add(float *value, const float op)
Definition: atomics.h:100
ComponentType
Definition: bsdf.h:139
Definition: tiled_sequence.h:53
Definition: bpt_utils.h:583
Definition: bpt_samplers.h:59
Definition: bpt_samplers.h:43
RenderingContextView view(const uint32 instance)
Definition: bpt_context.h:54
void light_tracing(const uint32 n_light_paths, TSampleSink sample_sink, TBPTContext &context, const TBPTConfig &config, RenderingContext &renderer, RenderingContextView &renderer_view)
Definition: bpt_control.h:576
Definition: bpt_kernels.h:216
Definition: renderer.h:52
void render(const uint32 instance, RenderingContext &renderer)
[BPT::render]
Definition: bpt_impl.h:196
Definition: bpt_kernels.h:56
void multiply_frame(const float scale)
Definition: renderer_view.h:80