[Released]Terrain Slicing Neighboring Kit

This thread is no longer used, please use this thread if you have any questions or want the latest updated information on the Terrain Slicing & Neighboring Kit

1118563–76078–$whats_included_and_where_to_find_it.txt (4.59 KB)

Can u explain the benefit of slicing?

Mobile / streaming.

This sounds absolutely fantastic. Good job. I’ll end up using this.

There are a couple of benefits I can think of, and as RazorCut noted, streaming is one of them. If you want to stream terrains, you of course will need separate terrains. The issue most people run into is with this is that it’s a challenge to create individual terrains that fit together perfectly, so there are no visible seems along terrain edges. This is where the slicing tool comes in. Instead of creating separate terrain pieces and stitching them together, or using some other method for making the edges match up, you can simply create a single terrain and then split it up into smaller pieces. The smaller pieces are simply replicas of a portion of the original terrain, so the edges match up exactly.

I would think normally if you were creating multiple terrains that fit together, you might be limited in the tools you can use to shape these terrains, as too much variation might make it impossible to match edges up. For instance, I would find it incredibly difficult to use the Terrain Toolkit found at http://unity3d.com/support/old-resources/unity-extensions/terrain-toolkit to shape 4 different terrains individually in a way that would allow them to stitch together or match up. With the slicing tool, however, you just have to use the toolkit (or other terrain tool) once on your base terrain, allowing you to abuse the tool to your hearts desire. The resulting terrain slices after slicing will still match the original terrain, no matter what it looks like.

Finally, using the slicing tool will enable you to create semi-different SplatMaps for the individual terrain pieces. Just limit your original terrains SplatMap to less than 4 textures, and after slicing each terrain will have slots open to add more textures. So for instance if you have two textures on your original terrain, each slice will have 2 texture slots open for their SplatMap. Of course, you will need to avoid painting the terrain edges, as it will make where the edges are obvious.

There are additional benefits I’m sure I’m forgetting/missing. I am by no means a pro at this Unity thing.

FYI, I have created a tutorial video showing how to use the slicing tool. This should have the added benefit of showing that the tool does indeed work (haha). Feel free to ask away if you have any other questions or concerns.

The video can be found at this link: http://www.youtube.com/watch?v=dGgYCED80ZU.

I plan on doing a similar video for the neighboring tool.

In addition, I have resubmitted the toolkit from Unity 3.5, so the requirement should be lowered as soon as the asset people approve the update. Unfortunately I had to comment out two lines of code referring to the Terrain member 'materialTemplate," since terrain materials were only introduced in Unity 4.0. All the guides provide instructions for finding these lines of code so 4.0 + users can uncomment the code. Strictly speaking, if you don’t use terrain materials then there shouldn’t need to uncomment the lines, but I still recommend doing so in case you use them in the future.

Thank you Razor for the endorsement! If you do end up buying the kit, it would be awesome if you could add a review on the asset store (that’s if you like it ;)). If you don’t (which means you’re having some sort of trouble), don’t hesitate to contact me via these forums. I don’t foresee anyone running into any trouble, but you never know.

Finally, a quick reminder: You can find all of the instructional guides on my website here.

Just to clarify…the terrain geometry will be seamless, but the splats/textures will still show borders since they can’t read between terrain splats to blend, is that correct?

At first I wanted to say that no,that is not correct; Splatmap/textures will blend together. But after further testing it does appear that you are correct with your statement, at least most of the time.

The edges between splat maps will become more evident with smaller control texture resolutions (or conversely larger terrain sizes). Using more textures on your base terrains splat map will also make edges more evident. Finally, dividing your base terrain into more slices (producing 16 vs 4 slices, for instance), will also make edges more evident, since the resulting terrain slices will by necessity have smaller control texture resolutions.

If you use a large control texture resolution and minimize the number of textures used in your base terrains splat map, often times the edges will not be visible (which is how I missed this problem to being with!).

If you do notice edges, you can delete the terrain slices and manually paint your base terrain at the trouble spots, so that only one or two textures are being used on that area (which will eliminate the blending Unity does). Then re-slice, and check if the edges have disappeared.

Okay, a quick update:

I think I may have thought of a solution to the alphamap/splatmap blending problem. I have tested this on a pretty basic terrain with a control texture resolution of 32, and it seems to work.

If the darker green box on the left represents the last splat map square on one terrains alpha map, and the lighter green square represents the first splat map square on a terrain sitting next to the first terrain, I have found that setting these two values to use the same values makes their blending the same, and thus it flows together and produces no visible seem between the two.

Unfortunately for this to work I’ll have to find the average between the two squares (or four squares for terrain corners where four terrains meet), and replace each square with this new average, which means part of the base terrain is changing. My guess is that this change will be very small and hopefully not very noticeable.

I still have yet to test this on a more complex terrain, but as soon as I do so I’ll let you know how it’s working.

