Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/intern/cycles/kernel/shaders/node_voronoi_texture.osl b/intern/cycles/kernel/shaders/node_voronoi_texture.osl
- index 2e47d74a414..858b76b1fd5 100644
- --- a/intern/cycles/kernel/shaders/node_voronoi_texture.osl
- +++ b/intern/cycles/kernel/shaders/node_voronoi_texture.osl
- @@ -98,68 +98,62 @@ void voronoi_m(point p, string metric, float e, float da[4], point pa[4])
- /* Voronoi */
- shader node_voronoi_texture(
- int use_mapping = 0,
- matrix mapping = matrix(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
- string coloring = "intensity",
- string metric = "distance",
- string feature = "F1",
- float Exponent = 1.0,
- float Scale = 5.0,
- point Vector = P,
- output float Fac = 0.0,
- - output color Color = 0.0)
- + output color Color = 0.0,
- + output point outVector = (0, 0, 0))
- {
- point p = Vector;
- if (use_mapping)
- p = transform(mapping, p);
- /* compute distance and point coordinate of 4 nearest neighbours */
- float da[4];
- point pa[4];
- /* compute distance and point coordinate of 4 nearest neighbours */
- voronoi_m(p * Scale, metric, Exponent, da, pa);
- + /* Default: F1 => Closest point */
- + int idx = 0;
- + point pOut = p;
- + point vOffset = (0, 0, 0);
- + float dOffset = 0.0;
- +
- + if (feature == "F2") {
- + idx = 1;
- + }
- + else if (feature == "F3") {
- + idx = 2;
- + }
- + else if (feature == "F4") {
- + idx = 3;
- + }
- + else if (feature == "F2F1") {
- + /* F2 - F1 */
- + idx = 1;
- + pOut = pa[0];
- + vOffset = pa[0];
- + dOffset = da[0];
- + }
- + outVector = pa[idx] - pOut;
- if (coloring == "intensity") {
- /* Intensity output */
- - if (feature == "F1") {
- - Fac = fabs(da[0]);
- - }
- - else if (feature == "F2") {
- - Fac = fabs(da[1]);
- - }
- - else if (feature == "F3") {
- - Fac = fabs(da[2]);
- - }
- - else if (feature == "F4") {
- - Fac = fabs(da[3]);
- - }
- - else if (feature == "F2F1") {
- - Fac = fabs(da[1] - da[0]);
- - }
- + Fac = fabs(da[idx] - dOffset);
- Color = color(Fac);
- - }
- - else {
- + } else {
- /* Color output */
- - if (feature == "F1") {
- - Color = pa[0];
- - }
- - else if (feature == "F2") {
- - Color = pa[1];
- - }
- - else if (feature == "F3") {
- - Color = pa[2];
- - }
- - else if (feature == "F4") {
- - Color = pa[3];
- - }
- - else if (feature == "F2F1") {
- - Color = fabs(pa[1] - pa[0]);
- - }
- -
- + Color = pa[idx] - vOffset;
- Color = cellnoise_color(Color);
- Fac = (Color[0] + Color[1] + Color[2]) * (1.0 / 3.0);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement