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

    Idea for plugin: Bump Map From Geometry

    Scheduled Pinned Locked Moved Developers' Forum
    29 Posts 11 Posters 7.8k Views 11 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.
    • A Offline
      AcesHigh
      last edited by

      what renderers accept normal maps? I think VRAY only works with bumpmaps right?

      anyway, the Kerky idea above is quite good... with that, I can say its almost useless to create a plugin for the same effect... of course, unless you dont want to have Kerkythea installed on your computer.

      1 Reply Last reply Reply Quote 0
      • A Offline
        AcesHigh
        last edited by

        found another use for this...

        CREATING TERRAIN ELEVATION MAPS, taken from GoogleEarth.

        basically, Terrain Elevation Maps are only easily available to USA.

        You can import GoogleEarth elevation data into Sketchup, but you cant export it as Terrain Data... and you cant export it directly from GoogleEarth either (and Ive found no plugin to do that in GoogleEarth).

        If you could export from GoogleEarth to Sketchup, and from Sketchup to bitmap 256 colors heightmap, you could then import it into Terragen for example, and then create realistic panoramas, that can be imported back into Sketchup/VRAY.

        1 Reply Last reply Reply Quote 0
        • TIGT Online
          TIG Moderator
          last edited by

          Rick

          The Height field Image is a great idea - works quick and easy
          Insert it a Model bounds min Z rather than zero - otherwise weird effects ?
          I can see how to automate all of the steps in Ruby except for the projected texture - eyedropper bit... To use the new 'raw' texture won't project it ? Texture.size doesn't seem to fit ?

          TIG

          1 Reply Last reply Reply Quote 0
          • A Offline
            AcesHigh
            last edited by

            @rickw said:

            A non-ruby workaround (and perhaps the functional basis for the ruby script) would be to have a graded image (black to white) that you insert into your model in the XZ or YZ plane, at zero Z.

            Scale it so the height of the image is the max height of your model, then scale it again to 1.001 (to make sure any flat faces at the top of the model are white).

            When you explode the image, the resulting texture is set to "projected". You can then eyedropper the texture and paint it onto your model for a perfect grayscale heightfield indicator.

            Go to a non-perspective orthagonal view and export the image, then crop it in your photo editor.

            [attachment=1:2s7p1am7]<!-- ia1 -->heightfield image.png<!-- ia1 -->[/attachment:2s7p1am7]

            haha, thats awesome simply! And quite smart!

            I wont have time to test this weekend, but next week I will try to import a GoogleEarth image into Sketchup, apply your technique and export a heighfield image into Terragen to generate a terrain. Lets see if the generated terrain keeps the same geometry from the GoogleEarth image.

            1 Reply Last reply Reply Quote 0
            • R Offline
              RickW
              last edited by

              A non-ruby workaround (and perhaps the functional basis for the ruby script) would be to have a graded image (black to white) that you insert into your model in the XZ or YZ plane, at the model's lowest Z point.

              Scale it so the height of the image is the max height of your model, then scale it again to 1.001 (to make sure any flat faces at the top of the model are white).

              When you explode the image, the resulting texture is set to "projected". You can then eyedropper the texture and paint it onto your model for a perfect grayscale heightfield indicator.

              Go to a non-perspective orthagonal view and export the image, then crop it in your photo editor.

              heightfield image.png


              tutorial file for above explanation

              RickW
              [www.smustard.com](http://www.smustard.com)

              1 Reply Last reply Reply Quote 0
              • Chris FullmerC Offline
                Chris Fullmer
                last edited by

                I've made a color by z plugin that is also helpful.

                301 Moved Permanently

                favicon

                (www.sketchucation.com)

                It does run into problems though because it determines what color to paint a face based on the center point of the face. So faces that are very tall get only a single color, even though it might run the whole z distance of the model. The plugin could be update to slice the model 256 times horizontally to make sure that all faces get the right z color.

                Also, since this was one of my first scripts, I'm sure theres lots of room for improvement in the script 😄 Also, its a bit slow because it takes SU a long time to create each new material.

                Chris

                Lately you've been tan, suspicious for the winter.
                All my Plugins I've written

                1 Reply Last reply Reply Quote 0
                • R Offline
                  RickW
                  last edited by

                  @tig said:

                  Insert it at Model bounds min Z rather than zero - otherwise weird effects ?

                  That's true. I did make a bad assumption that models don't go below zero, and that's just not necessarily true. I'll adjust my instructions. 😄

                  EDIT: One also needs to adjust the shadow settings: Either turn on shadows or turn on "Use sun for shading", and set both the light & dark sliders to 100. It also helps to use noon on 3/21 (or 9/21) at a location near the equator.

                  RickW
                  [www.smustard.com](http://www.smustard.com)

                  1 Reply Last reply Reply Quote 0
                  • TIGT Online
                    TIG Moderator
                    last edited by

                    The brilliance of Rick's method is that there's only one new material added and that's scaled to the model extents in the Z. The only stumble is how to use it as a projected texture...

                    To 'colour' things in the Z you could have a texture that's 'spectral' in the Z, rather than a black-to-white gradient...

                    If you get the facemade by exploding the imported/transformed image and then mat=face.material, does this then work as projected when used for all other faces faces.each{|face| face.material=mat} ?

                    TIG

                    1 Reply Last reply Reply Quote 0
                    • R Offline
                      RickW
                      last edited by

                      I just did a quick test. Results:

                      1. You don't get any resulting entities passed when exploding an image. Workaround: add the image to a disposable group, explode the image inside the group, then explode the group and collect the results (exploding a group or instance does return results).

                      2. The exploded image will be projected (as expected - duplicates the manual behavior)

                      So, scripting this is good to go. All I would add is creating a new "Bump Map" style and a "Bump Map" orthagonal top-down scene tab with that style applied.

                      RickW
                      [www.smustard.com](http://www.smustard.com)

                      1 Reply Last reply Reply Quote 0
                      • R Offline
                        RickW
                        last edited by

                        TIG - good suggestion

                        I may have some time this weekend to knock something out.

                        RickW
                        [www.smustard.com](http://www.smustard.com)

                        1 Reply Last reply Reply Quote 0
                        • Al HartA Offline
                          Al Hart
                          last edited by

                          We created a prototype of a routine to generate a bump map from SketchUp geometry and showed it to some folks at SketchUp about two years ago.

                          http://wiki.renderplus.com/images/thumb/d/d3/Rock-bump-images.jpg/640px-Rock-bump-images.jpg

                          Our idea was to create bump maps of background geometry - say windows and other detail on buildings in the background, so that the geometry could be rendered as a bump map using fewer polygons in the model.

                          Al Hart

                          http:wiki.renderplus.comimageseefRender_plus_colored30x30%29.PNG
                          IRender nXt from Render Plus

                          1 Reply Last reply Reply Quote 0
                          • TIGT Online
                            TIG Moderator
                            last edited by

                            @rickw said:

                            I just did a quick test. Results:

                            1. You don't get any resulting entities passed when exploding an image. Workaround: add the image to a disposable group, explode the image inside the group, then explode the group and collect the results (exploding a group or instance does return results).
                            2. The exploded image will be projected (as expected - duplicates the manual behaviour)
                              So, scripting this is good to go. All I would add is creating a new "Bump Map" style and a "Bump Map" orthogonal top-down scene tab with that style applied.

                            I recommend this slightly different way:
                            Insert the image [from file] and rotate/scale-transform it [using model.bounds maxZ-minZ+~1% for its 'height' and putting the image's bottom at minZ, 90 degrees etc]...
                            Add a group to the model: group=model.entities.add_group(image).
                            Explode the image inside the group and leave it there - don't explode the group itself - if you do some of its raw geometry edges might clash with the model's edges on their final erasure.
                            So, find the group's only face: group.entities.each{|e|face=e if e.typename=="Face"}.
                            Get the face material - material=face.material
                            Do the material changes to the model [global material changer et al] as needed.
                            Set up an appropriate scene and style.
                            Finally erase the original image's group to tidy up - having avoided raw geometry clashes...

                            Presumably the new 'Bump Map' style will have no edges, no shadows, no fog etc.
                            The top scene+zoom_extents is relatively easy to do [for you]...

                            Waiting for your solution with considerable interest...

                            TIG

                            1 Reply Last reply Reply Quote 0
                            • A Offline
                              AcesHigh
                              last edited by

                              wow, thats quite interesting, Hart

                              1 Reply Last reply Reply Quote 0
                              • thomthomT Offline
                                thomthom
                                last edited by

                                Has that made it past prototyping?

                                Thomas Thomassen — SketchUp Monkey & Coding addict
                                List of my plugins and link to the CookieWare fund

                                1 Reply Last reply Reply Quote 0
                                • Al HartA Offline
                                  Al Hart
                                  last edited by

                                  Send me a model you want to try, and I will create a sample bump map.

                                  I will run the bump map through IRender nXt, and perhaps you can show what it does with another rendering or Photoshop rendering.

                                  Al Hart

                                  http:wiki.renderplus.comimageseefRender_plus_colored30x30%29.PNG
                                  IRender nXt from Render Plus

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

                                    Hey i just found this thread in my search for an easy and effective way of generating a gray-scale height-map from a Google sketch up terrain, for importing into a sandbox editor such as unity or the cryengine. I was enjoying the thread so far but it seems to have gone dead, has it moved else where.?
                                    Al Hart will you be making your plugin available.?

                                    1 Reply Last reply Reply Quote 0
                                    • Al HartA Offline
                                      Al Hart
                                      last edited by

                                      Upload a sample model, and I will see if I can find the utility to create a bump map. The model should be just the terrain, because I create the bump map by rendering the model from a top view, retaining the Z-values, and then using them to create the bump map.

                                      Al Hart

                                      http:wiki.renderplus.comimageseefRender_plus_colored30x30%29.PNG
                                      IRender nXt from Render Plus

                                      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