Masked Terrain heightfield Generate

Started by WAS, October 29, 2018, 03:14:17 AM

Previous topic - Next topic

WAS

Seem to be having a issue masking terrain, and than generating it as a heightfield. Simply nothing appears at all, but if you unmask the terrain it will than generate fine.

TG 4.2.10

Tangled-Universe

Actually, there is terrain, it's only not where you expected it.
The terrain is masked with a simple shape shader which its coordinates define the center of the shape.
You generated the heightfield for "position lower left" so it's not sampling correctly.
Switch to "position center" in the heightfield generate and it generates what you are looking for.

WAS

#2
Quote from: Tangled-Universe on October 29, 2018, 01:09:51 PM
Actually, there is terrain, it's only not where you expected it.
The terrain is masked with a simple shape shader which its coordinates define the center of the shape.
You generated the heightfield for "position lower left" so it's not sampling correctly.
Switch to "position center" in the heightfield generate and it generates what you are looking for.

Technically that still presents an error since the mask masks the entire area being sampled, defined by the Heightfield dimensions. You'd think with such a big mask and roll-offs even if it was the lower left of the 10k region, there'd still be some terrain? The mask is 20000km by 15000km, with that 5000 compensated in the Z shift. So at least by my maths logics the 10k 0,0,0 realm is still within the mask, with it's boundaries fading out?

Which means, when you define a 10k heightfield, and it's not set to "position center" it's sampling outside it's definition?

Also what does rendering position lower left help with? Tiling heightmaps?

Tangled-Universe

#3
I thought you needed help, but it seems you're more in need of discussion, don't shoot the messenger ;)

It makes sense though and I see your confusement.

The heightfield generate (green) works independently of the heightfield shader (red).
You configured the heightfield generate to generate a 30000x30000m large heightfield with a 1000x1000 resolution.
This heightfield generate is at coordinates 0,0 and those define to be the lower left coordinates of your heightfield.
The heightfield generate samples the terrain in a square with position 0 to 30000m for both X and Z.

However...

Your mask is ranging from -10000 to +10000 for X and -2500 to +12500 for Z (since the mask has an position of +5000m on Z).
So if you sample the terrain with coordinates 0,0 starting at lower left you basically cut out everything west of the camera and also a chunk south of it.

Add a landmark object at coordinates 0,0 and scale it up.
In your setup this marks the bottom left corner of the terrain you are sampling.

edit: so if you set the coordinates to center coordinates and preferably also to the same coordinates as the simple shape shader then it's pretty much foolproof as long as you also set the heightfield shader to center coordinates.
I admit though that these positioning settings are somewhat peculiar. I suppose they are for some tiling options indeed and perhaps also how some DEM data is working.
It's interesting to know these issues, helps me with some videos I'm working on.

WAS

#4
I guess it still doesn't make sense to me. As even at 0,0, there is displacement. The heightfield isn't actually set to lower left, but center

For example DK::CE, which is also sampling 0,0 at center has no issue.

Again, the Mask is 15000 shifted by 5000, so the start of the mask is at 0,0, there should be SOMETHING (as seen without heightfield, and only mask and disp).

The point is to have a less displaced area at origin (0,0) and be viewing the mountain. This works out of the box with DK::CE with same heightfield dimensions.

WAS

#5
I guess what's really confusing is what exactly is Lower Left compared to Position Center? What is Lower Left of 0,0? You'd for the use of tiling or dems you'd actually have a define location from a augmented center. That might be a cool feature to add, the actual samples positions in X/Z based on the settings of the heightfield generate.

Though considering it is generation of of terrain based on visual position, the position Lower left really makes no sense to begin with.

So to clarify, if the heightfield is at 0,0, a dimension of 30km, it will be sampling the lower left quarter of the defined square, for some reason (-15000, -15000)? Kinda stupid for a default setting, (no offense Matt).

Tangled-Universe

No, 0,0 means the coordinate of the bottom left corner of the square. It samples from 0,0 to 30000,30000, in your case.
Just try what I suggested to see what I mean as you're still thinking that the red heightfield node dictates what you see and that's not true. The culprit is in your green node.

WAS

#7
Quote from: Tangled-Universe on October 29, 2018, 04:08:12 PM
No, 0,0 means the coordinate of the bottom left corner of the square. It samples from 0,0 to 30000,30000, in your case.
Just try what I suggested to see what I mean as you're still thinking that the red heightfield node dictates what you see and that's not true. The culprit is in your green node.

See, but even than... 30000x and 30000z from 0,0 would still have mountains in it than? In fact, half of them.

I'm sorry if I sound stupid, but I have bad dyscalculia, but from everything I understand it doesn't make sense. There should be mountains SOMEWHERE in the result as clearly from 0,0 there is sampled mountains? By my logic that right side of the mountain would be sampled, and blended out, but clearly be present in the heightmap as it extends for about ~10km into the 30 km square sampled.

I don't know if you can explain it any more laymen than what you did, I apologize. Truly trying to figure it. I'm very visual with learning (developmental learning issues I'm sure).

Tangled-Universe


WAS

#9
Quote from: Tangled-Universe on October 29, 2018, 05:49:59 PM
This is as visual as I can make it for you ;)

https://we.tl/t-eCmEWmU00R

Ah jeez, that sure does illustrate it nicely. I could have stepped back further I suppose. Lol

Also, wow, I needed to install VLC player, Windows 10 had no idea what to do with a FLV. I feel old about that. Used to be so common.

This sort of confusion really begs for documentation, not so much just the origin, but what the hell it's use really is. As it really complications positioning to even get an appropriate heightfield of exactly what you want at what point unlike DK::CE.

Thank a lot for spending the time on that Tangled-Universe (I don't believe I know your name form FB).