I moved my project to a new directory. Now, when I open the project in Rhino, all my humans in the scene “wear” the same textures.
Details:
All textures for the humans share the same name: Character_diffuse.jpg
But they are in different sub directories.
After moving the directory tree, Rhino apparently settles for the first texture it finds with the name Character_diffuse.jpg. So all human materials get the same texture. Rhino still references the original path of each texture and says where it found the substitute:
With your current file open “SaveAs” but with textures checkbox unchecked. Maybe even check the save small box. Ensure you save to a location under which you do not have the texture files
Remove all folders that end embedded_files related to your original 3dm file
Open the file you saved in step 1.
Use the missing files dialog to point to the correct folder where you have your textures
I am not sure how much of the paths are used to identify images, that is something @andy can say more about. So it still might happen that the same texture is being used after opening the file.
This is probably something you can fix with a Python script whereby you run through all RenderTextures, check their original file paths and then update with the new whereby you take into account as many subfolders that match.
As already indicated, the issue here is that the texture names in 3rd_party_assets/posed_characters/ are the same for each asset, just in different directories.
It would be nice if there was an asset file manager to fix paths in one location. But that’s quite a fundamental feature, and if it isn’t in version 8, then I guess there is no demand for that.
The embedded_files folders are created by extracting the texture files from the 3dm file if any are embedded in it. So as long as you have the files embedded in your 3dm file you can safely remove these. Once you save with the Save Textures checkbox unchecked you need to make sure you have your texture files backed up elsewhere.
Since you get the embedded files folder you have the Save Textures checked. With a bit of testing I noticed that just renaming a folder will already make Rhino load the incorrect textures.
I’m writing a short Python script that could help with this type of relocation.
Btw, I would remove the embedde_files folder before running the script. Rhino overwrites files with the same name. So if you have C:\textures\a\texture.png and C:\textures\b\texture.png (like your character diffuse texture), then in the embedded folders you’ll end up with just one texture.png, say C:\somefile_embedded_files\texture.png.
edit1: logged RH-84265 Only one embedded texture survives when extracting to embedded_files
edit2: logged RH-84266 Missing files resolution doesn’t find correct files
Thank you for explaining that. I understand that the embedded_files directory is indeed a cache. Upon opening a .3dm file with embedded textures, Rhino puts them into embedded_files to work with them.
Only I don’t understand under which circumstances Rhino embeds a texture into the .3dm file and when it just links to a texture in another location. Had Rhino embedded all the textures, the problem should not have happened, or so I think.
On the other hand, you point out that Rhino overwrites textures with the same name. But on my system I find:
Maybe Rhino creates these $-versions upon referencing textures in other locations. It’s all a bit confusing, to be honest. I wish I could just specify that all textures are linked from other locations, and then there would be some kind of resource manager where I can edit the references. (like in the Affinity suite of graphics programs)
I totally don’t like it that Rhino just assumes that the first texture it finds with the same name is the correct one. It should ask for confirmation.
Wow, thank you very much! That’s quite a workaround. I should be able to run that in WSL.
Anyhow, I’m thinking about restructuring the way I use the character assets from my original post. The idea is to manage each character asset in its own 3dm file and _Insert it. That way, at least for my project, the issue with the textures should go away. It also breaks down complexity, and I can test the rendering for each character individually. But still, it’s not smooth, and I’m struggling. Textures, at least, need to have unique names.
The error message means that no files were found at all. Make sure that on line 23 that loc is manually set to the location where your textures are located.
loc = "D:\\path\\to\\textures_2"
And make sure you did not do bulk replace when opening this file.
If you don’t mind doing some extra testing I can add some print-logging to figure out why exactly you get the error.
Anyhow, as mentioned before, I’m rearranging the whole project, replacing all assets with linked blocks. So far that works quite well, but it’s a tedious process, especially as Rhino is very slow here. I should check how I can speed up things a bit. I’m already avoiding highest detail settings where possible. But I’m working with trees in the project, and they are just very detailed.
If it helps others, I’m happy to do that! But, personally, I think I have worked around the issue.
In /Users/jesterKing/Documents/textures_relocated there are <3> files
[PosixPath('/Users/jesterKing/Documents/textures_relocated/3dmfile/TextureFindingTest.3dm'), PosixPath('/Users/jesterKing/Documents/textures_relocated/a/texture.png'), PosixPath('/Users/jesterKing/Documents/textures_relocated/b/texture.png')]
Searching for /Users/jesterking/Documents/3dms/textures/a/texture.png. Files with same name: [PosixPath('/Users/jesterKing/Documents/textures_relocated/a/texture.png'), PosixPath('/Users/jesterKing/Documents/textures_relocated/b/texture.png')]
Match lengths: [2, 1]
Searching for /Users/jesterking/Documents/3dms/textures/b/texture.png. Files with same name: [PosixPath('/Users/jesterKing/Documents/textures_relocated/a/texture.png'), PosixPath('/Users/jesterKing/Documents/textures_relocated/b/texture.png')]
Match lengths: [1, 2]
Command: _Open
Successfully read file "C:\Users\Felix\Syncthing\my_data\software\tools\graphics_and_engineering\McNeel\McNeel_Forum\threads\2024-10-08+08_Textures_not_correctly_assigned_after_move\attachments\2024-10-16_example\scene.3dm"
Creating meshes... Press Esc to cancel
Command: RunPythonScript
In C:\Users\Felix\Syncthing\my_data\software\tools\graphics_and_engineering\McNeel\McNeel_Forum\threads\2024-10-08+08_Textures_not_correctly_assigned_after_move\attachments\2024-10-16_example\textures_2 there are <2> files
==>[WindowsPath('C:/Users/Felix/Syncthing/my_data/software/tools/graphics_and_engineering/McNeel/McNeel_Forum/threads/2024-10-08+08_Textures_not_correctly_assigned_after_move/attachments/2024-10-16_example/textures_2/A/color.jpg'), WindowsPath('C:/Users/Felix/Syncthing/my_data/software/tools/graphics_and_engineering/McNeel/McNeel_Forum/threads/2024-10-08+08_Textures_not_correctly_assigned_after_move/attachments/2024-10-16_example/textures_2/B/color.jpg')]
Searching for C:\Users\Felix\Syncthing\my_data\software\tools\graphics_and_engineering\McNeel\McNeel_Forum\threads\2024-10-08+08_Textures_not_correctly_assigned_after_move\attachments\2024-10-16_example\textures_1\A\color.jpg. Files with same name: [WindowsPath('C:/Users/Felix/Syncthing/my_data/software/tools/graphics_and_engineering/McNeel/McNeel_Forum/threads/2024-10-08+08_Textures_not_correctly_assigned_after_move/attachments/2024-10-16_example/textures_2/A/color.jpg'), WindowsPath('C:/Users/Felix/Syncthing/my_data/software/tools/graphics_and_engineering/McNeel/McNeel_Forum/threads/2024-10-08+08_Textures_not_correctly_assigned_after_move/attachments/2024-10-16_example/textures_2/B/color.jpg')]
Match lengths: [2, 1]
Searching for C:\Users\Felix\Syncthing\my_data\software\tools\graphics_and_engineering\McNeel\McNeel_Forum\threads\2024-10-08+08_Textures_not_correctly_assigned_after_move\attachments\2024-10-16_example\textures_1\B\color.jpg. Files with same name: [WindowsPath('C:/Users/Felix/Syncthing/my_data/software/tools/graphics_and_engineering/McNeel/McNeel_Forum/threads/2024-10-08+08_Textures_not_correctly_assigned_after_move/attachments/2024-10-16_example/textures_2/A/color.jpg'), WindowsPath('C:/Users/Felix/Syncthing/my_data/software/tools/graphics_and_engineering/McNeel/McNeel_Forum/threads/2024-10-08+08_Textures_not_correctly_assigned_after_move/attachments/2024-10-16_example/textures_2/B/color.jpg')]
Match lengths: [1, 2]
I now started rearranging the textures so that all of them are in a single directory in a flat hierarchy. That way, duplicate names are impossible. Just the whole thing takes a lot of time because there is no proper simple asset manager in Rhino.