godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.16k stars 97 forks source link

Suggestion for a hex-based terrain editor option . . #2761

Open charlesmlamb opened 3 years ago

charlesmlamb commented 3 years ago

Describe the project you are working on

A Tomb raider game . .

Describe the problem or limitation you are having in your project

I've been looking at Zylann's terrain editor, and I know Godot at some point, will get a terrain editor . . Wanted to share a ' cool ' idea, for consideration . . . Thx . .

Made a tiling hex painter in Blender, so one can 'paint' tiling hex textures, very fast . . it could be exported to say ArmorPaint, the basic tile painter mesh, so one could make square textures, PBR, into hex tiling textures, with normal maps, etc . . The reason is, currently Zylann's terrain editor uses squares, that have been 'triangulated', in a cool way, but the distance between 'each' point is not equal . .

2021-05-23 1314

Here's a hex based mesh, and it's quite easy, to make tiling textures, takes 5 minutes to set up, in Blender . .

Skærmbillede (1813)

That would give well, a constant distance, between each point, and give perfectly smooth curves, and slopes . . Here's a 'bad' example . . 2021-05-23 1308

My proposal is, that Godot gets a new ' mesh ' type, a hex-grid plane, where one can set number of hexes, left, right, and make a hex-grid, then one could export it as a 'scene', with new exporter to Blender, and sculpt it, for some nice terrain . . It'd be the ideal ' terrain ' editor, EXCEPT many people use square textures, that's where the problem is . . Anyway, it'd give Godot a world-class terrain editor, prob. best available, less the fact, not all people know how to make the 'tiling' hex textures, but it's SUPER - easy, in Blender, and will work in ArmorPaint, for making tiling hex PBR textures ( ie., with correct normal map, roughness, from a square image ) . . Well, I realize it's a bit weird, I just think this solves some ' mathmatical ' problems with square based terrain, and it could be an addition, so one could work BOTH in squares and, also hexes . .

Video, how to set it up, took me 5 minutes, with some practice . . . https://www.youtube.com/watch?v=WEqOynmVpDo ( 5 minutes )

THEORETICALLY, it'd be the ideal way, of making terrain, at least smooth, equi-distant terrain, where each point, or face, has the same width, and length, and so give ' best ' look, of the surface . . I know it's a bit weird, just a thought, not many use it, due to square textures being more common . . but, a HEX based surface, would make sense for terrain, and also certain game-play situations, esp. if it could be exported to Blender, for ' extra ' work . . . .

2021-05-23 1322

I know the engine contributors are planning a terrain editor, wanted to give this ideas, as something that COULD be added, it'd be the ' ideal ' terrain editor, mathmatically, and it's very easy, to make the tiling textures . . Thx . .

Describe the feature / enhancement and how it helps to overcome the problem or limitation

Well, add the ability to make a hex-grid surface, like a new ' mesh ' type, like cube, sphere, and have the user set it up, with some parameters, size of hex-radius, number of 'repeats', x-z direction . . so, that's step one, such a ' grid ' would also be useful, in games that make use, of a 2D hex-map, say for ' travel ' or, bigger maps, or so . .

Then, add it to the ' terrain ', as an alternative, to square based grids, since it'd give the ' best ' terrain look, from all angles, etc . . since each point, like on a square map, has a coordinate, one could make a 'modified' height map, that stored the data, each point, basically, it'd be two rows, and colums . . It's just a cool idea, maybe the engine could use it, when it makes the terrain editor, many games use hex-grids, for big maps, or ' long ' travel distances . .

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

Well, maybe this is something for Zylann, since he's already done an amazing job, there are down-sides to it, but making the tiling hex grids, is super fast, also, the textures, even with albedo-normal-metal-rougness, from a classic texture . . It'd be the ' ultimate ' version, of a terrain editor, from a 'math' perspective . .

If this enhancement will not be used often, can it be worked around with a few lines of script?

Well, it's just an idea, also for making something 'different', that'd also be ' optimized ', to look good, from all angles . . since Blender can't make these grids, at least by 'default', if one could make a new meshtype, in Godot, then use the scene exporter, to Blender, it'd be REALLY fast, to make say a 512 x 512 m hex grid, move to Blender, sculpt it, re-import it or, make it an extra mode, for Godot's up-coming terrain editor, don't know when it's planned, might be a year, more . . .

Is there a reason why this should be core and not an add-on in the asset library?

Well, it'd be the ' ideal ' terrain, down-side is one can't download many hex - based textures, but one could simply start uploading them, after making them in Blender, to texture sites, or make a plug-in, that has some example, not sure . .

