pfunkifized
Hi all!

Just delving into the SOuP world and really want to try and incorporate it into my workflow but I'm having a few issues. I'm trying to use Scatter to distribute points on a mesh based on a texture ( totally ok here ), emit particles from those scatter points ( got this to work with the Scatter > pointCloudToCurve > Emit From Geometry ), but I want to do two things I can't seem to get to work.

I need to get the UV data from a pointsOnMeshInfo node but it seems like it's not running through the data at a per particle level and all particles change color once one particle dies.

I also want the particles to stick to the surface and move based on a texture also but I've only really done with by animating goalU and goalV in an expression before and am wondering if there's a better way using SOuP.

Cheers!
Reply 0 0
pshipkov
About your first question - this sounds strange - wonder if you can provide basic example of what you are trying to do. I suspect the problem is how you actually read the UV data from pointsOnMeshInfo and pass it to the particles.

About the second question - you can use the point node to program the logic of sliding points in UV space based on texture data. There is no node in SOuP that provides that for free and you have to help a bit with coding the logic.
Reply 0 0
pfunkifized
Thanks for the quick response. I want to get UV info from a mesh so that I can run colorAtPoint in a particle expression without having to do setAttrs on a closestPointOnMesh since I figure it'd be faster going through more direct connections. As it is I have the pointsOnMeshInfo getting its positionPP data from the world position of the particles and its inMesh from a sphere shape. I have the UV box checked on the pointsOnMeshInfo, and I run a getAttr in the runtime expression querying the outUvPP attribute of the pointsOnMeshInfo node. When I run colorAtPoint with the UV info that's queried, all particles are created and exist with just one color. I'm at work now but I can post a scene later if it'll help. Thanks!
Reply 0 0
pshipkov
Check the attached scene.
I may add inMapPP to the point node at some point later to simplify this particular case.
There is no particle expressions or other hacky stuff to read arrays outside the particle shape.
Reply 0 0
pfunkifized
Awesome! thanks so much. Just wondering though, is there some connection I need to make for MR to recognize rgbPP? It renders fine in Maya Hardware but if I'm going to use spheres I definitely want to use MR. 

Thanks again!
Reply 0 0
pshipkov
I am using standard particles and for some unknown reason the mental ray translator does not recognize their colors. If you plug nParticles then you can render the colors.
Reply 0 0
pfunkifized
Thanks for checking it out. Also, for standard particles, it is possible to render rgbPP with mental ray but you need to connect a particleSamplerInfo node to a few particle attributes. Here's something that Duncan posted on a forum about it :

For software renders you need to use particleSamplerInfo to set various per particle properties to the shader. In Maya2009 mental ray supports all the attributes on particleSamplerInfo, but note that earlier versions did not work with everything. 

The particleSamplerInfo utility node has the common particle attributes as well as some user definable attributes. If these attributes exist on the particle system then a shade sample time the render engine will stuff the values. One can then connect from these values to shading networks for particle shaders so that the shaders will pick up per particle attributes.

With nParticles by default a particleSamplerInfo's outColor, outIncandescence and outTransparency is connected to the color, incandescence and transparency of the particle shader. The particleSamplerInfo also has attributes like rgbPP, but an attribute like outColor will output either the constant colorR,colorG,colorB on the system OR the rgbPP(if it exists). Thus with nParticles one usually doesn't need to worry about the particleSamplerInfo connections as they will match the hardware shading automatically.
Duncan



Thanks again!




Reply 0 0
fxwriter
Hi, I am currently going down a very similar path to this and just wanted to see if Peter, you could give me a bit of insight as to what exactly is it that is going on in the point node expression to get the right UV values into the red and green channels

the expression looks like this

$R = $WGT [(int) $ID *2]
$G = $WGT [(int) $ID *2 + 1]

I get that you are calling the weight values since thats where the connection is going, I am jus wondering about the way you are sorting to get the correct UV values

Thanks
Reply 0 0
pshipkov
There are 2 coordinates (U and V) for each UV point.
Because of that the UV points array has twice more elements than the number of points.
To associate the proper UV coordinates to each point we need:
U = pointIndex * 2;
V = pointIndex * 2 + 1;

That's all.
Reply 0 0
fxwriter
thanks peter,

I should have elaborated as to what is causing my confusion. The UV part I get, its more about the fact that you are multiplying the index point by 2 to get to the second value on the array to get the U... and the + 1 for the V...

The assumption here goes that this is how the point is organizing the array...

[pointID, U, V,]

but if I plug and un plug  color, normal, radius, etc.. will the array shuffle?

my question basically would be if the way the list of array organizes is by order of connection or will U and V always occupy the 2nd and 3rd spot on the array?


thanks!

Reply 0 0
pshipkov
It is just offsets when looking up related data in arrays of different length.

if we have 3 points.
each point has weight, uvs and color (rgba) "channels" associated with it

the weight array looks like this:
{w1, w2, w3}

the uvs array looks like this:
{u1,v1,u2,v2,u3,v3}

the color array looks like this:
{r1,g1,b1,a1,r2,g2,b2,a2,r3,g3,b3,a3}

The weights array matches the size of the colors one. Relation is 1 to 1.
The uv array is 2x the size of the points one.
The color array is 4x the size of the points one.
We will need an offset of some sort to find the right UVs and COLORs for our points.

For point 2 the U and V values from the UVs array are as fallows:
u_index = point_index*2 = 4
v_index = point_index*2+1 = 5

for the color array:
r_index = point_index*4
g_index = point_index*4+1
b_index = point_index*4+2
a_index = point_index*4+3

Hope it makes sense.
Reply 0 0
fxwriter
makes perfect sense.

thank you so much for taking the time


Reply 0 0
Reply