Confusion about using heightfield generate

Started by Kerbonaut, April 01, 2017, 03:19:10 PM

Previous topic - Next topic

Kerbonaut

Hi, I'm trying to export a heightmap of some terrain, and I'm having some difficulty using the heightfield generate feature. I know I have to hook it up with the last shader, but whenever I export the heightfield it comes out weird; It only has two colors, solid white and black, and maybe a little bit of grey in between. And hooking it up with other shaders has either produced the same image or gone completely blank. What am I doing wrong?

[attach=1]

Hetzen

Heightfields use pixel values over the white value to represent height. So what you are seeing in your attachment is the first meter of the terrain above 0. There's probably information below zero too.

I've tended to not use Heightfields these days. I generally use a Get Altitude plugged into a Linear Step, with two constants, one for the lowest level of terrain, say -200m and the second for the highest level in the terrain, say 2000m. What this outputs is a flat gradient between black and white for the full range I've indicated by the two constants. I then use this to illuminate the terrain by plugging it into the Luminosity input of a surface layer with its colour set to full white. Turn off all lighting and render an orthographic top down view of the area I want to export. Render to the rez I want, then save as an EXR which is linear in the way it holds it's colour information. Why? Because I can take this into Photoshop and visually edit it, bring it back into TG as an image map in a single colour channel, with say erosion and river masks in the other two, which can cut out a lot of render processing when you are rendering sequences.

Oshyan

Kerbonaut, when you say you are hooking the Heightfield Generate up to the "last shader", are you doing it with the last shader in the *Terrain* group, or the last shader in the *Shaders* group before it connects to the planet? The latter is definitely not correct (in the majority of cases). It should be the last in the Terrain group. My second question would be how you are exporting: right-click on the Heightfield Generate and Save As? What format are you exporting as?

Jon, you know you can export heightfields to EXR as well, right? Your workflow sounds overly complicated, unless I'm not understanding why you're using it.

- Oshyan

Hetzen

Hi Oshyan, yes I did. When you export an exr from a heightfield node, you get a similar image to Kerbonaut's op. You are visually cut-off beyond anything over a meter, unless you start playing with Levels in Photoshop to compensate for over whites to pull the whole terrains altitude back into a visual black to white range.

With the method above, you know the altitude range you are exporting. You can see the whole altitude in Photoshop and do some edits. And bring it back into various apps knowing the range you're working with.

cyphyr

If you open the 32 bit EXR in Photoshop and convert it to 16 bit you can see the values and edit them and avoid gettingthe stepping that happens with 8 bit .... I think ...
www.richardfraservfx.com
https://www.facebook.com/RichardFraserVFX/
/|\

Ryzen 9 5950X OC@4Ghz, 64Gb (TG4 benchmark 4:13)

Hetzen

I guess you can Richard, what gamma settings do you use to convert into 16 bits? Because I might be missing a trick here.

When keeping everything in 32bits for editing, I've not noticed stepping when I put a 'copy merged' from Photoshop into a 32bit red channel.

Sorry Kerbonaut, we're going off on a tangent here.  :)

cyphyr

Quote from: Hetzen on April 02, 2017, 04:46:22 PM


Sorry Kerbonaut, we're going off on a tangent here.  :)
happens lol

I guess it's down to the workflow ones comfortable with. If I keep things in 32 bit I get images like Kerbonaut or pure black or pure white. I've not tried looking at the channels, there may be a trick in there as well.
I think I use Exposure and Gamma but it's been a long time ...
www.richardfraservfx.com
https://www.facebook.com/RichardFraserVFX/
/|\

Ryzen 9 5950X OC@4Ghz, 64Gb (TG4 benchmark 4:13)

Hetzen

#7
Well, I've been using this method to get in and out of other apps quite successfully so far.

Kerbonaut what was the file type you exported?