Skip to content

Commit

Permalink
Use analytic spheres, dont set albedo in mirror bsdf
Browse files Browse the repository at this point in the history
  • Loading branch information
rogerbarton committed Dec 17, 2020
1 parent a639052 commit 0dfd8ac
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 17 deletions.
6 changes: 2 additions & 4 deletions include/nori/optix/cuda/raygen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ extern "C" __global__ void __raygen__perspective()
RadiancePrd prd{};
prd.Li = make_float3(0);
prd.throughput = make_float3(1);
prd.albedo = make_float3(0);
prd.albedo = make_float3(-1);
prd.normal = -rayDirection;
prd.terminated = false;
prd.seed = seed;
Expand All @@ -110,10 +110,7 @@ extern "C" __global__ void __raygen__perspective()
&prd);

if (depth == 0)
{
albedo += prd.albedo;
normal += prd.normal;
}

if (prd.terminated)
break;
Expand All @@ -137,6 +134,7 @@ extern "C" __global__ void __raygen__perspective()

// Store Li
color += prd.Li;
albedo += prd.albedo;
}

// PRINT_PIXEL(100, 100, "color (%f, %f, %f), ", color.x, color.y, color.z);
Expand Down
5 changes: 4 additions & 1 deletion include/nori/optix/cuda/shaders/bsdf.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,10 @@ static __forceinline__ __device__ float3 sampleBsdf(
sampledAlbedo = bsdf.diffuse.albedo;
else
sampledAlbedo = make_float3(tex2D<float4>(bsdf.diffuse.albedoTex, uv.x, uv.y));
albedo = sampledAlbedo;

if (albedo.x < 0)
albedo = sampledAlbedo;

return sampledAlbedo;
}
else if (bsdf.type == BsdfData::MIRROR)
Expand Down
2 changes: 1 addition & 1 deletion include/nori/rfilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class ReconstructionFilter : public NoriObject
ImGui::TreeNodeEx("Shape", ImGuiLeafNodeFlags, "Shape");
ImGui::NextColumn();
ImGui::SetNextItemWidth(-1);
touched |= ImGui::DragFloat("##value", &m_radius, 0.1f, 0.f, SLIDER_MAX_FLOAT, "%.3f", ImGuiSliderFlags_AlwaysClamp);
touched |= ImGui::DragFloat("##value", &m_radius, 0.1f, 0.1f, SLIDER_MAX_FLOAT, "%.3f", ImGuiSliderFlags_AlwaysClamp);
ImGui::NextColumn();
ImGui::PopID();
return touched;
Expand Down
22 changes: 11 additions & 11 deletions scenes/pa4/cbox/cbox_path_mis_optix.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<lookat target="0, 0.893051, 4.41198" origin="0, 0.919769, 5.41159" up="0, 1, 0"/>
</transform>

<rfilter type="box"/>
<integer name="height" value="400"/>
<integer name="width" value="400"/>
</camera>
Expand Down Expand Up @@ -57,29 +58,28 @@
</bsdf>
</shape>

<shape type="obj">
<shape type="sphere">
<!-- <shape type="obj">
<string name="filename" value="../../project/meshes/sphere.obj"/>
<transform name="toWorld">
<scale value="0.3, 0.3, 0.3"/>
<translate value="-0.421400 0.332100 -0.280000" />
</transform>
<!-- <point name="center" value="-0.421400 0.332100 -0.280000" />
<float name="radius" value="0.3263" /> -->
</transform> -->
<point name="center" value="-0.421400 0.332100 -0.280000" />
<float name="radius" value="0.3263" />

<bsdf type="mirror"/>
<!-- <bsdf type="diffuse">
<color name="albedo" value="0.2 0.71 0.68"/>
</bsdf> -->
</shape>

<shape type="obj">
<shape type="sphere">
<!-- <shape type="obj">
<string name="filename" value="../../project/meshes/sphere.obj"/>
<transform name="toWorld">
<scale value="0.3, 0.3, 0.3"/>
<translate value="0.445800 0.332100 0.376700" />
</transform>
<!-- <point name="center" value="0.445800 0.332100 0.376700" />
<float name="radius" value="0.3263" /> -->
</transform> -->
<point name="center" value="0.445800 0.332100 0.376700" />
<float name="radius" value="0.3263" />

<!-- <bsdf type="dielectric"/> -->
<bsdf type="diffuse">
Expand Down

0 comments on commit 0dfd8ac

Please sign in to comment.