Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/kernel/osl/shaders/node_musgrave_texture.osl
| Context not available. | |||||
| { | { | ||||
| float p = co; | float p = co; | ||||
| float pwHL = pow(lacunarity, -H); | float pwHL = pow(lacunarity, -H); | ||||
| float pwr = pwHL; | |||||
| float value = safe_snoise(p) + offset; | float pwr = 1.0; | ||||
| float weight = gain * value; | float value = 0.0; | ||||
| p *= lacunarity; | float weight = 1.0; | ||||
| for (int i = 1; (weight > 0.001) && (i < (int)octaves); i++) { | for (int i = 0; (weight > 0.001) && (i < (int)octaves); i++) { | ||||
| if (weight > 1.0) { | if (weight > 1.0) { | ||||
| weight = 1.0; | weight = 1.0; | ||||
| } | } | ||||
| Context not available. | |||||
| } | } | ||||
| float rmd = octaves - floor(octaves); | float rmd = octaves - floor(octaves); | ||||
| if (rmd != 0.0) { | if ((rmd != 0.0) && (weight > 0.001)) { | ||||
| value += rmd * ((safe_snoise(p) + offset) * pwr); | if (weight > 1.0) { | ||||
| weight = 1.0; | |||||
| } | |||||
| float signal = (safe_snoise(p) + offset) * pwr; | |||||
| value += rmd * weight * signal; | |||||
| } | } | ||||
| return value; | return value; | ||||
| Context not available. | |||||
| { | { | ||||
| vector2 p = co; | vector2 p = co; | ||||
| float pwHL = pow(lacunarity, -H); | float pwHL = pow(lacunarity, -H); | ||||
| float pwr = pwHL; | |||||
| float value = safe_snoise(p) + offset; | float pwr = 1.0; | ||||
| float weight = gain * value; | float value = 0.0; | ||||
| p *= lacunarity; | float weight = 1.0; | ||||
| for (int i = 1; (weight > 0.001) && (i < (int)octaves); i++) { | for (int i = 0; (weight > 0.001) && (i < (int)octaves); i++) { | ||||
| if (weight > 1.0) { | if (weight > 1.0) { | ||||
| weight = 1.0; | weight = 1.0; | ||||
| } | } | ||||
| Context not available. | |||||
| } | } | ||||
| float rmd = octaves - floor(octaves); | float rmd = octaves - floor(octaves); | ||||
| if (rmd != 0.0) { | if ((rmd != 0.0) && (weight > 0.001)) { | ||||
| value += rmd * ((safe_snoise(p) + offset) * pwr); | if (weight > 1.0) { | ||||
| weight = 1.0; | |||||
| } | |||||
| float signal = (safe_snoise(p) + offset) * pwr; | |||||
| value += rmd * weight * signal; | |||||
| } | } | ||||
| return value; | return value; | ||||
| Context not available. | |||||
| { | { | ||||
| vector3 p = co; | vector3 p = co; | ||||
| float pwHL = pow(lacunarity, -H); | float pwHL = pow(lacunarity, -H); | ||||
| float pwr = pwHL; | |||||
| float value = safe_snoise(p) + offset; | float pwr = 1.0; | ||||
| float weight = gain * value; | float value = 0.0; | ||||
| p *= lacunarity; | float weight = 1.0; | ||||
| for (int i = 1; (weight > 0.001) && (i < (int)octaves); i++) { | for (int i = 0; (weight > 0.001) && (i < (int)octaves); i++) { | ||||
| if (weight > 1.0) { | if (weight > 1.0) { | ||||
| weight = 1.0; | weight = 1.0; | ||||
| } | } | ||||
| Context not available. | |||||
| } | } | ||||
| float rmd = octaves - floor(octaves); | float rmd = octaves - floor(octaves); | ||||
| if (rmd != 0.0) { | if ((rmd != 0.0) && (weight > 0.001)) { | ||||
| value += rmd * ((safe_snoise(p) + offset) * pwr); | if (weight > 1.0) { | ||||
| weight = 1.0; | |||||
| } | |||||
| float signal = (safe_snoise(p) + offset) * pwr; | |||||
| value += rmd * weight * signal; | |||||
| } | } | ||||
| return value; | return value; | ||||
| Context not available. | |||||
| { | { | ||||
| vector4 p = co; | vector4 p = co; | ||||
| float pwHL = pow(lacunarity, -H); | float pwHL = pow(lacunarity, -H); | ||||
| float pwr = pwHL; | |||||
| float value = safe_snoise(p) + offset; | float pwr = 1.0; | ||||
| float weight = gain * value; | float value = 0.0; | ||||
| p *= lacunarity; | float weight = 1.0; | ||||
| for (int i = 1; (weight > 0.001) && (i < (int)octaves); i++) { | for (int i = 0; (weight > 0.001) && (i < (int)octaves); i++) { | ||||
| if (weight > 1.0) { | if (weight > 1.0) { | ||||
| weight = 1.0; | weight = 1.0; | ||||
| } | } | ||||
| Context not available. | |||||
| } | } | ||||
| float rmd = octaves - floor(octaves); | float rmd = octaves - floor(octaves); | ||||
| if (rmd != 0.0) { | if ((rmd != 0.0) && (weight > 0.001)) { | ||||
| value += rmd * ((safe_snoise(p) + offset) * pwr); | if (weight > 1.0) { | ||||
| weight = 1.0; | |||||
| } | |||||
| float signal = (safe_snoise(p) + offset) * pwr; | |||||
| value += rmd * weight * signal; | |||||
| } | } | ||||
| return value; | return value; | ||||
| Context not available. | |||||