Anim8or Community

General Category => ASL Scripts => Topic started by: Jdez on September 19, 2009, 08:36:18 am

Title: Texturing Scripts
Post by: Jdez on September 19, 2009, 08:36:18 am
I was wondering if anyone has written any material scripts that also use textures?
Title: Re: Texturing Scripts
Post by: Kubajzz on September 20, 2009, 08:50:12 am
Hello Jdez,

I'm not sure if there are any material scripts that use textures... Anyway, I wrote a very simple one for you:

Code: [Select]
#command("object");

material $m;
texture $t;

/* Create a new material */
$m = project.NewMaterial("MyMaterial");

/* Create a new texture */
$t = project.NewTexture("MyTexture");
$t.SetFileName("c:\\Anim8or\\Example.jpg"); /* Enter your file path here */

/* Attach the texture to the newly created material */
$m.SetTexture(TEXTURE_DIFFUSE, $t);

/* Adjust the material settings */
$m.alpha = 0.5;
$m.diffuse = (0, 1, 0.5);
$m.Kd = 1;
$m.Ks = 0;
$m.SetBlendMode(TEXTURE_DIFFUSE, BLEND_MODE_LIGHTEN);
.... (more material settings)


The file path can be absolute or relative. If it is relative, then it starts from the "Project" folder that can be configured in the "File>Configure" dialog box.

I hope it helped ;)
Title: Re: Texturing Scripts
Post by: Jdez on September 23, 2009, 11:16:05 am
Thanks very much!
Title: Re: Texturing Scripts
Post by: BOB_I_Ts on October 21, 2009, 01:49:48 pm
i made one using cube maps for a toon ink output
material_ink.zip (http://homepage.ntlworld.com/w.watson3/main/files/material_ink.zip) extract all into your script folder then use script>run script