This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Get bounding box values | |
vector bbox = getbbox_size(0); | |
vector bbox_max = getbbox_max(0); | |
vector bbox_min = getbbox_min(0); | |
vector bbox_center = getbbox_center(0); | |
//Each of these functions return geometry bounding box values – | |
//it’s size, maximum and minimum values in each axis and the geometry center point. | |
//Result is always vector as it is a point in 3d space but you can isolate individual axis easily too: | |
float xsize = getbbox_size(0).x; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//string concatenation - reference an additional string inside a channel reference (eg: a switch index in a ch reference) | |
chs("../cam" + chs("../switcher1/camswitch") + "/focus") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Taper | |
if(chi("axis")==0){ | |
@P=set(@P.x,@P.y*chramp("profile",relbbox(@P).x)*ch("mult"),@P.z*chramp("profile",relbbox(@P).x)*ch("mult")); | |
} | |
else{ | |
if(chi("axis")==1){ | |
@P=set(@P.x*chramp("profile",relbbox(@P).y)*ch("mult"),@P.y,@P.z*chramp("profile",relbbox(@P).y)*ch("mult")); | |
} | |
else{ | |
@P=set(@P.x*chramp("profile",relbbox(@P).z)*ch("mult"),@P.y*chramp("profile",relbbox(@P).z)*ch("mult"),@P.z); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Function convert spherical to cartesian cordinates | |
vector sphereToCart(float lat, lon, rad){ | |
float x = -cos(lat) * cos(lon); | |
float y = sin(lat); | |
float z = cos(lat)* sin(lon); | |
return rad * set(x, y, z); | |
} | |
v@P = sphereToCart(radians(@lat), radians(@lon), 1.0); | |
v@N = normalize(@P); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Melt | |
float m= chf("melt"); | |
float rx= chramp("effect",relbbox(@P).y); | |
float rz= chramp("effect",relbbox(@P).y); | |
float t= chf("thickness"); | |
@P= set(@P.x*m*rx+@P.x,clamp(@P.y+t*@N.y-m,getbbox_min(0).y+t*@N.y,getbbox_max(0).y),@P.z*m*rz+@P.z); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Dashed Lines on resampled curves | |
float u = vertexprimindex(0, @vtxnum) / float(primvertexcount(0, @primnum)); | |
float u_length = u * primintrinsic(0, 'measuredperimeter', @primnum); | |
float u_anim = (u_length + @Time * chf('speed')); | |
int waves = sin(u_anim * M_PI * chf('frequency')) < chf('gaps'); | |
v@Cd = hsvtorgb( set(u, 1.0, 1.0) ) * waves; | |
@width= chf('width'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Initialize Glue Attributes on Constraints | |
s@constraint_name = "Glue"; | |
s@constraint_type = "all"; | |
i@propagate_iteration = chi("propagate_iteration"); | |
//These attributes can be used to customize the properties of individual glue bonds. | |
//f@strength = -1; | |
//f@impulse_halflife = 0.1; | |
//f@propagate_rate = 1.0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Velocity Curl Noise With Offset | |
float amp = chf("amp"); | |
float mult = chf("mult"); | |
float speed = chf("speed"); | |
v@N = v@N; | |
v@v += cross(v@N,(curlnoise(v@N*amp+@Time*speed)))*mult; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//PRIM_Set group based on word attribute on font SOP (Pre Requisite: create "word attribute") | |
if (@word == chi("select_word_index")){ | |
@group_blue= 1; | |
}else{ | |
@group_pink=1 ; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//DETAIL_Set word attribute on font SOP | |
//(Pre Requisite:enable "text attribute" on font sop > add a sort SOP based on "text index" attribute ) | |
int id = 0; | |
int id_old = 0; | |
int wordcounter = 0; | |
for(int i=0; i<@numprim; i++) | |
{ | |
id = prim(0,"textindex",i); | |