3d emulation with tikz

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
6
down vote

favorite












I am trying to draw a 3d arbitrary volume using tikz.
The 2d equivalent is like(courtesy: this):



beginframe
begintikzpicture
pgfmathsetseed3
draw[fill=blue!70] plot [smooth cycle, samples=8,domain=1:8]
(x*360/8+5*rnd:0.5cm+1cm*rnd) node at (0,0) ;
endtikzpicture
endframe


Is it possible to give it a 3d feeling? like a diffused lighting effect or something?







share|improve this question
























    up vote
    6
    down vote

    favorite












    I am trying to draw a 3d arbitrary volume using tikz.
    The 2d equivalent is like(courtesy: this):



    beginframe
    begintikzpicture
    pgfmathsetseed3
    draw[fill=blue!70] plot [smooth cycle, samples=8,domain=1:8]
    (x*360/8+5*rnd:0.5cm+1cm*rnd) node at (0,0) ;
    endtikzpicture
    endframe


    Is it possible to give it a 3d feeling? like a diffused lighting effect or something?







    share|improve this question






















      up vote
      6
      down vote

      favorite









      up vote
      6
      down vote

      favorite











      I am trying to draw a 3d arbitrary volume using tikz.
      The 2d equivalent is like(courtesy: this):



      beginframe
      begintikzpicture
      pgfmathsetseed3
      draw[fill=blue!70] plot [smooth cycle, samples=8,domain=1:8]
      (x*360/8+5*rnd:0.5cm+1cm*rnd) node at (0,0) ;
      endtikzpicture
      endframe


      Is it possible to give it a 3d feeling? like a diffused lighting effect or something?







      share|improve this question












      I am trying to draw a 3d arbitrary volume using tikz.
      The 2d equivalent is like(courtesy: this):



      beginframe
      begintikzpicture
      pgfmathsetseed3
      draw[fill=blue!70] plot [smooth cycle, samples=8,domain=1:8]
      (x*360/8+5*rnd:0.5cm+1cm*rnd) node at (0,0) ;
      endtikzpicture
      endframe


      Is it possible to give it a 3d feeling? like a diffused lighting effect or something?









      share|improve this question











      share|improve this question




      share|improve this question










      asked Aug 31 at 18:02









      BaRud

      80321321




      80321321




















          2 Answers
          2






          active

          oldest

          votes

















          up vote
          8
          down vote



          accepted










          Here is an option using shade and the ball preset



          enter image description here



          documentclass[tikz,margin=0.5cm]standalone
          begindocument
          begintikzpicture
          pgfmathsetseed3
          shade [ball color=blue!70] plot [smooth cycle, samples=8,domain=1:8]
          (x*360/8+5*rnd:0.5cm+1cm*rnd);
          endtikzpicture
          enddocument


          Some more examples



          enter image description here



          documentclass[tikz,margin=0.5cm]standalone
          begindocument
          begintikzpicture
          pgfmathsetmacroS3
          foreach X in 1,...,3
          foreach Y in 1,...,3
          beginscope[shift=(S*X,S*Y)]
          shade [ball color=blue!70] plot [smooth cycle, samples=8,domain=1:8]
          (x*360/8+5*rnd:0.5cm+1cm*rnd);
          endscope


          endtikzpicture
          enddocument





          share|improve this answer





























            up vote
            4
            down vote













            A very small addendum to Milo's great answer: sometimes you want the bright spot not to be where shade[ball color=...]... puts it. You could either define your own shading, or, what is perhaps simpler, clip a circle with a shifted center against that shape. The following animation is supposed to give you an idea what's possible. In the end, you will have to decide on your own what looks realistic, or switch to asymptote, which computes realistic shadings for you.



            documentclass[tikz,margin=0.5cm]standalone
            begindocument
            foreach X in 1,2,...,42
            begintikzpicture
            pgfmathsetseedX
            path[use as bounding box] (-4,-4) rectangle (4,4);
            clip plot [smooth cycle, samples=8,domain=1:8]
            (x*360/8+5*rnd:0.5cm+1cm*rnd);
            shade [ball color=blue!70] (0.5+rnd,-0.5+rnd) circle (3cm);
            endtikzpicture
            enddocument


            enter image description here






            share|improve this answer




















              Your Answer







              StackExchange.ready(function()
              var channelOptions =
              tags: "".split(" "),
              id: "85"
              ;
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function()
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled)
              StackExchange.using("snippets", function()
              createEditor();
              );

              else
              createEditor();

              );

              function createEditor()
              StackExchange.prepareEditor(
              heartbeatType: 'answer',
              convertImagesToLinks: false,
              noModals: false,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: null,
              bindNavPrevention: true,
              postfix: "",
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              );



              );













               

              draft saved


              draft discarded


















              StackExchange.ready(
              function ()
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f448727%2f3d-emulation-with-tikz%23new-answer', 'question_page');

              );

              Post as a guest






























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes








              up vote
              8
              down vote



              accepted










              Here is an option using shade and the ball preset



              enter image description here



              documentclass[tikz,margin=0.5cm]standalone
              begindocument
              begintikzpicture
              pgfmathsetseed3
              shade [ball color=blue!70] plot [smooth cycle, samples=8,domain=1:8]
              (x*360/8+5*rnd:0.5cm+1cm*rnd);
              endtikzpicture
              enddocument


              Some more examples



              enter image description here



              documentclass[tikz,margin=0.5cm]standalone
              begindocument
              begintikzpicture
              pgfmathsetmacroS3
              foreach X in 1,...,3
              foreach Y in 1,...,3
              beginscope[shift=(S*X,S*Y)]
              shade [ball color=blue!70] plot [smooth cycle, samples=8,domain=1:8]
              (x*360/8+5*rnd:0.5cm+1cm*rnd);
              endscope


              endtikzpicture
              enddocument





              share|improve this answer


























                up vote
                8
                down vote



                accepted










                Here is an option using shade and the ball preset



                enter image description here



                documentclass[tikz,margin=0.5cm]standalone
                begindocument
                begintikzpicture
                pgfmathsetseed3
                shade [ball color=blue!70] plot [smooth cycle, samples=8,domain=1:8]
                (x*360/8+5*rnd:0.5cm+1cm*rnd);
                endtikzpicture
                enddocument


                Some more examples



                enter image description here



                documentclass[tikz,margin=0.5cm]standalone
                begindocument
                begintikzpicture
                pgfmathsetmacroS3
                foreach X in 1,...,3
                foreach Y in 1,...,3
                beginscope[shift=(S*X,S*Y)]
                shade [ball color=blue!70] plot [smooth cycle, samples=8,domain=1:8]
                (x*360/8+5*rnd:0.5cm+1cm*rnd);
                endscope


                endtikzpicture
                enddocument





                share|improve this answer
























                  up vote
                  8
                  down vote



                  accepted







                  up vote
                  8
                  down vote



                  accepted






                  Here is an option using shade and the ball preset



                  enter image description here



                  documentclass[tikz,margin=0.5cm]standalone
                  begindocument
                  begintikzpicture
                  pgfmathsetseed3
                  shade [ball color=blue!70] plot [smooth cycle, samples=8,domain=1:8]
                  (x*360/8+5*rnd:0.5cm+1cm*rnd);
                  endtikzpicture
                  enddocument


                  Some more examples



                  enter image description here



                  documentclass[tikz,margin=0.5cm]standalone
                  begindocument
                  begintikzpicture
                  pgfmathsetmacroS3
                  foreach X in 1,...,3
                  foreach Y in 1,...,3
                  beginscope[shift=(S*X,S*Y)]
                  shade [ball color=blue!70] plot [smooth cycle, samples=8,domain=1:8]
                  (x*360/8+5*rnd:0.5cm+1cm*rnd);
                  endscope


                  endtikzpicture
                  enddocument





                  share|improve this answer














                  Here is an option using shade and the ball preset



                  enter image description here



                  documentclass[tikz,margin=0.5cm]standalone
                  begindocument
                  begintikzpicture
                  pgfmathsetseed3
                  shade [ball color=blue!70] plot [smooth cycle, samples=8,domain=1:8]
                  (x*360/8+5*rnd:0.5cm+1cm*rnd);
                  endtikzpicture
                  enddocument


                  Some more examples



                  enter image description here



                  documentclass[tikz,margin=0.5cm]standalone
                  begindocument
                  begintikzpicture
                  pgfmathsetmacroS3
                  foreach X in 1,...,3
                  foreach Y in 1,...,3
                  beginscope[shift=(S*X,S*Y)]
                  shade [ball color=blue!70] plot [smooth cycle, samples=8,domain=1:8]
                  (x*360/8+5*rnd:0.5cm+1cm*rnd);
                  endscope


                  endtikzpicture
                  enddocument






                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Aug 31 at 18:20

























                  answered Aug 31 at 18:06









                  Milo

                  5,53321345




                  5,53321345




















                      up vote
                      4
                      down vote













                      A very small addendum to Milo's great answer: sometimes you want the bright spot not to be where shade[ball color=...]... puts it. You could either define your own shading, or, what is perhaps simpler, clip a circle with a shifted center against that shape. The following animation is supposed to give you an idea what's possible. In the end, you will have to decide on your own what looks realistic, or switch to asymptote, which computes realistic shadings for you.



                      documentclass[tikz,margin=0.5cm]standalone
                      begindocument
                      foreach X in 1,2,...,42
                      begintikzpicture
                      pgfmathsetseedX
                      path[use as bounding box] (-4,-4) rectangle (4,4);
                      clip plot [smooth cycle, samples=8,domain=1:8]
                      (x*360/8+5*rnd:0.5cm+1cm*rnd);
                      shade [ball color=blue!70] (0.5+rnd,-0.5+rnd) circle (3cm);
                      endtikzpicture
                      enddocument


                      enter image description here






                      share|improve this answer
























                        up vote
                        4
                        down vote













                        A very small addendum to Milo's great answer: sometimes you want the bright spot not to be where shade[ball color=...]... puts it. You could either define your own shading, or, what is perhaps simpler, clip a circle with a shifted center against that shape. The following animation is supposed to give you an idea what's possible. In the end, you will have to decide on your own what looks realistic, or switch to asymptote, which computes realistic shadings for you.



                        documentclass[tikz,margin=0.5cm]standalone
                        begindocument
                        foreach X in 1,2,...,42
                        begintikzpicture
                        pgfmathsetseedX
                        path[use as bounding box] (-4,-4) rectangle (4,4);
                        clip plot [smooth cycle, samples=8,domain=1:8]
                        (x*360/8+5*rnd:0.5cm+1cm*rnd);
                        shade [ball color=blue!70] (0.5+rnd,-0.5+rnd) circle (3cm);
                        endtikzpicture
                        enddocument


                        enter image description here






                        share|improve this answer






















                          up vote
                          4
                          down vote










                          up vote
                          4
                          down vote









                          A very small addendum to Milo's great answer: sometimes you want the bright spot not to be where shade[ball color=...]... puts it. You could either define your own shading, or, what is perhaps simpler, clip a circle with a shifted center against that shape. The following animation is supposed to give you an idea what's possible. In the end, you will have to decide on your own what looks realistic, or switch to asymptote, which computes realistic shadings for you.



                          documentclass[tikz,margin=0.5cm]standalone
                          begindocument
                          foreach X in 1,2,...,42
                          begintikzpicture
                          pgfmathsetseedX
                          path[use as bounding box] (-4,-4) rectangle (4,4);
                          clip plot [smooth cycle, samples=8,domain=1:8]
                          (x*360/8+5*rnd:0.5cm+1cm*rnd);
                          shade [ball color=blue!70] (0.5+rnd,-0.5+rnd) circle (3cm);
                          endtikzpicture
                          enddocument


                          enter image description here






                          share|improve this answer












                          A very small addendum to Milo's great answer: sometimes you want the bright spot not to be where shade[ball color=...]... puts it. You could either define your own shading, or, what is perhaps simpler, clip a circle with a shifted center against that shape. The following animation is supposed to give you an idea what's possible. In the end, you will have to decide on your own what looks realistic, or switch to asymptote, which computes realistic shadings for you.



                          documentclass[tikz,margin=0.5cm]standalone
                          begindocument
                          foreach X in 1,2,...,42
                          begintikzpicture
                          pgfmathsetseedX
                          path[use as bounding box] (-4,-4) rectangle (4,4);
                          clip plot [smooth cycle, samples=8,domain=1:8]
                          (x*360/8+5*rnd:0.5cm+1cm*rnd);
                          shade [ball color=blue!70] (0.5+rnd,-0.5+rnd) circle (3cm);
                          endtikzpicture
                          enddocument


                          enter image description here







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Aug 31 at 21:14









                          marmot

                          56.2k461122




                          56.2k461122



























                               

                              draft saved


                              draft discarded















































                               


                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function ()
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f448727%2f3d-emulation-with-tikz%23new-answer', 'question_page');

                              );

                              Post as a guest













































































                              Comments

                              Popular posts from this blog

                              What does second last employer means? [closed]

                              List of Gilmore Girls characters

                              Confectionery