Aha, I think I’ve got it! I’m going to conduct some further testing, but for now it seems as though this new script I wrote works. It’ll be added as an option to the slicing tool, as well as a standalone script in case you want to blend terrains you’ve created yourself.

Here’s two pictures showing four terrain pieces along their edges before and after blending.

Very nice!

Another update : After conducting some more testing I found another issue with the slicing tool. In my testing, I consistently used a solid color as my terrain textures, which led me to miss a problem that arises when using a non solid texture, for instance, a texture which is suppose to represent pebbles and has small circles on it for this reason. Each terrain’s texture has a tileSize (x and y) and tileOffset (x and y).

If your terrain width is 1000 and you set your texture tileSize to 200, this means the texture will be huge and repeat only 5 times across the terrain, sort of like this: <><><><><>. If we want to cut this terrain in half, we want the two new terrains to have a texture pattern like this:
1st terrain: <><>< ><><> - 2nd Terrain, so the two terrains side by side look the same as the base terrain <><><><><>.

However, currently each terrains texture map simply starts over at the beginning, so our two terrains look like this:
1st terrain: <><>< <><>< - Second Terrain, and the two together look like <><><<><><.

Luckily, I have already found and implemented the solution, which is simply to offset all the terrains’ textures (except the first) by a certain amount, based upon the base terrains tileSize, the new terrain slices width/height and where the terrain slice lies on the output grid.

So have no worries if you decide to purchase the kit and find your terrains not fitting together as nicely as you hoped. I will be updating the kit within the next few days (will be v 1.2) with this fix (as well as the blending option/tool mentioned previously). Judging by how long my latest update is taking to be approved by the Asset Store people, it will probably be a week or two before v 1.2 is live.

As you can probably tell, I’m no good at testing. At the start, I wasn’t really a terrain expert (though I’m slowly becoming one I fear! Haha), so there are things I just didn’t think of to test. Hopefully you guys can see how quick I am to identify something as an issue and think up and impalement a solution!

Another update, for anyone who cares! I’m continuing the testing process to try and make sure there are no more issues before releasing v 1.2, like there have been for the initial release. Remember, you can contact me for solutions to the known issues if you can’t wait for v 1.2 to be released.

I’ve also introduced a new feature (nothing too exciting). Currently the slicing tool takes all the tree prototypes and copies every single one of them to each new terrain slice, regardless of whether that slice actually has a tree painted on it. I haven’t removed that functionality; instead, now you will be given a choice of whether you ONLY want to copy the prototypes to a terrain slice if that slice has the tree painted on it. That way, even if you have 15 tree prototypes on your base terrain, if you only use one of them on the section that will become your first slice, only that one prototype will be transferred to the new slice. Basically it’ll reduce memory usage (which I doubt is that big of a deal), and make the prototype list for each slice smaller and thus easier to navigate.

That functionality has been added already. I plan on doing the same for detail meshes tomorrow.

In addition, I have improved the look and functionality of the slicing editor window. New tooltips have been added to each menu option, and they are very descriptive (they appear when you hover over a menu option’s label). My hope is that these tooltips will be descriptive enough that you can use the slicing tool without having to look in the instructional guides.

Here’s a picture of the new window with a sample tooltip.

Hi guys, I have created a little demo. It’s just a scene with a base terrain and 4 terrain slices. You can move each of the terrains up and down, which will allow you to compare the original terrain with the terrain slices (includes trees and grass so you can compare those too).

If you purchase the kit, you will not see results as good as this demo showcase, simply because the demo includes the blending and tiling fixes mentioned in my previous post, which have not been updated to the Unity Asset store yet. You can always contact me and I’ll provide you with the fixes though!

The demos are in the form of a Windows and Mac standalone build. The webplayer build was incredibly large, which is why I didn’t use it.

Here’s the Windows Demo
Here’s the Mac Demo

V 1.2 has been submitted. v 1.1 still hasn’t been approved, so it’ll probably be a week or two before 1.2 is available. You can see my new logo design at the top of this page. What do you think?

I’m happy to report that v 1.2 have been approved, and the updated version of the kit is now available on the Asset Store.

