General Category > ASL Scripts

Texturing Scripts

(1/1)

Jdez:
I was wondering if anyone has written any material scripts that also use textures?

Kubajzz:
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: ---#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)


--- End code ---

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 ;)

Jdez:
Thanks very much!

BOB_I_Ts:
i made one using cube maps for a toon ink output
material_ink.zip extract all into your script folder then use script>run script

Navigation

[0] Message Index

Go to full version