File size: 1,568 Bytes
1f9a369
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
// Launch interface for the geometry-gradient kernels (direct lighting):
// interior term under detached sampling plus edge-sampled shadow and
// primary (camera) silhouette boundary terms. Torch-free.
#pragma once

#include <cuda_runtime_api.h>

#include "pathtracer_launch.h"

extern "C" {

// Interior term: d(direct image)/d(vertex positions), sampling detached.
// face_verts: [F, 3] int32 vertex ids aligned with the (BVH-reordered)
// face arrays. grad_verts: [V, 3] accumulated via atomics.
void ptd_geo_interior_launch(const PtdSceneArgs* args, const int* face_verts,
                             const float* cam, int H, int W, int spp,
                             long long seed, const float* grad_image,
                             float* grad_verts, cudaStream_t stream);

// Boundary terms: shadow silhouettes and primary (camera) silhouettes of
// the direct-light integrand, one kernel launch each. edges: [E, 4] int32
// = (corner_a, corner_b, face_a, face_b), corners indexing into face_a,
// face_b = -1 for border edges. edge_cdf: [E + 1] with the total edge
// length in the last slot. n_samples edge samples per kernel.
void ptd_geo_boundary_launch(const PtdSceneArgs* args, const int* face_verts,
                             const int* edges, int n_edges,
                             const float* edge_cdf, const float* cam, int H,
                             int W, int n_samples, long long seed,
                             const float* grad_image, float* grad_verts,
                             cudaStream_t stream);

}  // extern "C"