Materials in arrays

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
  09 September 2006
Materials in arrays

Is it possible to create an array containing materials, but without them being just references (or instances) of the main material?

I have an array of say 5 elements, and each of these elements is a copy of a base material with one it's texturemaps properties altered, to differ slightly one from the other.

Is that possible? I've tried, but what I got was the base material's texturemap property was changed, changing all the other ones also, as if they were instances or references...

I hope that explantion is clear, thanks in advance.
 
  09 September 2006
That's happening because you are referencing the material and not copying. To append the copy of a material to an array just do something like this:

append matsArray (copy mEditMaterials[1])


Hope that helps.
 
  09 September 2006
Great... Worked just fine...
Thanks a lot... =)

And now... Well, I need to know which texturemaps the material has... If I do mEditMaterials[1].maps[1] (or any other number) it gives me "undefined", thus I'm using the alias (.bumpMap), for example... Is there any way I can find the name without using the alias? (Example, identify via the .maps[] which is which and apply the modification I need to the correct property, without using alias)
 
  09 September 2006
You can get the map using its index. Just as you've said, using the maps array.

An for the maps names, this function returns the name for each map ID:

fn getMapIDName matID = (
	case matID of (
		1:		return "Ambient Color"
		2:		return "Diffuse Color"
		3:		return "Specular Color"
		4:		return "Specular Level"
		5:		return "Glossiness"
		6:		return "Self-Illumination"
		7:		return "Opacity"
		8:		return "Filter Color"
		9:		return "Bump"
		10:		return "Reflection"
		11:		return "Refraction"
		12:		return "Displacement"
		default:	return "Unknown"
	)
)
 
  09 September 2006
But that's for standard material... If, for example, I create a VRay... It'll tell me I'm treating "bump" while it's some other texturemap... Right?

Thanks
 
  09 September 2006
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright ©2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 07:27 PM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.