Anim8or Community

Please login or register.

Login with username, password and session length
Advanced search  

News:

Ian Ross has just released a book on Anim8or. It's perect for a beginner and a good reference for experienced users. It contains detailed chapters on every aspect, with many examples. Get your own copy here: "Anim8or Tutorial Book"

Author Topic: Texturing Scripts  (Read 9513 times)

Jdez

  • Full Member
  • ***
  • Posts: 105
    • View Profile
    • Tech Blog
Texturing Scripts
« on: September 19, 2009, 04:36:18 am »

I was wondering if anyone has written any material scripts that also use textures?
Logged
Having fun with ASL!
Tech blog: http://jaydez-tech.blogspot.com

Kubajzz

  • Flying Platypus
  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 548
  • Little doggie ate my avatar...
    • View Profile
Re: Texturing Scripts
« Reply #1 on: September 20, 2009, 04: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 ;)
Logged

Jdez

  • Full Member
  • ***
  • Posts: 105
    • View Profile
    • Tech Blog
Re: Texturing Scripts
« Reply #2 on: September 23, 2009, 07:16:05 am »

Thanks very much!
Logged
Having fun with ASL!
Tech blog: http://jaydez-tech.blogspot.com

BOB_I_Ts

  • Full Member
  • ***
  • Posts: 157
    • View Profile
    • Anim8rOrg
Re: Texturing Scripts
« Reply #3 on: October 21, 2009, 09:49:48 am »

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
Logged