diff --git a/python/raytracing/inside_viewer.py b/python/raytracing/inside_viewer.py index e6670f49..9ab779f0 100644 --- a/python/raytracing/inside_viewer.py +++ b/python/raytracing/inside_viewer.py @@ -420,7 +420,7 @@ def create_skeleton_frame(self, parent): UniformDictController.create_horizontal_scale( frame, - self.widget.ui_uniform_dict, + self.widget.ui_parameter_dict, key='edgeThickness', title='Face boundary thickness', row=row, @@ -440,7 +440,7 @@ def create_skeleton_frame(self, parent): left_end=0.0, right_end=1.25, update_function=self.widget.recompute_raytracing_data_and_redraw, - format_string='%.2f')) + format_string='%.3f')) row += 1 self.edgeTubeRadiusController = ( @@ -452,7 +452,8 @@ def create_skeleton_frame(self, parent): row=row, left_end=0.0, right_end=0.2, - update_function=self.widget.redraw_if_initialized)) + update_function=self.widget.redraw_if_initialized, + format_string='%.3f')) row += 1 label = ttk.Label(frame, text="Edge colors", padding=gui_utilities.label_pad) diff --git a/python/raytracing/raytracing_view.py b/python/raytracing/raytracing_view.py index ef535ccf..73b3caed 100644 --- a/python/raytracing/raytracing_view.py +++ b/python/raytracing/raytracing_view.py @@ -102,7 +102,6 @@ def __init__(self, 'maxSteps' : ['int', 99 if has_weights else 40], 'maxDist' : ['float', 6.5 if has_weights else 17.0], 'subpixelCount': ['int', 1], - 'edgeThickness' : ['float', 0.0000001], 'contrast' : ['float', 0.1 if has_weights else 0.5], 'noGradient' : ['bool', False], @@ -121,6 +120,7 @@ def __init__(self, self.ui_parameter_dict = { 'insphere_scale' : ['float', 0.0 ], 'cuspAreas' : ['float[]', manifold.num_cusps() * [ 0.0 if has_weights else 1.0 ]], + 'edgeThickness' : ['float', 0.0], 'edgeTubeRadius' : ['float', 0.0 if has_weights else (0.025 if trig_type == 'finite' else 0.0)], 'vertexRadius' : ['float', 0.0 if has_weights else 0.25], @@ -194,6 +194,8 @@ def get_uniform_bindings(self, width, height): 'viewMode' : ('int', self.view), 'edgeTubeRadiusParam' : ('float', math.cosh(self.ui_parameter_dict['edgeTubeRadius'][1]) ** 2 / 2.0), + 'edgeThicknessParam' : + ('float', math.sinh(self.ui_parameter_dict['edgeThickness'][1]) ** 2), 'vertexSphereRadiusParam' : ('float', math.cosh(self.ui_parameter_dict['vertexRadius'][1]) ** 2) }, diff --git a/python/raytracing/shaders/fragment.glsl b/python/raytracing/shaders/fragment.glsl index 70b38b5d..bb08db9f 100644 --- a/python/raytracing/shaders/fragment.glsl +++ b/python/raytracing/shaders/fragment.glsl @@ -35,7 +35,7 @@ uniform float currentWeight; uniform int maxSteps; uniform float maxDist; uniform int subpixelCount; -uniform float edgeThickness; +uniform float edgeThicknessParam; uniform float contrast; const int perspectiveTypeMaterial = 0; @@ -1034,11 +1034,11 @@ ray_trace_through_hyperboloid_tet(inout RayHit ray_hit) ray_hit.dist += atanh(smallest_p); advanceRayByDistParam(ray_hit.ray, smallest_p); - if(edgeThickness > 0.00001) { + if(edgeThicknessParam > 0.00001) { if (ray_hit.object_type == object_type_face) { if (!traceInsideVertexNeighborhood() || smallest_p > horosphere_exit_param) { - if(triangleBdryParam(ray_hit.ray.point, ray_hit.tet_num, ray_hit.object_index) < edgeThickness) { + if(triangleBdryParam(ray_hit.ray.point, ray_hit.tet_num, ray_hit.object_index) < edgeThicknessParam) { ray_hit.object_type = object_type_edge_fan; } }