1. NOTE: These forums are no longer used. Please use Discord instead.

Overlay function

Discussion in 'WorldEdit' started by Middlestitch, Apr 8, 2015.

  1. Middlestitch

    Middlestitch New Member

    I'm wondering if it's possible to use the overlay a terrain with an image schematic created in something like Spritecraft. I am trying to apply an image of roads to a terrain. I have created the terrain using world painter based on a height map and am now trying to apply roads to this for a specific location. i have been able to create a minecraft schematic of the road map using Spritecraft, I feel there should be an easy way to combine the two.

    Can anyone help?

    Thanks
  2. PseudoKnight

    PseudoKnight Well-Known Member Developer

    That's a neat idea, but there's nothing I'm aware of that can do that in WorldEdit at the moment. Someone may have written a script for it, though.

    However, you can use the overlay command or set/replace commands with a gmask to create roads really fast.
  3. Middlestitch

    Middlestitch New Member

    ooh, how does the gmask work?
  4. PseudoKnight

    PseudoKnight Well-Known Member Developer

    Gmask is a mask that applies to most all types of WorldEditing. It lets you be specific with which blocks in your selection or tool will be changed. So a simple example is using "/gmask air". All edits will now only affect air blocks. So "//set stone" will only change air blocks to stone, similar to "//replace air stone". However, it has some fancier features. If you only want to replace blocks under air (surface blocks, essentially), you could use "//gmask <air;!air". If you wanted your brush tool to only affect blocks in a specific region/selection, you could use "//gmask #sel". Here's a list of some mask arguments:

    #existing -- Blocks that are not air
    #solid -- Solid blocks like dirt, not tall grass. These are blocks you cannot pass through.
    #dsel -- Restricts edits to any future region selection.
    #sel -- Restricts edits to the selection you have when you create the gmask. Unlike #dsel, it ignores changes to your selection.
    > -- Above (eg. >stone is for blocks above stone)
    < -- Below
    $ -- Biomes (eg. $jungle will only edit blocks in a jungle biome)
    % -- Percentages. Format example: 20%stone,80%dirt
    = -- Uses an expression, like //gen.
    ! -- NOT (eg. !stone will affect any block that is not stone; !#sel will affect anything outside the selection)
    Last edited: Apr 8, 2015
  5. wizjany

    wizjany Administrator Developer

    in theory, what you want is
    Code (Text):
    //schem load <road>
    //gmask <0,!0
    //set #clipboard
     
    in practice, this might fail when the height changes, since the road schematic is going to be flat. however, you'd likely have to adjust the road for height changes anyway, so try it out.
  6. Middlestitch

    Middlestitch New Member

    Thanks so much. I think I'll find the gmask tool really useful. I'll have a play with it.

    Wizjany, so with that code, would I copy the road schematic to clipboard or does it read a file called 'road'
  7. PseudoKnight

    PseudoKnight Well-Known Member Developer

    Turns out this needs to be:
    //gmask <0;!0
    But as usual I forgot the !0. Heh. I'll update my post above, so no one gets the wrong idea.

    #clipboard can work, but you have to work with it. You'd need to have a 1-layer flat road schematic and a selection that is exactly the width of the road or it'll repeat.

    Middlestitch, that works with anything in your clipboard. Since you said a schematic in your original post, he loaded a schematic into the clipboard in this example. It doesn't need to be called road, as signified by <> which indicate a command argument. So if your schematic was pie.schematic, you'd use "//schematic load pie".
  8. Middlestitch

    Middlestitch New Member

    That's great. Thank you.

    I am using a schematic, was just trying to get my head around the code. I've not worked with schems before (throwing myself in at the deepend, lol), so do I need to select the region before running that code?

    Sorry. I'm slowly learning.
  9. Middlestitch

    Middlestitch New Member

    woohoo! just tried it will a simple, small pattern and it works!!

    Thank you so much for all your help...both of you

    I'll try and remember to post something when I've succeeded with the roads on the topographical map
  10. PseudoKnight

    PseudoKnight Well-Known Member Developer

    Another curvy road example:

    //gmask <0;!0
    //sel poly
    make your polygonal selection over and around terrain
    //set 30%gravel,30%cobblestone,40%stone:5

    As you can see, you can adjust the percentage of materials for a nice randomized/natural road look. It'll fill to the edges, so adding some grass in the percentages might be nice too. Adjust accordingly. (this can affect caves, though, so be careful)

    Using polygonal selections take some getting used to if you can't visualize it. This is where WorldEdit CUI is handy.

    You can instead use a small brush: (//mask as opposed to //gmask only affects the tool you apply it to)

    /brush 25%grass,25%gravel,25%cobblestone,25%stone:5 2
    //mask <0;!0
    now right click with tool to paint road
    Last edited: Apr 8, 2015
  11. Middlestitch

    Middlestitch New Member

    All very cool. Will have a play with those too! Thanks
  12. Middlestitch

    Middlestitch New Member

    The code to paste a flat schematic across contours of a terrain is working great on small test models, thanks

    The problem that I am having now is that the schematics I have from Spritecraft are vertical planes ( x axis and y axis once paste) and I need the schematic to be horizontal (x and z axis) in order to paste it along the terrain.

    i have found the //deform code that will swap the x and y axis but the schematics I have are a whopping 4,000 by 4,000 blocks and so I can't past the full vertical image into the map in order to apply this code.

    Any ideas if the schematic can be rotated to lie flat whilst it's still in the clipboard.
  13. PseudoKnight

    PseudoKnight Well-Known Member Developer

    //rotate can be used before you paste. You can rotate along all 3 axes in multiples of 90 degrees.

    //rotate y-axis [x-axis] [z-axis]
    eg. //rotate 0 0 90

    4000x4000 schematics are not useful in WorldEdit. I suggest you use MCEdit for things of that size. In general I'd advise that you avoid doing anything in WorldEdit that's larger than your server's view distance. The plugin is meant for a live server.

    How is it 4000x4000 on the x and y axes?
  14. Middlestitch

    Middlestitch New Member

    Thanks for another quick reply.

    I was trying to avoid using MCedit just because I struggle with navigating it but understand why you are suggesting it.

    The roads that I am trying to put across the terrain is actually rather ambitious...its the whole of Leeds city!!

    We have made a 1:1 scale topographical map of the area which is now a 20,000 block square minecraft map and I now want to add the roads in the correct locations.

    Each schematic is a cut down version of a series of ordance survey road map images. Perhaps I need to cut them down smaller...or perhaps there's a better way??
  15. PseudoKnight

    PseudoKnight Well-Known Member Developer

    Hm. I mean you could try it. With long operations Spigot will think the server became unresponsive and try and restart it. So you'll want to do it on a test server and make sure the spigot timeout-time is extremely long, if not disabled, and/or turn off restart-on-crash.

    Aligning the roads to the world topography may be tricky. It uses the schematic as a pattern. I remember having issues with that on smaller clipboards, so experiment on a small scale so you know what you're doing first. Maybe it's easier these days as it's been a while since I've tried to use it in a practical application like this.
  16. Middlestitch

    Middlestitch New Member

    I'll check the spigot set up, thanks.

    I've used topographical data and the road map data that are the exact same size, so they overlay exactly which should in theory means it will work but its def all trial and error
  17. PseudoKnight

    PseudoKnight Well-Known Member Developer

    Well, I mean because it's used as a pattern, I've had #clipboard align in unexpected ways. I wasn't able to determine at the time where it decided to start the pattern in the selection. If I shifted the selection over a bit, it would start the pattern in a completely new spot in relation to the selection. Maybe that was an old bug, but it was probably just unintuitive. I determined that it was just useful for repeated patterns not precise mapping, but you may have better luck.
  18. Middlestitch

    Middlestitch New Member

    hmm, ok that's interesting. That could be useful for other projects, as i'm quite interested in pattern generation in general.

    I think it's looking like I'll have to go the MCEdit route. I also think there might be a way of merging a flat map with a terrain map in world painter.

    That bit of code is still great and I'm am def going to play with it...perhaps just not with the 4,000 blocks!!

    I'll let you know how I get on.

    Thanks again
  19. Middlestitch

    Middlestitch New Member

    I have just tested a 250 x 250 block schem. Rotated it to horizontal in MC Edit first then used to //gmask code to paste it along the terrain and it worked!!

    I'll build up to the 4,000 and see how big I can go.