Sorry, I know this is rough, and also ' new ', it would be the ideal terrain ' system ', mathmatically, wanted to ask, if you thought it could be cool, or so . . <3 . .

ps. hear there's plan for a voxel based terrain painter, one could make a hexel based one, and get amazing land-scapes, and terrain, esp. if one could paint say, on it in Godot, with textures, that fit . . last, one might be able to optimize the core textures, to make better use, of the UV grid . . :O . . . rock_01

Note that, even for a .png. uniformly colored pixels are compressed, and don't take texture memory, one might be able to unwrap it, so every pixel was used, not sure . .

it's just a crazy idea, but it'd give amazing terrains, if one could paint on it, say with four different types, of basic terrain types . . Not sure <3 just an idea, atm . . . .

The suggestion is, when you make the terrain editor, consider making this an OPTION, for making terrain, not the only one, Thx <3

charlesmlamb commented 3 years ago

Ideas . .

One could make a simple version, where one worked with a hex-plane, that could be stored, in a 2D texture, as a height map, for basic terrain . . Then, one could also have a ' hexel ' sort of, sculpt mode, where the data was stored, for each game, ie. not increasing base size, of the engine . .

Also, one could prob. make nicer ' ocean ' effects, if one added a displacement map shader, to a 2D hex - grid, or so . .

Last, I think I can optimize the UV unwrapping, so it uses the full grid, and also has smooth pixel flow, across the edges . . :O :O . .

Since the hex tile texture painter isn't really available, one could make that, as a simple editor function, in Godot, to ' round ' off the feature . . then, one could have amazing terrain, and combine it with square modelling, ie. one could make a hole, or so . . that becomes a dungeon, based on squares, so on . . . See the video above, it's so easy to set up, takes 10 minutes, if you've never done it before . . :O :O . . and, if one could export the basic hex - painter ' mesh ', in video . . one could work in ArmorPaint, to paint from, really detailed 2D - square texture stuff . . Well, not sure . . . .

Last, for extra control, if one could select certain faces, and assign ' detail ' decals to them, one could get a very custom and, pro look . . Wanted to make the suggestion, before serious work on the terrain editor began, or so . .

I think it'd give Godot the best possible terrain editor, esp. if it had some nice features, for customizing it, support for 4 different textures, and a ' texture ' painting, blend mode, etc . . <3

ps. maybe it could have optional support, for painting 8 or, even 16 different textures, with variying degree of resolution, perhaps with a slider, or ability to, sort of have MORE textures, in certain places, for a super - custom terrain look . . maybe it can be optimized, so it runs really well, even for larger terrain . . Thx <3 <3 . . . .

Godot Hexel-map editor . . silly name . . . <3 <3

More ideas . . . suppose one could paint, for each hex - grid, how many textures one wanted to blender, so if one had a big area, with grass, paint it, with a value of 1, that could limit data size, and also tell the renderer, this is only 1 texture, for the surface . . then, if one needed to blend 2 textures, for instance for transition from grass, to stone, one could say, this hex has blend, for 2 textures . . that would mean, one could ' store ' the texture information more optimized . .

also, for stuff like waves, that move in different direction, across a surface, it would may-be look more natural . .

2021-05-23 1403

I suppose, one could also better simulate fog volumes, in a hexel grid, since each point, is about ' same ' distance or, so . . .

It'd give the ' best ' looking a terrain, one could combine it with normal, square based 3D models, or so . .

2021-05-23 1405

Well, it has a number of advantages, esp. if there was a square to hex texture painter, as well . . or, some good guides, in the docs, for ' setting ' it up, not sure . . :O :O . . . it'd have to be a small editor, where one could load an albedo, and paint it, like in the video, ' very ' simple, then it's noob - friendly, esp. if one could export the tile mesh to ArmorPaint, for some really nice result . .

So, it'd give Godot a terrain editor, I don't think the other engines have, atm . . and, it'd also look better, ' visually ', Thx <3 . . . .

An idea, silly . . .

charlesmlamb commented 3 years ago

Last, Zylann has this weird ' feature ', where one zooms out, it sort of gets less detailed, from a distance . . one can do the same, with hex-grids, this way . . .

2021-05-23 1423

So, as one zooms out, hexes get replaced, with ' bigger ' hexes . .

Last, one can divide the hexes, into squares, to better use the UV space, here . . . Skærmbillede (1815)

Because each hex, when sub-divided for ' terrain ', is made of 3 squares, they could be unwrapped, to use the full texture - space, not sure . . <3

