sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    [REQ] Displacement ruby

    Scheduled Pinned Locked Moved Plugins
    32 Posts 14 Posters 4.6k Views 14 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • K Offline
      kwistenbiebel
      last edited by

      It's a nice idea.
      However, I think current Sketchup will have difficulties with the polycount.

      I rather see some advanced uv-mapping tools to get displacement maps on complexer surfaces so we can render displacement with the photoreal render engine of choice.

      But I can understand a displacement2mesh plugin could be useful to people that want to see the displacement in their default Sketchup output.

      1 Reply Last reply Reply Quote 0
      • bigstickB Offline
        bigstick
        last edited by

        What about Didier's heightfield generator script here:- http://www.crai.archi.fr/RubyLibraryDepot/Ruby/em_geo_page.htm
        The documentation is here:- http://www.crai.archi.fr/RubyLibraryDepot/Ruby/Heightfield_gen.pdf

        I tried it because I wanted to generate a rippled water plane, but couldn't get it to work at all. As they say however, "your mileage may vary".

        1 Reply Last reply Reply Quote 0
        • K Offline
          kwistenbiebel
          last edited by

          I didn't know there was a ruby script like that.Thank you for the link Bigstick.

          I just tried using Didiers script (heightfield.rb), but it doesn't do anything at all in my case.
          I converted a greyscaled displacement .jpg texture to a Ascii .pgm pixel image in Xnview (as suggested in the tutorial) and tried to load it through the ruby. Maybe I am doing something wrong, but I couldn't get it to generate geometry out of it.

          As the ruby was created in 2004, maybe it isn't adapted to sketchup 6?

          1 Reply Last reply Reply Quote 0
          • I Offline
            ilay7k
            last edited by

            Didier, thank you
            i have such problem with loading pgm(in skp 5):
            i attach images

            Format; P2 (PGM) Width; 828 x Height; 177 Greyscale; 256 levels.
            Number of points; 16
            Empty mesh initialized.
            Mesh altitude range; 100.0
            Patch Length X; 0.0476058993229746
            Patch Width Y; 0.223693629205114
            Altitude Step Z; 0.392156862745098
            Create group; Yes
            Destination layer; Layer0
            Error; #<NoMethodError; undefined method `*' for nil;NilClass>
            (eval);196;in `hf_create_points'
            (eval);193;in `upto'
            (eval);193;in `hf_create_points'
            (eval);181;in `upto'
            (eval);181;in `hf_create_points'
            (eval);28;in `hf_gen'
            (eval);324
            (eval);324;in `call'
            

            anybodies know any kind console convertor bmp2ansipgm or raw?
            add: i use total commander addition - image lister by ivory


            contains test.PGM and test.bmp

            1 Reply Last reply Reply Quote 0
            • soloS Offline
              solo
              last edited by

              Irfanview can do it, and it's a free app.

              Link Preview Image
              IrfanView - Official Homepage - One of the Most Popular Viewers Worldwide

              IrfanView ... one of the most popular viewers worldwide.

              favicon

              (www.irfanview.com)

              http://www.solos-art.com

              If you see a toilet in your dreams do not use it.

              1 Reply Last reply Reply Quote 0
              • Didier BurD Offline
                Didier Bur
                last edited by

                Hi,

                @unknownuser said:

                maybe it isn't adapted to sketchup 6?

                it is not, you are right. But it could be (one line of code to change...)
                I'm testing it right now. But it is sooooo sloooow !
                This kind of feature requests a C++ prog IMHO.100x100 pixels -> 19600 faces, execution time: 2mn (!)

                DB

                1 Reply Last reply Reply Quote 0
                • Didier BurD Offline
                  Didier Bur
                  last edited by

                  Hi Ilayk,
                  The error comes from that the options providers have changed from SU5 to SU6.
                  If you decrypted the script, go to line 110:
                  u = opt[3][2]
                  and change it to:
                  u = opt[0][2]

                  That's all, it will work after that,

                  DB

                  1 Reply Last reply Reply Quote 0
                  • I Offline
                    ilay7k
                    last edited by

                    strange
                    it's same(can't normally get size of mesh...)

                    Format; P2 (PGM) Width; 1680 x Height; 1509 Greyscale; 256 levels.
                    Number of points; 16
                    Empty mesh initialized.
                    Mesh altitude range; 100.0
                    Patch Length X; 23.4485281358547
                    Patch Width Y; 26.1074792706233
                    Altitude Step Z; 0.392156862745098
                    Create group; Yes
                    Destination layer; Layer0
                    Error; #<NoMethodError; undefined method `*' for nil;NilClass>
                    D;/Program Files/gsu6/Plugins/heightfield_gen.rb;196;in `hf_create_points'
                    D;/Program Files/gsu6/Plugins/heightfield_gen.rb;193;in `upto'
                    D;/Program Files/gsu6/Plugins/heightfield_gen.rb;193;in `hf_create_points'
                    D;/Program Files/gsu6/Plugins/heightfield_gen.rb;181;in `upto'
                    D;/Program Files/gsu6/Plugins/heightfield_gen.rb;181;in `hf_create_points'
                    D;/Program Files/gsu6/Plugins/heightfield_gen.rb;28;in `hf_gen'
                    D;/Program Files/gsu6/Plugins/heightfield_gen.rb;324
                    D;/Program Files/gsu6/Plugins/heightfield_gen.rb;324;in `call'
                    
                    1 Reply Last reply Reply Quote 0
                    • Didier BurD Offline
                      Didier Bur
                      last edited by

                      Ok I forgot this one, line 190:

                      def hf_create_points
                      opt = Sketchup.active_model.options
                      # u = opt[3][2] Version 5
                      u = opt[0][2] # Version 6
                      ...
                      

                      😳

                      DB

                      1 Reply Last reply Reply Quote 0
                      • I Offline
                        ilay7k
                        last edited by

                        again >>Empty mesh initialized. / when i load pgm
                        and errors in opened console(same)
                        i attach latest images
                        i modify as you wrote/but it doesn't work


                        Imagename1.rar

                        1 Reply Last reply Reply Quote 0
                        • K Offline
                          kwistenbiebel
                          last edited by

                          Just checking to see if maybe the heightfield ruby got fixed so it works with SU6 now.
                          I saw some pieces of code in this thread.
                          Are we supposed to put those lines in the existing ruby file? ...and will it work?

                          1 Reply Last reply Reply Quote 0
                          • bigstickB Offline
                            bigstick
                            last edited by

                            Didier, I'm happy to try to modify this script, but first I need to know how to decrypt it.
                            Could you possibly give me some more information and I'll try it.

                            Pity TBD is somewhat occupied just now, else I'm sure he would look at it 😉

                            1 Reply Last reply Reply Quote 0
                            • I Offline
                              ilay7k
                              last edited by

                              I think, Didier can do it, so wait his solution

                              1 Reply Last reply Reply Quote 0
                              • RichardR Offline
                                Richard
                                last edited by

                                Wow have to keep my eye on this one! I'm all for poly over displacement - being a maxwell user I would rather manage my layers in SU than quadruple my render times using displacement!!!!

                                Looking forward to some news on this!

                                [BUILTBRAND.COM.AU](http://builtbrand.com.au/)

                                1 Reply Last reply Reply Quote 0
                                • J Offline
                                  Julius
                                  last edited by

                                  how should i convert a jpg into pgm?
                                  e.g. with irfanview, i have to select "save as"?

                                  1 Reply Last reply Reply Quote 0
                                  • RichardR Offline
                                    Richard
                                    last edited by

                                    Yeah I so hope this thread hasn't become LOW POLY dust!!!

                                    [BUILTBRAND.COM.AU](http://builtbrand.com.au/)

                                    1 Reply Last reply Reply Quote 0
                                    • jujuJ Offline
                                      juju
                                      last edited by

                                      You and me both!

                                      Save the Earth, it's the only planet with chocolate.

                                      1 Reply Last reply Reply Quote 0
                                      • J Offline
                                        Julius
                                        last edited by

                                        yeah, like this topic: http://www.sketchucation.com/forums/scf/viewtopic.php?p=65055#p65055

                                        1 Reply Last reply Reply Quote 0
                                        • J Offline
                                          Jackson
                                          last edited by

                                          Didier's Heightfield Generator script works fine for me- I draw the grayscale map in Photoshop and if I rememember correctly save it out as 8 bit RAW and then the heightfield gen ruby does the rest. It's brilliant for creating terrains in SU without tons of tedious vertice editing or hit and miss sandbox tools. Need a river- A medium soft brush painted across the map takes 2 seconds in PS- sweeeet. 😎

                                          The only real catch is the enormous amount of geometry it creates- 2 triangles per pixel of the map so a 500 x 500 px map will generate half a million triangles regardless of the complexity or simplicity of the terrain. To avoid this I usually export it as obj, polycrunch it in Meshlab and reimport it as 3ds.

                                          I like the cobbled tiling components Pete, they look great.

                                          Jackson

                                          1 Reply Last reply Reply Quote 0
                                          • S Offline
                                            silver_shadow
                                            last edited by

                                            hey guys, dont worry about that "poly count" issue. Sub divide and smooth, yes it makes high poly stuff from simple geometry but SO many people had find use to it, even if it had a high poly generator that is problematic. If this tool can be made, the people that really want to use it, will use it, and those who say i cant use it because my pc cant handle it, so be it. But id say it would be a really awesome thing to have in su.

                                            I have seen these last few months more and more people starting to play with more detailed and higher poly models, and i must say it looks really awesome. A lot of tools were made available that made sketchup turning another page. I use whatever tools i can use to make something work, so id say go for it, i d love to see that tool being developed. 😄

                                            1 Reply Last reply Reply Quote 0
                                            • 1
                                            • 2
                                            • 2 / 2
                                            • First post
                                              Last post
                                            Buy SketchPlus
                                            Buy SUbD
                                            Buy WrapR
                                            Buy eBook
                                            Buy Modelur
                                            Buy Vertex Tools
                                            Buy SketchCuisine
                                            Buy FormFonts

                                            Advertisement