phanerozoic's picture
v3: geometry gradients (dual-number interior + shadow and camera silhouette edge sampling)
1f9a369 verified
Raw
History Blame
1.57 kB
// 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"