Jump to content

Asset import script, remake materials correctly.


shadmar
 Share

Recommended Posts

If I use Arteria3D assets I have to manually mass-remake all my materials, they only show up with a diffuse.shader and diffuse texture and the specular texture.

 

A typical name-scheme used in arteria3d assets:

 

diffusename.tex

diffusename_nrm.tex

diffusename_spec.tex

 

So I wrote a little script to mass-remake them. (run from MinGW in windows or in Linux)

 

#!/bin/sh
excl=".meta|_n.t|_nrm.t|_s.t|_spec.t|_e.t"
matlist="$(ls *.tex | grep -viE $excl | awk -F"." '{ print $1 }')"

for x in $matlist
do
 themat=$x.mat
 echo "texture0=./$x.tex" > $themat
 shader="shader=\"Shaders/Model/diffuse.shader\""
 spec="specular=0.50000000,0.50000000,0.50000000,1.00000000"

 if [ -f $x"_nrm.tex" ]; then
  echo "texture1=./$x"_nrm".tex" >> $themat
  shader="shader=\"Shaders/Model/diffuse+normal.shader\""
  spec="specular=0.50000000,0.50000000,0.50000000,1.00000000"
 fi

 if [ -f $x"_spec.tex" ]; then
  echo "texture2=./$x"_spec".tex" >> $themat
  shader="shader=\"Shaders/Model/diffuse+normal+specular.shader\""
  spec="specular=1.00000000,1.00000000,1.00000000,1.00000000"
 fi

 echo $shader >> $themat
 echo $spec >> $themat

done

HP Omen - 16GB - i7 - Nvidia GTX 1060 6GB

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...