Community
3ds Max Programming
Welcome to Autodesk’s 3ds Max Forums. Share your knowledge, ask questions, and explore popular 3ds Max SDK, Maxscript and Python topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Controller Node: Random Number Output

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
Anonymous
1106 Views, 3 Replies

Controller Node: Random Number Output

Hi.

I would like to know if it's possible for the Script / Expression controller nodes to  look at an ObjectID number and generate a random number for the output.

As a working example, imagine a single material with a connected Smoke map, attached to multiple objects. The smoke map has its additional params exposed. I would like to have a random Phase number generated for each object that the material is assigned to.

Many thanks,

Sorcery

3 REPLIES 3
Message 2 of 4
denisT.MaxDoctor
in reply to: Anonymous

No. You can not do it this way. It will run counter to the “uniqueness” of the material. This can only be done with different materials.

The best you can do is to use one instance for all controllers and subAnims which you want to have the same. For example:

sm0 = Smoke()
m0 = Standard diffusemap:sm0
sm1 = Smoke()
m1 = Standard diffusemap:sm1

t1 = bitmaptexture()
t2 = bitmaptexture()
sc = bezier_float()

sm0.map1 = sm1.map1 = t1
sm0.map2 = sm1.map1 = t2
sm0.size.controller = sm1.size.controller = sc

in this example both texture maps are the same instances for both smokes, and size controllers are also the same. but other parameters are still unique.

  

 

Message 3 of 4
Anonymous
in reply to: denisT.MaxDoctor

Apologies for the delayed reply. I missed the email notification.

 

Thank you for your answer. It's a shame the nodes don't work how I originally thought. It just makes sense to me, that a shader / material should be "aware" of the objects it's applied to and enable us to randomise shader / material properties based on object ID, name, wire colour, etc, but oh well.

 

I mean, OSL can randomise for object ID, but annoyingly, I don't think those OSL nodes can be used to drive exposed addition params.

 

I also know nothing about coding, so your suggestion is a bit lost on me (I need copy and paste solutions XD), but will hopefully help other people.

 

Thanks again.

Message 4 of 4
denisT.MaxDoctor
in reply to: Anonymous

It's a shame the nodes don't work how I originally thought. It just makes sense to me, that a shader / material should be "aware" of the objects it's applied to and enable us to randomise shader / material properties based on object ID, name, wire colour, etc, but oh well.

 

The materials work a different way. They don't 'know' anything about where and how they will be used. A material (shader) like a can with paint, which cannot change its color depending on what wall you paint. But every wall might look different depending on its surface or texture for example.

 

So if you want that the same material looks different on different objects you have to change object's parameters that might effect the material look. In your case it might be a texture channel (mapping coordinates), which you can randomize. Unlike materials, objects can be referenced (which means be the same on the base, but have some difference in details). Just think about this possible approach... 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report