Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

13/5000 How can I use my images to replace textures #1074

Closed
WHHHHY opened this issue Mar 9, 2024 · 5 comments
Closed

13/5000 How can I use my images to replace textures #1074

WHHHHY opened this issue Mar 9, 2024 · 5 comments
Labels
first answer provided question Question, not yet a bug ;)

Comments

@WHHHHY
Copy link

WHHHHY commented Mar 9, 2024

Describe the issue

I want to use my custom images as backgrounds of linemod.
so I want to know:
How can I use my image to make a texture not material. so that can be assigned directly to a plane like cctextures or like the example where in main_lm_upright.py
Could you give me a demonstration if possible.Thx a lot.

Minimal code example

No response

Files required to run the code

No response

Expected behavior

image

BlenderProc version

2.7

@WHHHHY WHHHHY added the question Question, not yet a bug ;) label Mar 9, 2024
@cornerfarmer
Copy link
Member

Hey @WHHHHY,

you can use bproc.material.create_material_from_texture() to create a material from an image path.
(see https://dlr-rm.github.io/BlenderProc/blenderproc.api.material.html#blenderproc.material.create_material_from_texture)

@WHHHHY
Copy link
Author

WHHHHY commented Mar 11, 2024

Thanks for your rapid answer first,
but when I use "bproc.material.create_material_from_texture()" to creat a material ,I think it first needs to fill a material as "add custom properties",but i don't have any materials,should I make a custom material before i use "bproc.material.create_material_from_texture()" ?
Uploading image.png…

@WHHHHY
Copy link
Author

WHHHHY commented Mar 11, 2024

This is my code and its error.
image
image

@cornerfarmer
Copy link
Member

cornerfarmer commented Mar 12, 2024

bproc.material.create_material_from_texture returns already a Material you dont need to call the constructor on it again

@WHHHHY
Copy link
Author

WHHHHY commented Mar 12, 2024

Oh,I made a stupid and careless mistake.Sorry for that,and thank you for your patience : )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
first answer provided question Question, not yet a bug ;)
Projects
None yet
Development

No branches or pull requests

2 participants