This version has several fixes and updates.

  1. Unity version requirement lowered from 4 to 3.5. Unity 4.x.x users will need to perform a couple of easy task to enable certain functionality (see below).

  2. Visible seems between terrain slices due to incorrect handling of texture tiling has been fixed.

  3. Visible seems between terrain slices due to incorrect handling of Unity’s automatic alphamap blending has been fixed. Or I should say, it can be fixed if you select the option in the slicing window. In virtually all cases you’ll want to use this option (It’s called “Blend Alphamap Edges” in the window), but because it makes some small changes to the look of your terrain, I put it in as an option so it’ll be your choice. I promise, the changes are hardly noticeable. There’s a post on this page where I discuss this more thoroughly.

  4. Changed layout of slicing tool, and added tooltips to increase ease of use.

  5. New SliceTerrain.txt file added that has functionality for 4.x.x users. They simply have to delete the current SliceTerrain.js file and open/re-save the SliceTerrain.txt file as SliceTerrain.js. New .txt file added informing 4.x.x users what they have to do. New instructional guides added for using blending tool.

  6. Added a new blending tool. This can be selected from the Terrain menu at the top of Unity. It uses the same Auto Fill algorithm as the SetNeighbors/SetNeighborsEdtior scripts so you can select a large group of terrains with minimal effort. Using the tool is exactly like using the SetNeighbors script, except you’ll have to select the first terrain in your terrain group (since this script isn’t dragged onto the first terrain like the SetNeighbors script). The blending itself is the same blending that has been added as an option to the slicing tool.

The use of this tool is two fold. If you want to try and slice a terrain without blending, you can do so, and if you don’t like the results (you can see visible seems between terrains), you can then use the Blending tool to blend the terrain slices.

Secondly, you can use this tool on terrains not created with the slicing tool. Keep in mind, however, that for the blending to work, all of the terrains you wish to blend must have the same control texture resolution, and use the same splat map(s). This means the textures on the splat map must appear in the same order under “Paint Textures” for each terrain. This is automatically the case for terrain slices.

Enjoy!

In case anyone is wondering about future updates to this kit, here’s some news.

I’ve designed a nifty little editor tool that makes making prefabs really easy. I designed this primarily for the terrain slices created after slicing a terrain. You’ll be able to use an Auto Fill button to select all the terrain slices easily, like in the SetNeighbors and BlendEdges scripts. The prefabs will be created in a Resources folder, but you can obviously move them afterwards.

I made sure the script works with non terrain objects (or terrain objects not part of a terrain group) also. When you open the CreatePrefab window, there’s an option (Is Terrain Group) you can deselect if the objects are not part of a terrain group. When this option is deselected, the window will change to work better with objects.

The main difference is the “Auto Fill . . .” button is replaced by a “Fill From Selections” button. Simply select objects from your scene and click this button to have them magically appear in the fields below the button. The number of fields will expand/shrink automatically to reflect however many objects you have selected.

The reason I created this tool has to do with my next update.

I’m currently working on a dynamic terrain loading system that is based around loading terrain prefabs from either the Resources folder or an asset bundle. The CreatePrefab tool was designed with this purpose in mind.

The script will have you select which method to use (load from resources or asset bundle). I’m hoping to allow you to have unusual terrain configurations, for instance if you have a 4x4 grid with 16 possible terrains, you won’t necessarily have to fill each spot with a terrain. You might have 4 empty spots in the middle, like this for instance:

xxxx
xoox
xoox
xxxx

where the o’s are empty areas and the x’s are terrains.

Once I finish these two systems I’ll update the kit. The second system might take a week or two, so I’m thinking of just updating the kit with the CreatePrefab tool immediately.

Enjoy!

would it be possible to cut terrain it into thin strips and edit in order to use with a 2D game, some thing like this:

http://forum.unity3d.com/threads/99072-E2D-free-2D-terrain-editor-and-generator

I’m not 100% sure what you want to achieve, so please let me know if the following doesn’t fully address your question.

You can certainly cut a terrain into thin strips, but I’m not sure you will be able to edit them like you want. Let’s talk about creating thin strips first, however.

Start by creating a terrain that is long in the x direction but short in the z direction, i.e., one with a large width but small length in the Set Resolution window.

Something like this:

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Then slice it by however many strips you need, i.e., 2x2 for 2 strips, 4x4 for 4, etc. This will leave you with something like this:
xxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxx (the space between slices won’t be there in the actual Unity scene)

It sounds like you will only need the slices on the bottom row for a 2d game, and these slices will always end with _1_x (where x is the slices column). So just delete all the terrains that don’t have this ending, and you should have the thin slices you want.

Now for the editing part. You can only edit these terrain slices in the same way as you edit other terrain. Therefore, you won’t be able to create upside down terrains like with that other tool you linked. Second, if you edit the edge of a terrain slice, it will no longer match up perfectly with the slice next to it, so I recommend doing all your editing on your base terrain before slicing.

I’d recommend creating a terrain yourself and getting it to look like however you want your game to look. If you’re successful, then this slicing kit might be able to help you. I can’t say for sure, as I’m not really positive what your goal is.

If you’d like to provide some more details on what you’re trying to achieve, I can hopefully provide you with a more clear-cut answer on whether this tool can help you.

Also, I see the tool you linked is free, so can I ask why you don’t want to use it to create your 2d game?

Thanks for your interest!

Thank you for such a detailed reply!!, I’m not sure about the free E2D tool, it is very limited and specific however i am interested in this tool. I may have to purchase it, it seems like a pretty useful tool that might come in handy later!