Commit 7181c324 authored by Johannes Braun's avatar Johannes Braun
Browse files

Added LS bias setting.

parent c78704fe
......@@ -9,7 +9,7 @@ Size=302,900
Collapsed=0
[Settings]
Pos=946,3
Pos=1146,2
Size=295,531
Collapsed=0
......@@ -19,7 +19,7 @@ Size=172,86
Collapsed=0
[System]
Pos=942,504
Pos=1139,527
Size=295,368
Collapsed=0
......
<linespace version="1.0">
<item name="subdivisions" value="8"/>
<item name="grid-subdivisions" value="5"/>
<item name="subdivisions" value="20"/>
<item name="grid-subdivisions" value="3"/>
<item name="radial-subdivision" value="50"/>
<item name="generator" value="gpu"/>
</linespace>
......@@ -6,6 +6,8 @@
#include <util/tracing/linespace.glsl>
#include <util/tracing/tracing.glsl>
uniform float linespace_bias = 0.08f;
uint configurationID(uint in_face, uint out_face)
{
return uint((((-0.5f * float(in_face)) + 4.5f)*float(in_face))) - 1u + out_face;
......@@ -138,7 +140,7 @@ bool traverseLineSpace(const in Mesh mesh, int index, const in Ray local_ray, co
if (mesh.grid_linespace.linespaces[index].line_count == 0) return false;
Ray loc = local_ray;
loc.origin += 0.08f * loc.direction;
loc.origin += linespace_bias * loc.direction;
if(!loc.intersectsBounds(mesh.grid_linespace.linespaces[index].bounds, tmin, tmax, face_tmin, face_tmax) || t_min <= tmin || tmin > max_distance)
{
......
......@@ -619,6 +619,9 @@ void drawSettingsWindow()
break;
case 2:
{
if (float bs = pathtracer->getLinespaceBias(); ImGui::DragFloat("Bias", &bs, 0.0001f, 0.0f, 1.f))
pathtracer->setLinespaceBias(bs);
ImGui::Title("PDF Thresholds");
ImGui::TextWrapped("The following threshold values will determine as of which accumulated PDF value the Line Space should be used instead of the BVH.");
{
......
......@@ -65,7 +65,7 @@ namespace glare::raytrace
{
m_samples_current = 0;
m_collector->apply(*m_render_shader, "scene");
/* m_collector->apply(*m_render_shader, "scene");
m_render_shader->uniform("bounce_count", m_bounce_count);
m_render_shader->uniform("clamp_direct", m_clamp_direct);
......@@ -85,7 +85,7 @@ namespace glare::raytrace
m_render_shader->bindSubroutine(gl::ShaderType::eCompute, "sampleLightRoutines[0]", "samplePoint");
m_render_shader->bindSubroutine(gl::ShaderType::eCompute, "sampleLightRoutines[1]", "sampleSpot");
m_render_shader->bindSubroutine(gl::ShaderType::eCompute, "sampleLightRoutines[2]", "sampleDirectional");
m_render_shader->bindSubroutine(gl::ShaderType::eCompute, "sampleLightRoutines[3]", "sampleAmbient");
m_render_shader->bindSubroutine(gl::ShaderType::eCompute, "sampleLightRoutines[3]", "sampleAmbient");*/
}
const core::Texture &Pathtracer::render(unsigned width, unsigned height)
......@@ -125,6 +125,7 @@ namespace glare::raytrace
m_render_shader->uniform("linespace_accuracy", m_linespace_accuracy);
m_render_shader->uniform("linespace_shadow", m_linespace_shadow);
m_render_shader->uniform("linespace_distance", m_linespace_distance);
m_render_shader->uniform("linespace_bias", m_linespace_bias);
}
for (int sample = 0; sample < m_samples_per_frame; sample++) {
......
......@@ -61,6 +61,7 @@ namespace glare::raytrace
void setLinespaceShadow(float shadow) { m_linespace_shadow = shadow; reset(); }
void setLinespaceDistance(float distance) { m_linespace_distance = distance; reset(); }
void setLinespaceBounces(Effect effect, int count) { m_linespace_bounces[effect] = count; reset(); }
void setLinespaceBias(float bias) { m_linespace_bias = bias; reset(); }
void setSamplesMax(unsigned max) { m_samples_max = max; }
void setSamplesPerFrame(unsigned spframe) { m_samples_per_frame = spframe; }
void setRayGenerator(RayGenType generator) { m_ray_generator = generator; reset(); }
......@@ -73,6 +74,7 @@ namespace glare::raytrace
float getLinespaceShadow() const { return m_linespace_shadow; }
float getLinespaceDistance() const { return m_linespace_distance; }
uint8_t getLinespaceBounces(Effect effect) const { return m_linespace_bounces[effect]; }
float getLinespaceBias() const { return m_linespace_bias; }
unsigned getSamplesMax() const { return m_samples_max; }
unsigned getSamplesPerFrame() const { return m_samples_per_frame; }
unsigned getSamplesCurrent() const { return m_samples_current; }
......@@ -110,6 +112,7 @@ namespace glare::raytrace
float m_linespace_shadow = 0.5f;
float m_linespace_distance = 10.f;
EffectArray m_linespace_bounces = { 3, 3, 3, 1 };
float m_linespace_bias = 0.08f;
int m_samples_current = 0;
int m_samples_max = 80'000;
int m_samples_per_frame = 1;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment