Skip to content

Commit

Permalink
minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
cuteday committed Dec 3, 2023
1 parent 13eefae commit 69b7176
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 17 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ CMakeSettings.json
temp
tmp
enc_temp_folder
profiler
/common/outputs
/common/configs/test*
/common/assets/textures/local
Expand Down
2 changes: 1 addition & 1 deletion src/core/texture.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class Texture {
}
Image::SharedPtr getImage() const { return mImage; }
RGBA getConstant() const { return mValue; }
std::string getFilemame() const { return mFilename; }
std::string getFilename() const { return mFilename; }
bool hasImage() const { return mImage && mImage->isValid(); }

static Texture::SharedPtr createFromFile(const fs::path &filepath, bool flip = false,
Expand Down
23 changes: 14 additions & 9 deletions src/render/passes/errormeasure/metrics.cu
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,16 @@
#include <thrust/execution_policy.h>

#define METRIC_IN_SRGB 0
#define ERROR_EPS 1e-3f
#define CLAMP_PIXEL_ERROR 0
#define CLAMP_PIXEL_ERROR_THRESHOLD 10.f
#define DISCARD_FIREFLIES 0
#define DISCARD_FIREFLIES_PRECENTAGE 0.0001f
#define DISCARD_FIREFLIES 1


KRR_NAMESPACE_BEGIN

KRR_DEVICE constexpr float ERROR_EPS = 0;
KRR_DEVICE constexpr float CLAMP_PIXEL_ERROR_THRESHOLD = 10;
KRR_DEVICE constexpr float DISCARD_FIREFLIES_PRECENTAGE = 0.0001;

namespace {
TypedBuffer<float> intermediateResult;

Expand Down Expand Up @@ -70,11 +72,14 @@ KRR_CALLABLE float smape(const RGB &y, const RGB &ref) {

// is in fact MRSE...
KRR_CALLABLE float rel_mse(const RGB &y, const RGB &ref) {
return ((y - ref) / (ref + ERROR_EPS)).square().mean();
//RGB ret{}, diff = (y - ref).abs();
//for (int ch = 0; ch < RGB::dim; ch++)
// ret[ch] = ref[ch] == 0.f ? 0.f : pow2(diff[ch] / (ref[ch]));
//return ret.mean();
if constexpr (ERROR_EPS)
return ((y - ref) / (ref + ERROR_EPS)).square().mean();
else {
RGB ret{}, diff = (y - ref).abs();
for (int ch = 0; ch < RGB::dim; ch++)
ret[ch] = ref[ch] == 0.f ? 0.f : pow2(diff[ch] / ref[ch]);
return ret.mean();
}
}

float calc_metric(const CudaRenderTarget & frame, const RGBA *reference,
Expand Down
3 changes: 1 addition & 2 deletions src/render/wavefront/device.cu
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,7 @@ extern "C" __global__ void KRR_RT_RG(Closest)() {
if (getRayId() >= launchParams.currentRayQueue->size()) return;
RayWorkItem r = getRayWorkItem();
SurfaceInteraction intr = {};
traceRay(launchParams.traversable, r.ray, M_FLOAT_INF,
0, OPTIX_RAY_FLAG_NONE, (void*)&intr);
traceRay(launchParams.traversable, r.ray, M_FLOAT_INF, 0, OPTIX_RAY_FLAG_NONE, (void *) &intr);
}

extern "C" __global__ void KRR_RT_AH(Shadow)() {
Expand Down
6 changes: 2 additions & 4 deletions src/render/wavefront/integrator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,10 +229,8 @@ void WavefrontPathTracer::render(RenderContext *context) {
missRayQueue->reset();
shadowRayQueue->reset();
scatterRayQueue->reset();
if (enableMedium) {
mediumSampleQueue->reset();
mediumScatterQueue->reset();
}
if (enableMedium) mediumSampleQueue->reset();
if (enableMedium) mediumScatterQueue->reset();
}, gpContext->cudaStream);
// [STEP#2.1] find closest intersections, filling in scatterRayQueue and hitLightQueue
traceClosest(depth);
Expand Down
2 changes: 1 addition & 1 deletion src/render/wavefront/wavefront.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ KRR_HOST_DEVICE void traceTransmittance(const ShadowRayWorkItem& sr, const Surfa
break;
}
if (ray.medium) {
float tEnd = visible ? tMax : (intr.p - ray.origin).norm() / ray.dir.norm();
float tEnd = visible ? tMax : (intr.p - ray.origin).norm() / ray.dir.norm();
Spectrum T_maj =
sampleT_maj(ray, tEnd, sampler, lambda,
[&](Vector3f p, MediumProperties mp, Spectrum sigma_maj, Spectrum T_maj) {
Expand Down

0 comments on commit 69b7176

Please sign in to comment.