Chaos Corona Forum

Chaos Corona for 3ds Max => [Max] I need help! => Topic started by: DPS on 2022-02-28, 08:49:05

Title: Different material spinner value per object at render time?
Post by: DPS on 2022-02-28, 08:49:05
I'm currently using material IDs and object IDs for various things in my scene.

I'd like to change the ''spread' value (and some others) within several cellular maps contained in a procedural shader. Ideally I can tell various objects in my scene specific values to use for these maps at render time.

It would reduce some convoluted usage of multimaps which are proving a pain to tweak.
Title: Re: Different material spinner value per object at render time?
Post by: romullus on 2022-02-28, 11:05:38
Maybe you could utilize object's user properties for that, but i don't know how exactly to feed that information to slate's controllers.
Title: Re: Different material spinner value per object at render time?
Post by: DPS on 2022-02-28, 12:20:39
I figured out how to get the Object Properties to pass a value to a CoronaUserProperty node, I can plug that into refraction for example and control that. Any ideas how to pipe this into a spinner that doesn't accept a map input?
Title: Re: Different material spinner value per object at render time?
Post by: romullus on 2022-02-28, 14:33:05
You can't use CoronaUserProperty, because it's a map and you need a controller. If user properties are accessible through maxscript, then it's probably possible to use slate's float script controller to feed them to where you need, but you need to know maxscript for that.
Title: Re: Different material spinner value per object at render time?
Post by: clemens_at on 2022-02-28, 16:18:06
try this:

Code: [Select]
myObjs = #($Box001,$Box002) -- add objects with "," seperation here
getObjCMaps = for i in myObjs collect getClassInstances Cellular target:i

for cMap in getObjCMaps do
(
cMap.size = 1.0 --change size value here
cMap.spread = 0.5 --change spread value here
)
Title: Re: Different material spinner value per object at render time?
Post by: DPS on 2022-03-01, 09:22:33
Would there be a way to have the script say

cMap.spread = userproperty "spread"

and then in my object user properties for Object01 I have spread=0.5, and in Object02 I have spread=0.2 etc?
Title: Re: Different material spinner value per object at render time?
Post by: clemens_at on 2022-03-01, 09:59:25
tell me again what you need exactly.
you want to be able to control different values of different cellular maps all at once inside the Slate Material Editor right?
Title: Re: Different material spinner value per object at render time?
Post by: DPS on 2022-03-01, 11:44:39
Hi Clemens

I am working on a building and each floor level uses a different mix of concrete/aggregate. Ground floor uses the most aggregate and from floor 7 onwards there is no aggregate.

To achieve this I have made a procedural shader with multiple cellular maps and splat maps piped into diffuse, gloss, bump etc

I can change the illusion of the amount of aggregate in the concrete by changing the spread in the cellular map and also the threshold in the splat map.

Currently I have 7 shaders. But if I could avoid the duplications of maps that would be ideal. 

I haven’t added any material break up or dirt yet either.

I hoped I could enter specific values in the object properties and feed that to the relevant spinners.
Title: Re: Different material spinner value per object at render time?
Post by: romullus on 2022-03-01, 13:55:25
Just a small workaround - instead of 7 separate materials, you could use single material and only split the maps that are unique per object. If it's only cellular map that is unique, then make 7 cellular maps and plug them through Corona multi-map. That way, most of the material will be easily controlable from single place. It's not the same as the way that you're trying achieve, but still better than managing 7 different materials.
Title: Re: Different material spinner value per object at render time?
Post by: DPS on 2022-03-02, 08:45:15
I would have done that but the objects that have the aggregate material may also have an interior wall shader, or soffit shader applied to different polygons.

I have a standard set of IDs that my modeler applies and the range for the aggregate starts at ID 80 and I can’t be bothered to redo the IDs within my scene. If Corona multi maps allowed you to specify that the range doesn’t start at 0 (like Vray) then I would have used that.