- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Sorry this is going to be abit long, I want to make sure there is enough context for my questions and show what I have tried so far.
When creating procedural materials I often find it to create masks using ramps or using mathematical expressions. I am used to working in object coordinates something like the center of the object is (0,0,0) and the bounding box goes from -1 to 1 for each of the coordinates.
The built-in ramps seem to only work with UV coordinates or projections which is inconvenient when the object is not UV unwrapped, and projection causes issues if the object moves.
I read Lurk Lurksons question about creating ramps using object coordinates here https://answers.arnoldrenderer.com/questions/27997/ramp-in-object-space.html
where Peter Horvath suggested using the state_vector shader to read the object space coordinates (Po).
I created a rectangular object, translated it by 2 x and 2y then froze the transforms and fed the state vector (PO) into a aiFloatToRGBA node and rendered that out.
From this it looks like (PO) is not at the center of the object once you freeze transforms.
Using a aiMatrixMultiplyVector node with translate set to -2,-2,0 I am able to get the expected result. I had thought it would be 2,2,0 since the object was translated by 2,2,0 but I must be confused about the direction of the vectors.
Then I can create the desired ramp using a remapvalue and aiRamprgb node.
Anyways onto my questions
1. What is going on with the translation being (-2,-2,0) to center the object coordinates when the object is translated (2,2,0) then frozen? This seems backwards.
2. it possible to access the objects center after a frozen translation without using an aiMatrixMultiplyvector node? This would be useful when the previous translations are no longer known.
3. I was trying to shift the values by adding instead of using mapping nodes and ramps, but the aiWriteFloat node does not appear to do anything and I am not sure what the “beauty” slider is. I can’t seem to find this node in the documentation. It looks like what I really want is aiUserData, but I am still wondering what aiWriteFloat is for.
3. there a better way to create effects like this masked off circle gradient? I find the switching between float to color confusing (although they both seem to be floats?)
4. If you use a camera(or some other type) projection to create a mask or ramp, is there a way to convert it into object coordinates so that you can get rid of the projection and keep the mask/gradient once the object is moving?
Solved! Go to Solution.