Each terrain object creates one mesh that uses two materials. They do batch perfectly in most cases, exceptions being pretty standard Z-order issues with sandwiching transparent objects of different materials.
If you’re only using one terrain material in the scene, it takes 2 draw calls, regardless of how many terrain objects (so long as they’re static). An additional terrain material will increase draw calls by 2 at least, but in complex scenes with weird z-order, it’s sometimes a little more than that.
Really liking this thread and tool. Congrats.
Can you explain the math for how you breakdown your image sizes to then input as numerical values. HW etc.
Is there an optimal system for breaking it down?
I usually lay out a grid or guides when I’m drawing my material, that way I can get my segments to line up properly. Once I’m done drawing, I’ll usually copy/paste a section, line it up with another section, and modify it until it lines up well, and then I repeat with all the other segments. Another thing you could do, is draw the intersections first, and paste those around, so you know all the intersections are the same.
In this case, I decided on a texture size of 512x128, something pipe-like with enough room for me to have a couple of middle segments. I wanted body segments to be square, 128x128, so I had enough for 3 body pieces, and then I split the rest of it into two for the caps, 64x128 each.
Creating it is the tricky part! The numbers are usually way easier. If you haven’t seen the terrain material creation video tutorials, you might want to take a look at those too. http://youtu.be/_V9v2RXkUog http://youtu.be/TYQSuhsyCDE
There’s no real optimal system for it, just try not to waste too much texture space, and exclude as many transparent pixels as possible!
I’m also working on a better tool for creating the materials, but that won’t be for a bit yet. I may work on that this weekend, try and get something for the next update? That might be a little ambitious, we’ll see.
Haha, I’ve been meaning to pick up Uni2D, it look AMAZING! I’ve been trying very hard to restrain myself from writing Uni2D features from scratch, it’s at the very least an inspiration to me ;D
Hey man, great tool. We’ve been loving using it so far.
Something I’m curious about is the ability to turn collision on / off for different edges of a particular terrain, so we could have a section like this that our character can walk past but jump up onto without having to create our own collider objects:
Just thought I’d give an update. I’ve been working on improving the Terrain Material editor, and I’ve got a bit to show for that! It’s not 1000% better, but it’s a good incremental improvement.
An example of simple mode. Way fewer variables to deal with, and a single draggable box! This one will only work if your segments are ordered properly (Left cap, body segments, right cap all on the same row) but I figured that would probably be a common enough case to take it into consideration.
The regular mode, where regions aren’t locked together. You can drag each region around and get a preview of how everything will line up in the top left. The preview displays body segments in reverse order, so you get a better idea of how they’ll loop.
Longer term, I’m also thinking about adding an auto-atlas option, where you can have each segment as a separate image, and it’ll assemble the texture and segment definitions for you automatically. However, the stuff you see here should be in the update I’m planning on submitting Monday!
I have had fun this evening messing around with this tool.
Is there any way we can get randomized end caps using the same system as the body in a future update? This would be a nice addition.
Building on that… the optional ability for the terrain Path to detect ~90deg (variable as well maybe) concave sections, and apply a specific alternate cap would be nice as well. I haven’t had the chance to grok your scripts yet, so I am not sure how big of a pain this would be at this time. Manually adding a masking sprite as a child of the terrain object works in a crutch though, so this is more of a convenience thing.
Good job on this. It is very well done, and already has that “polished” feel.
The other bit, I think I’m having a little trouble conceptualizing, are you talking about having a different corner image for a Right->Bottom edge transition, and a Bottom->Right edge transition? I do have an idea for a different edge/corner model that would cover that, but it’s different enough to require a different type terrain material, so I need to plan out how I do it.
Either way, I’m glad you’re enjoying it! Thanks for the feedback~
I just submitted an update to the Asset Store! It’s not up yet, but I’ll let you know as soon as it is. You’ve seen most of these already, but here’s the full change list:
Terrain Materials
-Added context menu to the project window for creating new Terrain Materials!
-Moved the Terrain Material editor into its own window, various and sundry improvements there.
-Added a ‘simple’ mode to the TerrainMaterial editor, should be easier to create common case materials Path Terrain
-Added physics material slot, since MeshColliders are generated at runtime
-Added new fill types, Fill Only Closed, and Fill Only Skirt
-Added option for disabling collider meshes along specific directions
-Collider mesh no longer includes faces that point down +Z and -Z, as they’re not important to 2D collisions, and it’s much faster without. Path
-Path GUI now scales properly with GameObject
-Fixed an issue with button hotspots being too large when zoomed in
I actually did manage to fit this in for the update =D I was chatting with hea, and he pointed me to some excellent resources that made it super trivial to do~! (Thanks hea!)
Next small update will definitely have random caps! Sorry I didn’t get that in this time around =/ If anyone spots bugs, or can think of other features they want, lemme know, and I’ll get cracking!
The next major update will probably be a little further off, as the features I’m planning on adding in will be a little larger in scope than these small tidbits. Off the top of my head, some ideas I’m tossing around are: major transparency optimizations (should include auto-atlasing materials and a better sprite system as a byproduct), drag-select path editing, and a better corner material system. I’m sure I have more ideas written down somewhere, but that’s plenty enough as is =D
And I’ll try and spend some time doing more tutorials this week! I meant to do some of that over the weekend, but I hope you won’t argue with these features as a consolation prize ;D
Hi koujaku!
I Just purchased the tool and I was wondering if you could add a drag and drop thing to adjust material parts. So glad to see that you’ve just did it ! xD.
Can’t wait for the update !
I saw the asset store taking so much days before publishing an update so I hope it will not take too long
When I was going through the initial submit for it, the fastest they got back was about 3 day, and longest was a whole week. Definitely better than Apple, that’s for sure! I’ve got my fingers crossed too ;D
I don’t know how much of the layout will change with the new updates, but can the “Use Top” check boxes be moved a little further from the collapsible arrow in the material inspection window?
I don’t know how many times now I have went to collapse/expand a section only to click this instead, and loose all the information within.
Oh ouch, I haven’t had that happen to myself yet, but I could definitely see that happening. It’ll keep that in mind, and do something to catch that in the next update!
ok just to show what this tool can do with some pre-design. Have to give credit to idTaken for showing me how to do the corners properly. this is a level from my own game, and this worked wonders so we are using this tool now to build all levels main grounds, then adding 2dtk decor ontop and wherever we need it.
as u can see, its pretty flawless if u spent enough time on laying out the atlas and defining. i painted these to fit eachother ofcourse and they are seamless.