displacement jekaRustdis(float Km = 0.1, /* displacement magnitude */ nw = .3; /* bump weight */ string texname = "", subbumptex = "", humptex = "";) { float hump = 0; normal n = normalize(N); hump = 0; if(texname != "" ) //#### WHEN RED, CREATE SUB BUMP float redchan = texture(texname[0]); float subbump = ((((noise(s*300,t*300))*(asin(redchan)*.15))*.2)+(((noise(s*200,t*200))*(redchan))*.2))*(nw*.5); //#### CREATE BUMP WHEN BLUE float bluechan = texture(texname[2]); hump = ((noise(s*150,t*150))*bluechan)*nw; if(subbumptex != "" ){ subbump = ((texture(subbumptex))*redchan)*(nw*.5); } if(humptex != "" ){ hump = ((texture(humptex))*bluechan)*nw; } P = P - n * (-hump-subbump) * Km; N = calculatenormal(P); }