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

Python script attempting to load associated bump map with the loaded textures #822

Open
monorio1 opened this issue Nov 11, 2024 · 0 comments
Labels
enhancement Запрос нового функционала

Comments

@monorio1
Copy link

monorio1 commented Nov 11, 2024

Описание идеи:

I wrote a blender python script that attempts to locate the bump map of the same name as the loaded texture. It then links the texture if found and adds the necessary material nodes to plug in the normal map as well as link to the specular input of materials. As a result we get a pseudo preview of the normal map and specular of the material.

Примеры использования:

The script was done through ChatGPT with various prompts.
The logic goes like this:
1-For every object of type mesh, it runs through the list of materials in a parallel execution (for speed)
2- It looks to the already existing and plugged in Base texture for its path and information.
3- It attempts in 3 ways as fallbacks to find the associated Bump map.

  1. Replaces '_diff' with '_bump' in the image path.
  2. Appends '_bump' to the original path if it's not already there.
  3. Cuts off the last part of the filename after the last "_" before the extension, and adds "_bump".

4- If it finds the bump, plugs it in the necessary node combination to display specular and normal map.
5-Set the color management of the bump file to Raw to avoid running a gamma operation on vector data from the normal.
The end result:
image

image
It also works for guns and other models
No bump
image
vs
with bump
image

The script itself
AutoloadBumpMap_V4_ ForLevels.zip

@monorio1 monorio1 added the enhancement Запрос нового функционала label Nov 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Запрос нового функционала
Projects
None yet
Development

No branches or pull requests

1 participant