is there a script to automatic apply alpha images?

Forums: is there a script to automatic apply alpha images?
Forum for OctaneRender Lua scripting examples, discussion and support.

is there a script to automatic apply alpha images?

Postby Liewec123 » Wed Aug 05, 2015 1:35 pm

Liewec123 Wed Aug 05, 2015 1:35 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
Liewec123
 
Posts: 4
Joined: Wed Aug 05, 2015 1:22 pm

Re: is there a script to automatic apply alpha images?

Postby bepeg4d » Wed Aug 05, 2015 2:17 pm

bepeg4d Wed Aug 05, 2015 2:17 pm
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
User avatar
bepeg4d
Octane Guru
Octane Guru
 
Posts: 9940
Joined: Wed Jun 02, 2010 6:02 am
Location: Italy

Re: is there a script to automatic apply alpha images?

Postby Liewec123 » Wed Aug 05, 2015 3:19 pm

Liewec123 Wed Aug 05, 2015 3:19 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

Re: is there a script to automatic apply alpha images?

Postby Liewec123 » Wed Aug 05, 2015 4:51 pm

Liewec123 Wed Aug 05, 2015 4:51 pm
double post sorry! :?
Liewec123
 
Posts: 4
Joined: Wed Aug 05, 2015 1:22 pm

Re: is there a script to automatic apply alpha images?

Postby bepeg4d » Thu Aug 06, 2015 8:38 am

bepeg4d Thu Aug 06, 2015 8:38 am
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 694 times

ciao beppe
User avatar
bepeg4d
Octane Guru
Octane Guru
 
Posts: 9940
Joined: Wed Jun 02, 2010 6:02 am
Location: Italy

Re: is there a script to automatic apply alpha images?

Postby Liewec123 » Thu Aug 06, 2015 9:20 am

Liewec123 Thu Aug 06, 2015 9:20 am
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! ;)
Liewec123
 
Posts: 4
Joined: Wed Aug 05, 2015 1:22 pm

Return to Lua Scripting


Who is online

Users browsing this forum: No registered users and 1 guest

Thu Mar 28, 2024 10:08 am [ UTC ]