diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ddfe1ad..c425d10 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -72,8 +72,9 @@ jobs: BLENDER_PYTHON=$(find blender/ -regextype posix-extended -regex '.*bin\/python(.exe|[0-9].[0-9]{1,2}m?)' -print -quit) echo "Blender Python is $BLENDER_PYTHON" SITE_PACKAGES=$(./$BLENDER_PYTHON -c "import site; print(site.getsitepackages()[0])") + echo "Blender Python site-packages location is $SITE_PACKAGES" ./$BLENDER_PYTHON -m ensurepip - ./$BLENDER_PYTHON -m pip install -U pip --target=$SITE_PACKAGES + ./$BLENDER_PYTHON -m pip install -U pip ./$BLENDER_PYTHON -m pip install --upgrade pytest pytest-cov --target=$SITE_PACKAGES ./$BLENDER_PYTHON -m pip install mitsuba==${{ matrix.environment.mitsuba-version }} --force-reinstall --target=$SITE_PACKAGES diff --git a/mitsuba-blender/io/exporter/materials.py b/mitsuba-blender/io/exporter/materials.py index 11a5ca2..bf589b0 100644 --- a/mitsuba-blender/io/exporter/materials.py +++ b/mitsuba-blender/io/exporter/materials.py @@ -32,7 +32,11 @@ def convert_float_texture_node(export_ctx, socket): raise NotImplementedError( "Node type %s is not supported. Only texture nodes are supported for float inputs" % node.type) else: - params = socket.default_value + #roughness values in blender are remapped with a square root + if 'Roughness' in socket.name: + params = pow(socket.default_value, 2) + else: + params = socket.default_value return params @@ -100,11 +104,6 @@ def convert_glossy_materials_cycles(export_ctx, current_node): roughness = convert_float_texture_node(export_ctx, current_node.inputs['Roughness']) - # Re-mapping to space in Mitsuba - # TODO: Handle when roughness is texture - if type(roughness) is float: - roughness = pow(roughness, 2) - if roughness and current_node.distribution != 'SHARP': params.update({ 'type': 'roughconductor', @@ -136,11 +135,6 @@ def convert_glass_materials_cycles(export_ctx, current_node): roughness = convert_float_texture_node(export_ctx, current_node.inputs['Roughness']) - # Re-mapping to space in Mitsuba - # TODO: Handle when roughness is texture - if type(roughness) is float: - roughness = pow(roughness, 2) - if roughness and current_node.distribution != 'SHARP': params.update({ 'type': 'roughdielectric', @@ -279,13 +273,6 @@ def convert_principled_materials_cycles(export_ctx, current_node): clearcoat = convert_float_texture_node(export_ctx, current_node.inputs['Clearcoat']) clearcoat_roughness = convert_float_texture_node(export_ctx, current_node.inputs['Clearcoat Roughness']) - # Re-mapping to space in Mitsuba - # TODO: Handle when roughness is texture - if type(roughness) is float: - roughness = pow(roughness, 2) - if type(clearcoat_roughness) is float: - clearcoat_roughness = pow(clearcoat_roughness, 2) - params.update({ 'type': 'principled', 'base_color': base_color, diff --git a/mitsuba-blender/io/importer/renderer.py b/mitsuba-blender/io/importer/renderer.py index faa1909..ffa0c87 100644 --- a/mitsuba-blender/io/importer/renderer.py +++ b/mitsuba-blender/io/importer/renderer.py @@ -190,7 +190,7 @@ def apply_mi_independent_properties(mi_context, mi_props): bl_independent_props.sample_count = mi_props.get('sample_count', 4) bl_independent_props.seed = mi_props.get('seed', 0) # Cycles properties - bl_renderer.sampling_pattern = 'SOBOL' + bl_renderer.sampling_pattern = 'SOBOL' if bpy.app.version < (3, 5, 0) else 'SOBOL_BURLEY' bl_renderer.samples = mi_props.get('sample_count', 4) bl_renderer.preview_samples = mi_props.get('sample_count', 4) bl_renderer.seed = mi_props.get('seed', 0) @@ -210,7 +210,7 @@ def apply_mi_stratified_properties(mi_context, mi_props): bl_stratified_props.jitter = mi_props.get('jitter', True) # Cycles properties # NOTE: There isn't any equivalent sampler in Blender. We use the default Sobol pattern. - bl_renderer.sampling_pattern = 'SOBOL' + bl_renderer.sampling_pattern = 'SOBOL' if bpy.app.version < (3, 5, 0) else 'SOBOL_BURLEY' bl_renderer.samples = mi_props.get('sample_count', 4) bl_renderer.seed = mi_props.get('seed', 0) return True @@ -228,7 +228,12 @@ def apply_mi_multijitter_properties(mi_context, mi_props): bl_multijitter_props.seed = mi_props.get('seed', 0) bl_multijitter_props.jitter = mi_props.get('jitter', True) # Cycles properties - bl_renderer.sampling_pattern = 'CORRELATED_MUTI_JITTER' if bpy.app.version < (3, 0, 0) else 'PROGRESSIVE_MULTI_JITTER' + if bpy.app.version < (3, 0, 0): + bl_renderer.sampling_pattern = 'CORRELATED_MUTI_JITTER' + elif bpy.app.version < (3, 5, 0): + bl_renderer.sampling_pattern = 'PROGRESSIVE_MULTI_JITTER' + else: + bl_renderer.sampling_pattern = 'TABULATED_SOBOL' bl_renderer.samples = mi_props.get('sample_count', 4) bl_renderer.seed = mi_props.get('seed', 0) return True