Jump to content

SPETI and TINA


dast

Recommended Posts

Edit 2017: Renamed topic from "Substance Painter Exported Texture Importer (SPETI)" to "SPETI and TINA"
The original post was made for Substance Painter textures, but as it applies to any kind textures the plugin has been split off into 2 "versions", read more here -obsolete link deleted-
 

Original message below and on next pages will still refer to Substance Painter.
<end edit>

 

Working with Substance Painter for texture creation I found it a waste of time to manually create each material from the numerous exported textures. Looking at the main character for my short story I had to import 18 texture sets (each 6 bitmap files). Knowing that many more objects had to be textured in the future, I soon started to look how to automate this material creation.

For this I looked into scripting, and soon decided to make a plugin, which I could have named "Substance Painter Artistically Generated Exported Texture Importer". But went for the simpler  "Substance Painter Exported Texture Importer" instead, SPETI for short.

 

572c915501aee_SPETIAssignTab.thumb.png.c1122436eb9d9d185b5e1adee687722b.png

 

The main purpose of this plugin is thus to create materials from scratch, using the generated textures from Substance Painter as input. Or, in my case, to update the already prepared materials (having only the color channel activated).

Since development has only been started, many more features have to be implemented. One of which is the configuration panel were users setup how the Substance Painter textures are to be mapped. Currently, the configuration is very basic, and matches with my workflow.

 

More detailed explanations soon to come.

 

Enjoy!

 

Latest version v1.2 runs on R17 - R23 ... available in the download section.

 

 

Link to comment

How to use the plugin:

The plugin consists of 3 tabs: Assign, Config, Log.

The Log tab:
is pure informational, and has only been added in order to avoid to have the console window open next to the plugin. SPETI will thus only print out info/warning/error into this Log window. The console window will then only show python errors due to my dumb programming mistakes. So, for regular users: you can keep the console window closed ;-)

The Configuration tab:
is currently still very much work in progress and hence only has very basic settings available. Here you specify which texture set images from Substance Painter are to be used, and also specify the file name convention for these images. Usually you would only need to open this panel once to set things up, and you're done.
However, since the whole plugin is early WIP it still doesn't do any persistent storage of user settings. This means it doesn't remember your settings, and reverts to the hardcoded settings next time you activate the plugin. (Will be handled in future version)

The Assign tab:
is where all the action happens.
First thing you do is specify the path where Substance Painter has exported the different texture set images. In my workflow I only need a single path for all texture sets, but if need be to provide sub-folders per texture set or material, this might be handled in future version.

Once a valid path is entered, the status shows how many files are available in that path, and depending your configuration settings will show how many texture sets this represents (1 texture set represents 7 images: basecolor, ambient occlusion, normal, roughness, metallic, height, ior).

Next is how to create/update the material.
There are 3 workflows I assumed would be useful to me. Again, if users require others it might be added in future version.
1. Work from the image files generated by Substance Painter. As mentioned, 7 images form a texture set (can be more or less, depending your workflow). Each texture set will result in a C4D material. The plugin will collect the available images per texture set and create the different C4D materials from that.
The assignment of material to the appropriate object(s) is currently not implemented yet (will be handled in future version)

2. Work from existing C4D material (my default workflow). In my case the material is created as a simple color place holder, and is already assigned to the object(s). Selecting this mode will update the material matching the texture set name. No new material is created, and since material is already assigned to object(s) no assignment is needed.

3. Work from UVW Tag names. In my case I combine different objects to share the same UV texture space. By doing so, I give the UVW Tags that share the same space also the same name. This will end up to be the texture set in Substance Painter. The purpose of this mode is to create the materials for each UVW Tag. Assignment of the material to the object(s) is yet to be implemented.

The options:
are greyed out for now.
If a material with matching name exists, it will be use, else a new material with that name will be created.
As mentioned, assignment of materials is future development.

The list:
represents the items, depending the choice of workflow (from file, from material, from uvw tag).
In case of "by file name" the list will show the detected texture sets in the given path. It shows a list of C4D material names in case "by material name" is selected. And when "by uvw tag" is selected it displays a list of uvw tag names. Each entry in the list can be select/deselected (use short cuts "all" and "none").
The plugin doesn't detect changes automatically. So if you modify the path or files, add/remove/rename materials or UVW tags, you will want to press the "Rescan" button to update the list to the latest items.

The Import button:
will process each selected item in the list and create/update the material with given name.

 

Link to comment
  • 2 weeks later...

The plugin has been downloaded many times, but no one complained about the bugs. This can only mean two things:
1. no one is actually using the plugin
2. the current state is already quite useful to whom downloaded it.


Anyway, in this next version I have made the settings persistent. This allows users to now edit the config settings, and plugin will remember these next time it is opened.

I also forgot to mention in the original post that the plugin currently only supports bmp files, other formats will be supported in future. I more than once noticed that loading a 16bit png file from Substance Painter made Cinema4D unresponsive, hence the reason I opted for 8bit bmp support only (for a start).

Processing of the exported Substance Painter textures are slightly different in this version, as I noticed something was wrong with some of the results obtained with the original version.

Next I will start working on the configuration settings tab. Currently all control of mapping and processing is "black-boxed" in the plugin. Hardcoded.
Via the configuration settings the user will thus be allowed to alter or fine tune how the mapping is to be done. Plus, allowing to define presets, and use different presets per textures set to be applied.

Still R17 only (reason for this is that access to the reflectance channel via python is only available from R17 on)

< removed obsolete file >

 

