Dynamically assigning Materials to particles

115 views
Skip to first unread message

Leo Quensel

unread,
Jul 5, 2012, 11:11:23 AM7/5/12
to soft...@listproc.autodesk.com
Hey guys,

I think this is not possible with ICE in the current state, but as we
are now able to assign materials to polygon meshes via ICE, why not implement
the same for particles and/or instances?

In my case I have a big simulation containing thousands of planes with a different texture for each one.
At the moment I have a hundred textures and therefore a hundred polygon planes in my scene which I randomly instance.
The perfect idea would be to have just one plane to be instanced and dynamically assign a material via ICE per instance.
I know I can pull a value to the rendertree and perform some texture switching based on that, but with a hundred different materials this becomes too big.
I need a hundred materials that way or another, but it would greatly help
in reducing the object count in the scene.

A side note:
I have to repeat this as often as possible:
The viewport does not display instances as instances properly.
Set the particle shape to rectangle: Perfect speed even with thousands of particles
Instance a single-polygon grid instead: Massive performance drop

Cheers,
Leo

Mathieu Leclaire

unread,
Jul 5, 2012, 11:42:31 AM7/5/12
to soft...@listproc.autodesk.com
If it's just textures, why don't you simply convert your textures as an
image sequence (image.01.exr, image.02.exr, etc...), load it as a image
sequence in your 1 material and use Self.ShapeInstanceTime to determine
which texture gets assigned to which particle?

-Mathieu

Bradley Gabe

unread,
Jul 5, 2012, 11:43:52 AM7/5/12
to soft...@listproc.autodesk.com
Why not follow the process used by the new crowd system and generate a single mesh with thousands of clones (rather than instances)? You should be able to control material assignment per clone, and we've seen demos of huge crowds with thousands of elements.

Bradley Gabe

unread,
Jul 5, 2012, 11:47:06 AM7/5/12
to soft...@listproc.autodesk.com
I like this idea better than crowd clones :)

But at least it answers your suspicion, not only is it possible but there are likely multiple viable solutions.

Vincent Ullmann

unread,
Jul 5, 2012, 11:56:51 AM7/5/12
to soft...@listproc.autodesk.com
I think there is a Sample Szene wich assigns Materials Dynamicly.... "...\XSI_SAMPLES\Scenes\ICE\MaterialIDs.scn"
You should have a look there....



Anonther Solution:

- Give every particle a Random Integer Value
- Use this Integer in the Rendertree with a Color-Switch-Node
Unbenannt-1.jpg

Leo Quensel

unread,
Jul 5, 2012, 12:15:26 PM7/5/12
to soft...@listproc.autodesk.com
@Bradley

I don't have 2013 yet. It would be nice to simply convert the pointcloud
to a polymesh, but it would have to be exact.
Every de-instanced polymesh would have to be exactly aligned with its instance and have the same materialID as the original point.
And I think the problem here might be getting the data over from a single
particle to a per-polygon ID per instance.

@Mathieu

That seems to be a pretty good idea - will probably work for this
case as it is just textures.
It would be nicer to completely switch the material though.


@Vincent

Unfortunately that only works for polymeshes.


-------- Original-Nachricht --------
> Datum: Thu, 5 Jul 2012 17:56:51 +0200
> Von: Vincent Ullmann <vincent...@googlemail.com>
> An: soft...@listproc.autodesk.com
> Betreff: Re: Dynamically assigning Materials to particles

Leo Quensel

unread,
Jul 5, 2012, 12:17:51 PM7/5/12
to soft...@listproc.autodesk.com
I tried pulling a random integer into the rendertree and use a
texture_array_switch node. For that I scripted the connection of
the 100 textures to the array node, but no matter what I did, the node
always returned an empty value (the indices were correct and the IDs got
pulled over to the rendertree just fine).


-------- Original-Nachricht --------
> Datum: Thu, 5 Jul 2012 17:56:51 +0200
> Von: Vincent Ullmann <vincent...@googlemail.com>
> An: soft...@listproc.autodesk.com
> Betreff: Re: Dynamically assigning Materials to particles

Reply all
Reply to author
Forward
0 new messages