Hi,
I am looking at ways to calculate the vertex colour base on certain attributes on the geometry. Those attributes have min and max values which I am using to determine a range.
Currently, I am using the values as RGB for @Cd and it looks to be working so I am looking ahead to a colour ramp.
Building the color lookup in the AttributeWrangler VEX section seems computationally expensive as that gets run over every point.
If using a color ramp outside of the AttributeWrangler, what type of SOP or OP provides an accessible color ramp ?
How would the AttributeWrangler get access to the ramp ? Via the ancillary inputs ?
Or should I write a Custom File SOP with a color ramp so that the AttributeWrangler have access to them ? How would a VEX code looks like which access SOP level color ramp ?
Cheers
VEX color ramp look up
3045 2 0- nicholas_yue
- Member
- 301 posts
- Joined: July 2005
- Offline
- tamte
- Member
- 8582 posts
- Joined: July 2007
- Online
I'm not following what you consider expensive
Your code doesn't show any ramp lookup
But ramp lookups in vex using chramp() are not expensive unless you are using time argument also
If you are looking up different value per point then use Point Wrangle, however if your goal is to lookup just one value for the whole geo then you can execute it in Detail mode
Your code doesn't show any ramp lookup
But ramp lookups in vex using chramp() are not expensive unless you are using time argument also
If you are looking up different value per point then use Point Wrangle, however if your goal is to lookup just one value for the whole geo then you can execute it in Detail mode
Tomas Slancik
FX Supervisor
Method Studios, NY
FX Supervisor
Method Studios, NY
- cncverkstad
- Member
- 117 posts
- Joined: Aug. 2017
- Offline
vector color[]; for(int i;i<10;i++){ color[i] = rand(i); } int pt; vector cd; for (int i;i<100;i++){ pt = addpoint(0,set(i/99.0,0,0)); cd = spline("linear",i/99.0,color); setpointattrib(0,"Cd",pt,cd); } vector p; int prim = addprim(0,"polyline"); int n = 100; float u; float deriv; for(int i;i<n;i++){ u = float(i)/(n-1); p.y = chramp("ramp_float",u); p.x = u; pt = addpoint(0,p); cd = chramp("ramp_color",u); setpointattrib(0,"Cd",pt,cd); deriv = chrampderiv("ramp_float",u); setpointattrib(0,"N",pt,set(1,deriv)); }
dict_eval = hou.ch('dict') print dict_eval print dict_eval['0'],dict_eval['1'],dict_eval['2'],dict_eval['3'] ramp_eval = hou.ch('ramp') print ramp_eval print ramp_eval.lookup(0.1) geo = hou.pwd().geometry() pscale_attrib = geo.addAttrib(hou.attribType.Point,"pscale",0.0) for i in range (10); u = i/9.0; point = geo.createPoint() point.setPosition([i,0,0]) pscale = ramp_eval.lookup(u); point.setAttribValue(pscale_attrib,pscale)
Conservation of Momentum
-
- Quick Links