Hello!
I am trying to set the value of a color ramp point inside a shader to the value of my Cd.
The parameter is called “rampcolordefault2” and i guess in vex i could have written “rampcolordefault2 = @Cd;”, but this is vops and i just don't know how to set that parameter.Is there any way of doing this?
Thank you!
feed Cd to color ramp point inside shader?
2481 2 1- AlexPavel
- Member
- 7 posts
- Joined: March 2016
- Offline
- jsmack
- Member
- 8041 posts
- Joined: Sept. 2011
- Offline
The ramp cannot take individual inputs as keys of the ramp. You can use the spline vop to evaluate a set of arbitrary inputs as if it were a ramp though. The spline vop unfortunately does not allow specifying key positions, limiting it to ramps with evenly spaced keys. If you want to have the full power of a ramp, you'll need to get crafty with building the arrays that define a ramps keys, positions, and bases. These in turn are evaluated using the spline() function, which is only available as inline code, using an inline or snippet vop.
- bonsak
- Member
- 459 posts
- Joined: Oct. 2011
- Offline
You can control ramps with python though, so you could put together an hda controlling this. Here is some example code to fiddle with.
-b
node = hou.node('/obj/matnet1/subnet1/ramp1') curve = hou.rampBasis.CatmullRom pos1 = 0 pos2 = 0.5 pos3 = 1 firstColor = (0,1,0) secondColor = (0,0,1) thirdColor = (1,0,1) newramp = hou.Ramp( (curve, curve, curve) , (pos1, pos2, pos3), (firstColor, secondColor, thirdColor)) node.setParms( {'rampcolordefault': newramp } )
-b
-
- Quick Links