Search Unity

heightmap - getting a little raw over RAW

Discussion in 'Editor & General Support' started by ZeroByteDNA, Sep 9, 2012.

  1. ZeroByteDNA

    ZeroByteDNA

    Joined:
    Jun 18, 2012
    Posts:
    1,042
    First, let me say that I know that this should probably be posted in X - where X is the half dozen other places that people have posted this similar issue.

    Second, let me say that I know that I could have necro'd the countless posts in those half dozen other areas where this has been asked.

    Third, let me say that it would have given me some great amount of perverse pleasure to have gone through and necro'd every single post on this in Answers, Feedback, Wish List, External Tools, here in Gossip, etc, etc, etc, etc... it really would have.

    Fourth, let me go have a smoke and then I'll continue...

    Fifth, there's not really a fifth - but hey... not like there's been an answer for this in the four years of posts that I've searched.

    Terrain->Export Heightmap - Raw...

    For those of us without Photoshop, what good does this do other than help those of us looking for an excuse to get a new keyboard (you know, from where you pick your keyboard up and repeatedly bash it against your desk up there's not a single key left attached to it)...?

    It's amazing how easy it is to create the RAW heightmap for the import. Pick your app, make the heightmap, either export it as RAW or export it to another type that you can open in another app to export as RAW. Baddabing, baddaboom, it's orgasmic!

    Going the other way, though, well - it's like being constipated for nine months and trying to pass a baby elephant out your tushie...

    ...ahem...

    8bit Mac, 16bit Mac, 8bit Win, 16bit Win... and you might as well try knocking down a large building with a pink stuffed bunny (you saw that commercial, great - right?)

    There are a variety of apps/plugins that claim they can open RAW files...and they can. They just cannot open these RAW files. Not only do you try the four options above, but you try all sorts of file extensions in case it something as simple as that. No love, just hate...

    ...and as you're on your third keyboard, having noticed that the majority of the posts you've read on the matter all have people making the same suggestions and people coming back saying those suggestions did not work (yet people continue to parrot those suggestions for some reason, when thread after thread throughout at least four years has said that it does not work)...

    ...ahem...

    You know, I could avoid all of this by either subscribing to PSCS for a month or shelling out $5 for Eric's doohickey - but there's that little voice inside of me that cannot believe that this issue still exists after all these years - that no other option exists to export that heightmap. Well, there was the Pro only jury rigged method - but yeah, the PSCS sub and Eric's doohickey are much less than $1500 just so I can export a heightmap.

    So perhaps I've been looking at this wrong. Perhaps I've been too focused on trying to export that heightmap rather than deal with the overall issue - what I'm trying to do...maybe there's just another way to do that and then I wouldn't have to worry about it.

    I'm not fond of World Machine, Terragen, etc, etc, etc, etc, etc. I haven't found another option that matches what I get from my three step process:

    Bryce -> Gimp -> Terrain Toolkit

    That leaves me such a happy camper. For small terrains.

    Yes, yes - I should just hang out in an alley behind a bar somewhere to make the $5 to buy Eric's doohickey. But uh, no.

    So the process that I'm trying to do:

    Bryce...create my base heightmap, twink, tweak, twink, tada - slap a gaussian border on it. Copy the image and paste it into
    Gimp...increase the canvas, layer to image size, paint the border black, scale image, export to RAW, and import it into
    Unity...erode, erode, erode, equalize, erode, erode, equalize, basically twink, tweak, twink, tweak, twink...paint...water, erode, equalize, etc, etc, etc, etc...

    Like I said, up to this point I'm a happy camper. This workflow works great. Heck, I've even dorked around with different sized resolutions in Unity and well - that's where I've wanted to split terrains. Also, the islands I'm making - well - they're not as uniform as far as painting goes. It would be much easier to touch up the paint than have to try to paint the whole thing. Multiple terrains would make this so much easier.

    Yes, I can do the Bryce -> Gimp resize, split into 512 chunks, and create multiple terrains in Unity. BUT - I can't do the erosion fun - can't do it - can't do it. I'd need to shell out the $5 to try to stitch all the funky seams and it would never look as good as if the erosion fun was done and then it was split.

    So yeah, it should be a case of exporting the heightmap from Unity after having all my Terrain Toolkit fun - resizing, cutting, creating multiple terrains and importing the multiple maps...but as I said earlier: no love, just hate.

    Seeing as the issue has not been addressed in all these years, I'm guessing that there's no option than to hang out in the alley behind the bar tonight after the game to get the $5 for Eric's doohickey to try to stitch the seams and wish for the best. One might even say that would be best as I could apply more specific weather patterns to the different climates on the various islands (three of them in all, three separate levels)...

    ...perhaps if there was a terrain generator that had the various options that Terrain Toolkit offers as far as all the erosion goodies.

    Some would probably prefer that I went back to working on this issue as I have been for about a week now - they never liked my posting here anyway...but that might just be some melodrama bleeding through my frustration over this thing that should be so simple.

    edit: Okay, maybe I'll stop being lazy and disappear for a week to write some stitch scripts...meh.
     
    Last edited: Sep 10, 2012
  2. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    Are there a lot of ways to edit 16 bit grayscale images? It would have to be done procedurally, as normal displays can't display them, and most apps can't load them. Exporting as a common format (like jpeg or 24bit PNG) would destroy the heightmap, and it would contain only 1/256 of it's previous precision- your smoothly rolling hills would turn into stair steps.
    Even if you could edit it, how would you do so? You wouldn't be able to tell the difference between shade 12000 and 12128 - they, and every one in between would look the same on your monitor - but there would be a world of difference in them in the actual terrain.
     
  3. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Yes, you should indeed. I wholeheartedly recommend this. Try to pick one of the less seedy bars though.

    513 chunks. Heightmaps must be power of two plus one.

    --Eric
     
  4. npsf3000

    npsf3000

    Joined:
    Sep 19, 2010
    Posts:
    3,830
    Could you provide a simple descriptive paragraph of the actual problem?

    Oh, and please include some sample raw exports so I can muck around - I need at least the 16 bit windows version.
     
    Last edited: Sep 10, 2012
  5. ZeroByteDNA

    ZeroByteDNA

    Joined:
    Jun 18, 2012
    Posts:
    1,042
    I can copy the heightmap from Bryce, paste as a new image in GIMP, export as PNG, close it, open it, export it as RAW, and import it into Unity - the same as if I simply skipped the PNG export/reopen/conversion and just did the export to RAW. It's not a case of editing, as much as it is resizing and cutting.

    I'm looking at either applying my 512 to a 4x4 square or applying four 512s to four 2x2 squares.

    Have to say, Stitchscape ( http://starscenesoftware.com/Utilities.html ) does look pretty awesome. It was the one good recommendation that popped up in several of the posts. I'm just being stubborn, though I doubt it will last too long.

    The gf saw my screen and said: "I thought you were working on your islands. You're making reeds of grass now?"

    I went out for a smoke, lol...

    Yeah, I scale the extra pixel - but still think of them as 512s...meh..

    Hrmmm, perhaps a pictorial explanation? Let me do a quick one...

    The 512...ahem, 513...applied to a 4x4 terrain with basic coloring.
    $prebase.jpg

    The same 4x4 single terrain with some basic erosion tweaking from the Terrain Toolkit.
    $base.jpg

    The 513 - scaled up and cut into four - those four applied to four 2x2 terrains with basic coloring (including the ability to reflect different climates - though obviously very basic in this particular example).
    $prefour.jpg

    The four 2x2s with the same basic erosion tweaking applied to each one.
    $four.jpg

    ...to be continued...
     
  6. ZeroByteDNA

    ZeroByteDNA

    Joined:
    Jun 18, 2012
    Posts:
    1,042
    ...continued...

    Tada, meh...seams:

    $seams2.jpg

    $seams1.jpg

    Because even though the same erosion/tweaks were applied to each (and in the same order) as with the single terrain, they are not static changes - there is a random element. So it creates seams/tears on the overall terrain.

    Yes, this is a great ad for Eric's doohickey - lol... and like I said, it's likely going to come to that. I mean, honestly, it's the most cost effective solution...but I'm stubborn. :)
     
  7. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    That's pretty much the ideal usage of Stitchscape. ;) They're fairly close already, so it will work really really well....

    --Eric
     
  8. ZeroByteDNA

    ZeroByteDNA

    Joined:
    Jun 18, 2012
    Posts:
    1,042
    Yeah, even with some of the seams on the actual large island I have - it definitely looks like it would do wonders for it. I got caught up in not being able to do anything with the exported heightmap from Unity. One of the other things I mentioned in the original, but did not mention in the pictorial was that adding a border to the heightmap - basically a flat area surrounding the terrain. One of those swimming fatigue things killing the player before they run out of ground beneath the water, lol.

    Where Stitchscape actually caught my eye was with the larger island, since it includes multiple climates - and - a single terrain where I apply the same erosion effects simply does not make sense. There's not going to be the same heavy rain in a desert as there would be in the jungle - etc, etc, etc.

    A funny thing about looking at it, though - is the potential for doing things such as an earthquake, simulating a mudslide, and all those nifty things.
     
  9. Noisecrime

    Noisecrime

    Joined:
    Apr 7, 2010
    Posts:
    2,054
    So your complaint is that Unity terrain doesn't allow splitting? Why do you need splitting? Please don't say to 'resize' as you really shouldn't be resizing height-maps as it doesn't make much sense. If the resize is bilinear filtered then that can and often will seriously mess up the heightmap - think of two adjacent pixels, one at ground level (0) and one at max height 65535, filtering (average) this would give a height value around half, which is rarely what you'd want.

    Although height-maps are often stored in files that suggest they are simple 'images' they are not and as such should really not be treated as one. Not sure what the problems were with opening Unity heightmaps, any program that can deal with RAW files should have no issues, though of course it can't actually display the image correctly (as they are 16 bit instead of 8 bit) and actual editing of the data in a paint package is therefore pretty nonsensical, plus you have to be careful that the program doesn't remap the data from 16bit to 8 bit or something equally silly.

    Unity's terrain toolkit is great for what it is, but its not a fully fledge terrain generator, though I love Bryce, its not really geared towards games, so though it has some very cool heightmap editing features you'll likely to come across issues if you force it beyond what it was built for.

    Honestly it sounds like you just need to find a good game orientated terrain creator, i'm sure there must be some about. I do remember being impressed with L3DT back when it was in alpha, though I've not checked it out in years, perhaps have a look at that?

    Alternatively learn a bit about height maps and start writing your scripts to edit the data so you can get it to work how you want. Heck write your own terrain generator, its fun learning about erosion and the like. ;)
     
  10. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    That's overstating things kind of a lot. You can open the raw files with Photoshop no problem and edit them in a totally non-nonsensical way. ;) It works fine...even if you can't visually distinguish 65K shades of gray, it doesn't matter; it's not like you're trying to edit on a pixel-by-pixel basis, you're just using brushes, filters, etc. As for other programs not opening the files, well, they are very raw files, nothing but data. I suspect most programs require some kind of header, but Photoshop guesses about things like image size based on the number of bytes in the file, and lets you specify image size and so forth yourself if needed.

    --Eric
     
  11. ZeroByteDNA

    ZeroByteDNA

    Joined:
    Jun 18, 2012
    Posts:
    1,042
    The "complaint" is in regard to the format while exporting the heightmap. If you've got Photoshop, you're fine - you're good to go. If you do not have Photoshop - you're not good to go.

    The pictorial above, shows the resizing and what it allows one to do.

    So say you start with a 513 for a 4000x4000 single terrain. Each px = 7.8m. If you resize (I use cubic scaling) the original 512 to 1024, cut that into four 512 chunks, and scale them to 513 (512 will give you the dividing lines) - then each px = 3.9m.

    You end up as if you were applying a 1025 to the 4x4 by applying 513s to the four 2x2's.

    Name another program other than Photoshop that can open them....tada...that's the problem. Even programs that can open RAW files cannot open them. They throw errors about being unable to read them. I tried programs that I've never heard of trying to open them in the past week.

    Which is where the process of generating the initial heightmap in Bryce and running the erosion tools from the Terrain Toolkit has worked very well for me - the UTT does not give me what Bryce does and Bryce does not give me what UTT does. Together, they work great.

    L3DT, World Machine, Terragen, various fractal generators... do not give me what I get so easily with the combination of Bryce/Terrain Toolkit (&River 'n Path).

    If the export of the heightmap...worked with something other than Photoshop; then I'd never have posted. Because outside of the export, it does work how I want it to work. :)

    As I said earlier, this issue's been reported for years - and - the best solution (not for everybody, but in my situation) is just to go ahead and buy Stitchscape.
     
    Flurgle likes this.
  12. ZeroByteDNA

    ZeroByteDNA

    Joined:
    Jun 18, 2012
    Posts:
    1,042
    If it gave the option to export SGI... just saying.
     
    Flurgle likes this.
  13. ThimKalin

    ThimKalin

    Joined:
    Apr 26, 2017
    Posts:
    2
    I know this is an old thread, but for anyone still looking for a pipeline to do this, I have found a solution. This may have also been said somewhere else. So, after exporting, a raw height map from unity, I open it in TerreSculptor, then export as a PNG file, then open in Gimp. Then I can mod or split, then export for use back in Unity.

    My whole pipeline for using real world height maps is as follows. I get my height maps in PNG format from Terrain Party, open in Gimp, resize to 1024, as their 1081, then export as png. Then use the script found here: http://wiki.unity3d.com/index.php/HeightmapFromTexture to apply as a terrain. Then use unity tools to mod terrain. You can then export from Unity into raw format, then convert using TerreSculptor and then back into Gimp to slice up, then export back as png to go back into Unity.
    Hope this helps someone and keeps them from searching for answers for days.
     
  14. eric_unity45

    eric_unity45

    Joined:
    Sep 1, 2018
    Posts:
    1
    I about fell over laughing when I read this, I just used visual studio to write a little conversion app that would load the raws in and convert it to bitmap data, do all the editing I wanted to it in MS paint and then write it back out as a raw. but I'm not charging $5 for it behind the bar. lol

    Which as an aside also lets you resize them and slap them together since it's just playing with bitmaps.
     
    Flurgle likes this.