Search - User list
Full Version: pointattrib() in attribwrangler running over detail
Root » Houdini Indie and Apprentice » pointattrib() in attribwrangler running over detail
Shaded35
Firstly: sorry for my bad ebglish.
I'm totally new in Houdini, so it could be silly question. Sorry for that too.

I've created attribwrangler node, set “Run Over” to “Detail”, and type this code:

for (int i; i<10; i++) {
addpoint(0, set(0, (float)i/10, 0));
}

Points created succesfully. But when i'm trying to access “P” attribute of created points, i'm always getting {0,0,0}. There is the code i'm using:

for (int i; i<10; i++) {
vector pos = pointattrib(0, “P”, i, 0);
}

pos always equals {0,0,0}

Help me understand what i am doing wrong, please.
jsmack
Shaded35
Help me understand what i am doing wrong, please.

Trying to access the attributes of points added by the wrangle. Geometry created or changed by a wrangle doesn't actually exist/isn't changed during the execution of the shading code. Only the inputs to the node can be accessed which is what the ‘0’ means in the point() function.

If a geometry shader needs to access values that were written to attributes, it needs to store them as local variables for later use.
Shaded35
jsmack
Shaded35
Help me understand what i am doing wrong, please.

Trying to access the attributes of points added by the wrangle. Geometry created or changed by a wrangle doesn't actually exist/isn't changed during the execution of the shading code. Only the inputs to the node can be accessed which is what the ‘0’ means in the point() function.

If a geometry shader needs to access values that were written to attributes, it needs to store them as local variables for later use.

Thanks for your answer.
tamte
Shaded35
pos always equals {0,0,0}
works for me
for (int i=0; i<10; i++) {
vector pos = pointattrib(0, "P", i, 0);
printf("%g, ", pos);
}
spits out
{0,0,0}, {0,0.1,0}, {0,0.2,0}, {0,0.3,0}, {0,0.4,0}, {0,0.5,0}, {0,0.6,0}, {0,0.7,0}, {0,0.8,0}, {0,0.9,0}

you can also use point() function instead pointattrib(), but that's just an alternative
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB