Advice needed for setting a Color with a Vex Expression

   8000   3   0
User Avatar
Member
8 posts
Joined: June 2021
Offline
Hello there,

Can someone please help with a Vex Expression for a Infected System. I wrote the Vex Expression in a Attribute Wrangle as you can see it in the attachment. The Rendering is showing the Boolean Part of the Stone in Black/Red.
How can switch the Color of this Part of the Stone in Grey/Red?
That the Stone is shown in the same Grey Color Tone.

You also can see how the Rendering looks in the attachment.
Image Not Found

Attachments:
2.JPG (24.8 KB)

User Avatar
Member
152 posts
Joined: Aug. 2012
Offline
There doesn't seem to be enough information in this post to provide much help. Could you attach a screenshot or copy paste your wrangle's contents?

Assuming the colour information on your model comes from attributes and not texture, it could be that your colour information was overridden by the wrangle, or that the attribute's Class is of a different priority level (Highest granularity is always shown on top, in the order Vertex > Point > Primitive > Detail). You could use an Attribute Delete to clean up Cd before Merge (merge handles similarly named attributes of different classes in the same way, only displaying highest granularity)
User Avatar
Member
9384 posts
Joined: July 2007
Offline
so if for example you stone part has Cd attribute of grey value like {.5,.5,.5}
then for your booleaned part (or group if its part of the same geo flow) you can do wrangle:

float mask = v@Cd.x; //assuming your input geo contains v@Cd point attribute with black red colors you are showing
vector stone_color = {.5,.5,.5};
vector infected_color = {1.0,0,0};
v@Cd = lerp(stone_color, infected_color, mask);

or if you want to control the colors as parameters
float mask = v@Cd.x; //assuming your input geo contains v@Cd point attribute with black red colors you are showing
vector stone_color = chv("stone_color");
vector infected_color = chv("infected_color");
v@Cd = lerp(stone_color, infected_color, mask);
Tomas Slancik
CG Supervisor
Framestore, NY
User Avatar
Member
8 posts
Joined: June 2021
Offline
Jikian
There doesn't seem to be enough information in this post to provide much help. Could you attach a screenshot or copy paste your wrangle's contents?

Assuming the colour information on your model comes from attributes and not texture, it could be that your colour information was overridden by the wrangle, or that the attribute's Class is of a different priority level (Highest granularity is always shown on top, in the order Vertex > Point > Primitive > Detail). You could use an Attribute Delete to clean up Cd before Merge (merge handles similarly named attributes of different classes in the same way, only displaying highest granularity)


The upload of the screenshot with the attribute wrangle unfortunately failed. Sorry for that. The Vex Expression of the attribute wrangle is: @Cd = set(@infection,0,0,0);




tamte
so if for example you stone part has Cd attribute of grey value like {.5,.5,.5}
then for your booleaned part (or group if its part of the same geo flow) you can do wrangle:

float mask = v@Cd.x; //assuming your input geo contains v@Cd point attribute with black red colors you are showing
vector stone_color = {.5,.5,.5};
vector infected_color = {1.0,0,0};
v@Cd = lerp(stone_color, infected_color, mask);

or if you want to control the colors as parameters
float mask = v@Cd.x; //assuming your input geo contains v@Cd point attribute with black red colors you are showing
vector stone_color = chv("stone_color");
vector infected_color = chv("infected_color");
v@Cd = lerp(stone_color, infected_color, mask);


Thank you so much for that helpfully Information. Everything worked like you described it. I'm using the first Method and controll it directly with the Vector.



Maximilian Paul
Edited by MaxPaul - Sept. 15, 2021 10:41:02
  • Quick Links