Closed Lemonade24510 closed 2 years ago
Hey,
don't worry about your English, there are good automatic translators out there. You can always use one of those.
But, back to your question. Setting the texture of a material can be done with:
# Collect all jpg images in the specified directory
images = list(Path(args.image_dir).rglob("material_manipulation_sample_texture*.jpg"))
for mat in materials:
# Load one random image
image = bpy.data.images.load(filepath=str(random.choice(images)))
# Set it as base color of the current material
mat.set_principled_shader_value("Base Color", image)
Check out the example: https://dlr-rm.github.io/BlenderProc/examples/basics/material_manipulation/README.html
Best, Max
Thank you. This effect is exactly what I want but: ground_material = bproc.filter.one_by_attr(materials, "name", "") I don't know what to fill in I want to keep random materials,But I don't know: the name of my material at each cycle andI want to load my pictures as soon as PLANE generat e
thankyou As a civil engineering student. There are too many things I don't understand when learning this
nice!i did it! thank you,plane.scale_uv_coordinates is also very useful😊
I will close this then :)
@Lemonade24510 @themasterlink For example in main_itodd_random.py how can i add custom textrue only on the planes? how can i modifiy the following code?
random_cc_texture = np.random.choice(cc_textures) for plane in room_planes: plane.replace_materials(random_cc_texture)
I want to show pictures on the "plane". Do not use cctexture It's equivalent to replacing the ground with a new picture Maybe my English is not very good,It's really a headache/(ㄒoㄒ)/~~