Know it's weird, was thinking it might be an extra mode, for the hard - core, or if it was made user - friendly, for most users . . Prob. need some good docs, to get started . . . <3

Last, not sure, at all . . . This might look better, if ' simulated ' on a hex-grid . . . 2021-05-23 1429

Also, stuff like fog volumes, based on hexels, etc etc . . . <3

say, for a hexel volume, one could simply increase, or decrease the alpha, of each hexel, to get like ' moving ' smoke or, simple clouds . . .

Anyway, it might be a fun challenge, for pro - coders, to make this work, also 'optimize' it, data storage, not sure . . . Thx . . :O :O . . .

Last, since heightmaps are normally stored, in a grey-scale image, and one would need to store 3D coordinates, for a hexel-voxel based thing, that info, could be stored, in a RGB, where each channel, holds a 3D coordinate . . one could even use the alpha channel, for simple animated deformations, but it'd be on one axis, or so . . :O :O . . . that means, a RGB image, could be used to store, a 3D volume reference, not sure . . Thx . . . . So, one could store 3D hexel information, or voxel, in a series of RGB images, so if one runs out of points, in a 1024x1024 texture, just make a new one, and store more data there . . . <3 <3 it might create some funky looking RGB images, for complex terrain, or so . . . :O . . . . something, like a normal map, that also has a 3D vector info, stored in each pixel . . :O . . using the alpha channel, one could store even more . . .

charlesmlamb commented 3 years ago

Ok, to show it's possible, after setting up the UV's better, one can use the full texture space . . . Skærmbillede (1816)

I can make it into a tiling hex texture editor, in 5 minutes . . Again, this might be 'noob' or, just impossible, would really like some nice terrain, or so . . .

Last, one might need to stretch the texture in one direction, to get best pixel distribution, right now it is 1200x1200, some divided by 3 . . maybe, 1800x1800, it's a number . . however, to get the best pixel distribution, it might have to be 1200x1600 or, so . . .

ok, set it up, here's how it looks, with better UV un-wraps . . .

Skærmbillede (1818)

Skærmbillede (1819)

Skærmbillede (1820)

So, if Godot could make some hex-grids, or hexels, that were unwrapped like that, it'd look nice, esp. if there was a little editor, to make them ' fast ', from normal texture, possibly allowing for painting PBR channels, but that can be done in ArmorPaint, with the base mesh . . .

HEX-Tile02.zip

A blend file, might need to import a texture, I used this one . . . :O :O . .

2021-05-23 1456

Not sure, if it's possible, to make a terrain sculpter, that works in hex or, even hexels <3

here's the UV set-up, after making six hex-grids, just ' joined ' them, and merge the vertices, each new tile, had the same UV's, took 2 minutes . . .

Skærmbillede (1822)

Ok, done . . Something for the people working on, the terrain editor might consider, or so . . .

last, I think if one blended the textures, it'd look nicer, bec. it has a ' more ' rounded look, ie. it'd look more fluid, or so . .

Thanks . . . .

ps. Results look amazing, from a distance, but close up, there is some problems, near the UV edges, maybe if one made a little distance, between them, so there was no confusion, which pixel belonged where . . . Skærmbillede (1823)

So, not sure . . Maybe the other engines already use this, but it'd give nicer results, at least, and would prob. take same amount of space, both for square or, hex grid, and voxel or, hexel <3 . . . .

Ok, maybe it's a bad idea, it seems to create ' problems ', near some of the edges, bec. of the tiling, or ' some-thing ', not smart enough to ' fix ' it, atm . . .

Skærmbillede (1824)

Atm, when one of them is painted over, it makes them, in another place . . ok, fixed it, the UV's had to have a little distance, in both direction, theoretically it'd be 1 - 2 pixels . . :O :O . . .

Skærmbillede (1825)

Well, maybe it's more of an ' advanced ' feature, for some really ' nerdy ' contributor, to get into, I have no idea, what-soever, how to make this, no ' clue ' . . . <3

ok, last idea . . if one could delete certain hexes, or so, one could export the terrain to Blender, and snap say a dungeon, or something more ' plane ' based, or architectural to the design, getting ' decent ' transitions, from the terrain, to stuff, or so . . also, for placing stuff like a house, maybe a sculpt brush, that ' flattens ' certain parts, so ' terrain ' doesn't go into the ' buildings ' or, so . . . . . 2021-05-23 1604

Anyway, a simple suggestion, might give Godot the ' best ' terrain editor, atm, not sure what the other engines do . . :O :O . . . . .