Announcements

The Autodesk Community Forums has a new look. Read more about what's changed on the Community Announcements board.

aiColorJitter combined meshes, groups of faces, Maya

jen_steinkamp
Enthusiast

aiColorJitter combined meshes, groups of faces, Maya

jen_steinkamp
Enthusiast
Enthusiast

I would like to know if the aiColorJitter utility can work on groups of faces.

For example

Make a few Poly spheres

Use Mesh Combine to make 1 object
Apply aiColorJitter to make each group of faces a new color.

Right now I can only get individual faces to make a patchwork quilt.

I would like each sphere to have its own color.

This would be really handy for Paint Effects converted to polys. I would like to avoid separating the mesh.

0 Likes
Reply
380 Views
1 Reply
Reply (1)

madsd
Advisor
Advisor

I have this working in MAX. Fairly simple to do, I don't use the Jitternode however, but just access the IDs from OSL getattribute(); directly.

This grants me access to use OSL to grade, scale, offset hues, and add random seeds to the spheres just as the Jitternode would do, just with more flexibility.
The spheres are treated as integers thus, 1 solid random color, pr. face collection.

This is the easy part.

What you need to do, is basically find and use a utility in Maya, that automatically generates a random integer pr face collection. The spheres needs to have this added, since there is no way to know for the spheres that you need pr collection sets.

In max this is as simple as adding a modifier on the object that contains all spheres that is called "MaterialPrElement" and then I just add a a large range, so each element, gets this ID.

I then call getattribute("mtlID",container);
And process this integer stream.

So your task is not so much about Arnold and OSL, but more like generic Maya setup.
Im not a maya expert, but you want to use a Maya tool to generate an integer for each sphere, and then the rest is easy.
You don't want to have to sit and select faces manually for each sphere, so some kind of script/tool that does this for you is needed.

Arnold cannot achieve what you want, from a pure shade side of things only. We need a pregenerated signal to run the randomness on.

There is an alternative which we also use for Bifrost related subjects since texture loading is not in.
This method uses Vertex colors. You simply store the integer on a random texture channel, like channel 42 for example, and you can call this from Arnold and OSL with a UVW loader, picking a channel number 42.
Again here, you need a tool to automatically fabricate this UVW channel data stream, I use a data channel modifier which can give random Element IDs, and I then have it in OSL and can generate seeds, spread collect filter, do all the things you want to do.

cc.gif
Attached an .ass file that is already set up.
You should be able to reproduce the Jitter noodle above with this and attach it to the .ass file and see the spheres change color each time you push seed.
elementID.zip


Shader that goes into obj_seed.
You need to find the Maya hook for my "mtlID" and make sure it carries valid data.

shader ID
(
    int seed = 0,
    output int Index = 0
)
{
    getattribute("mtlID", Index);
    Index +=seed;    
}

0 Likes