Jump to content
  • Advertisement
Sign in to follow this  
hahaha

Material ID Help

This topic is 3994 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have this code in MaxScript for reading a faces material ID:
for f = 1 to NumFaces do
(
	index = getFaceMatID Mesh f
        format "%\n" index to:out_file
)
I only have 1 map applied to the object but when i run the script a get all sorts of values between 1 and 6. this is the output: 2 2 1 1 5 5 4 4 6 6 3 3 Any ideas why? [Edited by - hahaha on August 5, 2007 6:14:33 AM]

Share this post


Link to post
Share on other sites
Advertisement
Never done any Max Script and it's around 8 years since I last wrote a Max plugin that had to deal with materials.

That said I do have a vague recollection that you had to do something along the lines of "materialID = materialID % numberOfMaterials" if the materialID you got for the face was out of range. That worked for all sorts of fun combinations of multi-sub.

I think the samples in the SDK do that too.

If the modulo operator doesn't fix it, reposting your question on Sparks is probably a good idea.

Share this post


Link to post
Share on other sites
Thanks i tried using the modulo operator but there is no such operator in MaxScript. I posted the same question at sparks.
Thanks for your help

Share this post


Link to post
Share on other sites
Quote:
Original post by hahaha
but there is no such operator in MaxScript.


Google for maxscript+modulo points me at:

http://www.scriptspot.com/bobo/mel2mxs/arithmetic.htm

Quote:
In MAXScript, the modulus operation is performed using the mod function, followed by the two arguments. The result of the mod function in MXS is always a Float:

card = mod 7 3 --result is 1.0
bus = mod 0.5 3 --result is 0.5


Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!