Link to comment

Hello Daniel,

 sorry for late post at first. As owner SP didn´t play with it too much because of old graphic card drivers and in some cases SP crash or not responding. Will be ready for production for me with new PC (hope in few weeks)...

So, I was done some tests of importing texture sets into c4d materials, looks fine but there´s some issue with loading. Don´t know if my mistake or something with admin rights or what, but after import are textures loaded into new c4d materials, but system say "Windows System Error...System cann´t find this file" and I can see only black materials...But when I load textures manually, files are loaded without problems and works as expected...

Must be loaded also geometry? (I mean object for assigning materials).Can be this problem? I was only tried to import textures sets from Hans example file from SP without geometry...

As you can see in pictures, folder with textures is "real" and manually loaded texture is allready from that folder...

1.png2.png3.png

 

Link to comment

Aah, found it...sorry...Looks like for  SP1.5 was changed suffix names and changing it in Config tab resolve this problem.

For example for color channel was defined "_BaseColor" but SP export texture with suffix "_Base_Color"

Textures for _AO and _Ior wasn´t loaded because simply didn´t exists in import folder. Unchecking this channels in Config tab solve also this problem...

...clever plugin...:smiley-computer005:

 

So, all is fine, maybe little idea/suggestion for plugin...

When plugin check import folder, will be nice to have in Config tab automatically enable only existing files (this maybe solve error message with non existing files) and user can simply check all kinds of textures import folder contains...

...plus "Clear log file" will be fine :-)

Link to comment

Hi bezo,

Thanks for your feedback.
I am using Substance Painter 1.7.3 on a laptop which uses a nVidia 920 mobile GPU. The drivers are extremely outdated, but those are the only officially supported by the laptop. Substance Painter mentions the outdated driver in it's log but any newer driver will crash my laptop when using Cinema 4D. Anyway, the old drivers and 1.7.3 work OK.

I have created my own export settings in Substance Painter, and the Configuration Tab in SPETI is provided to match these.

So, as a user you once need to set up the configuration for your own workflow, and then you should be good to go. I had provided my own settings as default, and might indeed not have followed the original name settings and inadvertently changed _Base_Color into _BaseColor.

Your suggestion to provide a way to clear the logfile in SPETI is on my todo list. My intention was to eventually implement this when time allows, but user request will increase it's priority. So, I'll try to get it available for next version.

Your other suggestion, however, I have to disagree.
The configuration tab is meant to be set up for your workflow, and it thus should not be automatically adjusted behind your back depending on what files are found in the provided path. This would contradict the whole purpose of the configuration.
Showing a mismatch between found files in the provided path and current configuration is on my todo list, but this will only be a visual aid to help before the user presses the "import" button.. There will be no automatic update of the configuration, as what has been set up is what the user expects to obtain.
Currently any mismatch is only shown in the log tab after the import button was pressed.

Thanks again for your feedback, as it helps me to understand how to enhance the plugin for others to use.

 

Link to comment
  • 4 weeks later...

While working on the 0.3 version I realized my current vision to allow for different workflows was wrong. I dropped this 0.3 version and changed the whole concept. Although the new version has a completely different look, it still contains the main ideas of the original one, but better integrated into a single workflow. While so many things have been added it could almost be seen as being close to final release, and might be called a 0.98 version. But since it got numbered 0.4 when I started that's how it will be named.

The main window of the plugin still contains an Assign and Configuration tab. Their purpose has not changed since previous versions.

The main difference with previous versions is that the list of texturesets can now display more information. The textureset can be expanded to show the different image files associated to the textureset. A colored bar in front of the image name indicates the status of the image in relation to the chosen preset (see Config tab).

A green bar indicates the image file is available in the provided path, while red indicates the image file is required but missing. A yellow bar indicates the file is present but not required by the selected preset.
At right of the textureset name a yellow rectangle with question mark does indicate that there is no matching material currently present in the scene. A new material will be created when you press the Import button. If no such yellow rectangle is displayed, this means a matching material is already available, and it will be re-used and updated when importing the textures.

Next, the preset name is used which will be used to map the different image files into the different material channels (see Config tab). The preset can be selected "globally" for all texturesets, or it an be selected individually per textureset (right mouse click on the individual preset name, see third image). By default a single preset is provided (named Default). Users can create their own preset (see Config tab).

Right of the preset name a red rectangle with exclamation mark indicates that image files are missing, depending the chosen preset.

I'll provide Config tab explanation later.

Assign Tab 1.pngAssign Tab 2.pngAssign Tab 3.png

 

< removed obsolete file >

 

Link to comment
  • 2 weeks later...

No further development yet as now I am actually USING the plugin.

How better to demonstrate by a simple render.
Left is the untextured object, and right the same scene with textures created in Substance Painter and imported via SPETI. (ground and sky are "basic" C4D materials)

untextured vs substancepainter.jpg

 

Link to comment
  • 1 month later...
1 hour ago, vinhwalter said:

Thanks C4DS, SPETI works like charm.

 

You're welcome.

No further development yet, as most features I needed are implemented. Next on the list is the ability to select the input image format. Currently only bmp supported (I encountered some Cinema 4D crashes trying to import png's from Substance Painter, and thus focused on one format that did work).

I am sure custom channels will be needed in future, so I am running this idea in the back of my head.
I am also wanting to replace the warning and error icons (simple colored boxes with question/exclamation mark) with more meaningful icons.


 

Link to comment
×
×
  • Create New...

Copyright Core 4D © 2023 Powered by Invision Community