Skip to content

Roughness values from Blender need to be square rooted before being pulled in to Mitsuba #122

@AnsonSavage

Description

@AnsonSavage

Summary:

Image

This is what a scene looks like in Cycles:

Image

I export the XML and render in Mitsuba and get:

Image

It seemed a lot more rough. I tried square rooting each of the roughness values:

import mitsuba as mi
import math

# Set the Mitsuba variant for autodiff if needed
mi.set_variant('cuda_ad_rgb')

# 1. Load the Scene from an XML File
# scene = mi.load_file('scenes/geometry_no_emitters.xml')
scene = mi.load_file('scenes/geometry.xml')


scene_params['elm__3.bsdf.brdf_0.roughness.value'] = math.sqrt(float(scene_params['elm__3.bsdf.brdf_0.roughness.value'].numpy()[0]))
scene_params['elm__5.bsdf.brdf_0.roughness.value'] = math.sqrt(float(scene_params['elm__5.bsdf.brdf_0.roughness.value'].numpy()[0]))
scene_params['elm__7.bsdf.brdf_0.roughness.value'] = math.sqrt(float(scene_params['elm__7.bsdf.brdf_0.roughness.value'].numpy()[0]))
scene_params['elm__9.bsdf.brdf_0.roughness.value'] = math.sqrt(float(scene_params['elm__9.bsdf.brdf_0.roughness.value'].numpy()[0]))
scene_params.update()

image = mi.render(scene, spp=1024)

# Save the rendered image to a file
mi.util.write_bitmap('rendered_scene.png', image)

And then I get this, which seems to match Cycles pretty well:

Image

So, should the roughness values from Blender simply be square rooted by default?

Environment (please complete the following information):

  • OS: Windows 11
  • Blender Version: 3.6.20
  • Add-on Version: 0.4.0 (latest)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions