is there a script to automatic apply alpha images?

Forum for OctaneRender Lua scripting examples, discussion and support.
Post Reply
Liewec123
Posts: 4
Joined: Wed Aug 05, 2015 1:22 pm

ahoy folks!

nooby here seeking some help from you scripting pros! :)

I use the program "XNALara" to make my scenes and then export them as .OBJs to Octane render, the program applies all of the diffuse textures just fine, but it seems that i need to manually apply the alpha images.

the alpha image is always the same file as the diffuse texture,

so my question is, would it be possible to script it so that when it applies the diffuse textures it automatically sets the same file as an alpha image too?

some of the characters have 20+ different hair sections so manually trying to pick the alpha image for all of them is a real drag!

thanks for any help you can give! :D
User avatar
bepeg4d
Octane Guru
Posts: 10326
Joined: Wed Jun 02, 2010 6:02 am
Location: Italy
Contact:

Hi, yes sure, it's possible. I have a script that creates an Arroway material by choosing only the diffuse texture, the bump and the roughness texture are derived by the suffix :
Image
if you give me a couple of texture, I can try to adapt it based on the naming of your textures ;)
ciao beppe
Liewec123
Posts: 4
Joined: Wed Aug 05, 2015 1:22 pm

thanks for the reply! :)

unfortunately the file names vary from model to model (including the suffixes)
for example one hair diffuse texture (with the alpha channel within) might simply be called "hair.png" while another might be called "Hair_diffuse.png" or "Hair_d.png"

i could really do with something that goes through every model and copies whatever the diffuse image to opacity as an "alpha image"
though i'm not sure if that is doable, i'm very noobish when it comes to scripts sorry XD
Liewec123
Posts: 4
Joined: Wed Aug 05, 2015 1:22 pm

double post sorry! :?
User avatar
bepeg4d
Octane Guru
Posts: 10326
Joined: Wed Jun 02, 2010 6:02 am
Location: Italy
Contact:

Hi,
ok, here is an old script that I have made for automatic creation of a mix material between a diffuse and a glossy with several option, I think it should be useful also for your needs:
Screenshot 2015-08-06 09.26.25.jpg
1. Choose the path for the diffuse channel, the name of the texture will be the name of the material.
1b. Is possible to add a suffix to the final name of the material.
2. If checked, the Transmission node is created based on the Diffuse texture, otherwise the transmission node stays black.
3. In the Opacity popup menu there are three options:
a. Alpha image, it is possible to specify a different path for the alpha image texture.
b. Grayscale image, useful if the alpha file is a separate jpg file.
c. Derive from diffuse, perfect if the diffuse texture has an alpha channel in it like png, tiff, tga.
d. if no path is selected, the material is opaque
4. It is possible to choose between bump and normal map, if no path is selected the bump map is derived by the diffuse map.
5. Is is possible to specify a path for the specular/roughness channels, if no path is selected the map is derived by the diffuse map.

* it is possible to directly invert the map, if needed.
After clicking to the "Create" button, you should have something like this:
Screenshot 2015-08-06 09.31.48.jpg
And here is the node graph expanded to see how is made inside the material:
Screenshot 2015-08-06 09.32.07.jpg
I hope you could find it useful ;)
bg4dCreateMixMat-1_00.lua
(23.99 KiB) Downloaded 820 times
ciao beppe
Liewec123
Posts: 4
Joined: Wed Aug 05, 2015 1:22 pm

woah! thats insanely helpful! thanks! :D

i can't wait to give it a try!

my only issue now is that i don't have permission to view files attached to your post.

thanks again for the help, you're awesome! ;)
Post Reply

Return to “Lua Scripting”