haosulab / ManiSkill

SAPIEN Manipulation Skill Framework, a GPU parallelized robotics simulator and benchmark
https://maniskill.readthedocs.io/en/latest/
Apache License 2.0
561 stars 97 forks source link

How to define a new material? #397

Closed DevinQiao closed 5 days ago

DevinQiao commented 1 week ago

I used the following code to define a new material in Mani-Skill2 before:

renderer = sapien.SapienRenderer()
material = renderer.create_material()
material.set_diffuse_texture_from_file(wall['material_path'])

But in maniskill3, it seems that the "set_diffuse_texture_from_file" is deleted. I find that all functions like "set**from_file" is deleted in sapien3's RenderMaterial class.

StoneT2000 commented 1 week ago

You can set them like python properties now usually

from sapien.render import RenderMaterial, RenderTexture2D
material = RenderMaterial()
material.diffuse_texture = RenderTexture2D(wall['material_path'])

renderer.create_material is no longer recommended to be used as well. Just create the RenderMaterial object directly.

If you have typehints you can check what you can set.