Compass tab - a suggestion and a wish

Started by Roberts, February 07, 2020, 03:32:23 PM

Previous topic - Next topic

Roberts

Slope restrictions are an essential part of controlling placement of shaders in Terragen.
Wouldn't it be handy if we could have a similar tab in the surface layer that is based on compass heading? It would make it easier than it is today to correctly limit shaders to the side of mountains for example. 

I know there are already ways to make north, east, south and west restrictions. But they are quite cumbersome and intricate (at least to me).

Is this perhaps something Planetside could consider adding?

Regards

Robert

pokoy

+1, this is quite an important factor in nature.
I'd also love to have an easier way to do this, it would be a great addition to the distribution shader.

Tangled-Universe


WAS

I wonder how hard of a hit on the shaders it would be. I think because this is a planet, it would have to be in XYZ, lat, long and heading.

Roberts

#4
Thanks for your replies.

WAS: I guess that most of the time (when your working on local terrain at the planet´s apex), everything pointing in the Z-axis´s positive direction would be considered North. But on a planetary scale, Y-axis is the one pointing North. At least I think so, sometimes when I think about this I get all confused...Which is the reason I´m wishing we could have a simple tab for this, so that I don´t have to have a brain meltdown... ;)

I have no idea how hard it is to implement or if it will slow down shaders. But I do think it would be a welcome addition and facilitate easier restrictions of shaders. I´m thinking for example of the problems we have with trying to do rectangular/square rocks. A compass shader/tab would make it much easier to mask differently facing slopes according to their compass heading and correctly project different shaders to these slopes.

On a nearby subject I also have another suggestion or wish. I wish we could choose to project image maps perpendicular to the face normals of the terrain. As the normals change with a rolling terrain, so the projection would also change so that the image is always projected "flat" on to the ground, regardless of slope etc. If I remember correctly this was possible in 3d Max when I used it years ago. I wonder if it´s possible to have the same ability in Terragen?

Best regards

Robert

Tangled-Universe

Don't know whether if it's really that hard like really needing lat/long correction etc...I don't think so actually (more on that in the 2nd paragraph).
The kind of calculation involved is similar to slope restriction calculation, which a certain relation between Y and X/Z axis.
A restriction by 'heading' would be the relation between X/Z.

If there needs to be any kind of correction for lat/long and what not then it's probably already built in TG if you look at the possibilities/limitations of current altitude/slope restrictions.
With that I mean that things are not perfect now with regards to slope/altitude restrictions far far FAR away from the origin, but in the past 14 years on these forums 99% of the post involving these discussions are about how to deal with stuff close to the origin. In other words, the lat/long corrections, even if necessary, is of minor importance if you look at the history of discussions/requests.

Long story short, I like this idea and my kind of layman's view tells me it's not impossible or a huge undertaking, we would just have to ask kindly :)

Dune

As you said, there are methods already, but no 'easy heading' shader. Maybe a loose shader would do just as well as incorporating it in surface shader and distribution shader. What it should also have is the ability to choose for bigger patches; whole mountain ranges, not every nook and cranny that's facing a certain direction. And preferably without need of a compute terrain :P

Roberts

Quote from: Dune on February 11, 2020, 07:25:30 AMWhat it should also have is the ability to choose for bigger patches; whole mountain ranges, not every nook and cranny that's facing a certain direction. 

Yes Dune, that's what I think too. Perhaps the user could choose a "sample rate" of the underlying terrain. Regardless of what the "compute terrain" is set to.

Quote from: Tangled-Universe on February 11, 2020, 05:41:12 AMLong story short, I like this idea and my kind of layman's view tells me it's not impossible or a huge undertaking, we would just have to ask kindly :)

Let's keep our fingers crossed that Planetside are reading and are able to perhaps fulfill our kind request...  ;)

Tangled-Universe

Quote from: Dune on February 11, 2020, 07:25:30 AMAs you said, there are methods already, but no 'easy heading' shader. Maybe a loose shader would do just as well as incorporating it in surface shader and distribution shader. What it should also have is the ability to choose for bigger patches; whole mountain ranges, not every nook and cranny that's facing a certain direction. And preferably without need of a compute terrain :P

I did not refer to any available method, actually. I referred to that the underlying calculations for slope restrictions are of similar nature to calculating the direction in which a normal is pointing.
Thus suggesting that a 'heading restriction' function should not be too complicated to develop. Ultimately that's for Matt to conclude of course, but for now I don't see how that would be so much work.

Slope/Altitude restrictions also apply to each "nook and cranny" so as a start a heading restriction function would work in very similar ways.
Given how the intersect underlying mode of displacement intersection works with smoothed versions of the terrain, I think a similar approach could work for calculating an average 'heading' of a patch of terrain.

If you know how to create a heading mask with blue nodes then it's actually possible to incorporate a patch size function as well.
You would simply need to warp the get function for X meters, where X is your patch size, and then average those.
I did this once for a convexity selector I made. Convexity applies to slope changes, so the same approach would work for 'heading'.

Down the line it's all the same, just on different axes.

Dune

Quote from: Tangled-Universe on February 11, 2020, 11:33:27 AMI did not refer to any available method, actually.
No, sorry, Robert did in his first post. I was referring to his text.


Quote from: Tangled-Universe on February 11, 2020, 11:33:27 AMYou would simply need to warp the get function for X meters, where X is your patch size, and then average those.
Can you elaborate on that? I fail to see how warping would work, and how it could be done in TG. It would be cool if the smoothing filter would work on that, btw.

WAS

#10
Well lat/long/head would just be a representation of XYZ in 3D, so not sure what you're exactly on about. The issue is for proper compass-based heading, it will be isolated to that heading and lat/long, and no where else, on the globe or otherwise. Otherwise you're best just using directional masks that will work globally off XYZ and wouldn't actually be a compass-based setting.

That being said, the current directional masks aren't exactly fast when you start using a few of them. Enter my comment. Matt doesn't seem keen on adding things that may be slow from past discussions on ideas.

Combining this idea with roaming the planet, such as real-world data, this would need to be actual compass-based in lat/long/head to work realistically across the globe, otherwise just firing a slope north-east (based on 0,0,0 and XYZ) isn't going to work elsewhere and would be erroneous.

You'd think since the Slope Limits do in-fact work globally, that you'd only add a feature like this that also works globally and correctly.

The psuedo-idea here seems could be handled another way, like a Distance Camera sort of shader to paint slopes/faces it sees for more localized effects, using it's own internal viewport angling as directional masks.

bobbystahr

something borrowed,
something Blue.
Ring out the Old.
Bring in the New
Bobby Stahr, Paracosmologist

Tangled-Universe

Quote from: WAS on February 11, 2020, 01:23:09 PMWell lat/long/head would just be a representation of XYZ in 3D, so not sure what you're exactly on about. The issue is for proper compass-based heading, it will be isolated to that heading and lat/long, and no where else, on the globe or otherwise. Otherwise you're best just using directional masks that will work globally off XYZ and wouldn't actually be a compass-based setting.


I think that is actually what I said about XYZ in 3D.
Furthermore I meant to explain how calculating heading should not be so costly or more costly than calculating slope. It's the same principle, mathematically, only on different axes.

Call me dense, but "north" is just a set of 

Quote from: WAS on February 11, 2020, 01:23:09 PMThat being said, the current directional masks aren't exactly fast when you start using a few of them. Enter my comment. Matt doesn't seem keen on adding things that may be slow from past discussions on ideas.

Yeah node-based solutions are slow. A blue node based slope mask would also be slow, yet it is pretty fast as it is implemented into the surface layer.
Any node-based conconction will run faster once it's converted into a C++ coded shader in TG's library. For example: easy clouds
Your final conclusion is not really correct in that sense.
Matt has to carefully plan his efforts, has his own ideas and has to deal with our requests/wishes.
In that sense it's probably more about bang for buck principle and as far as I know he's also not keen on cluttering the UI with many controls or other overwhelming features.

The reason I think this request is viable is because it touches upon something you can observe widely in nature itself and TG lacks simple control over that.


Quote from: WAS on February 11, 2020, 01:23:09 PM1) Combining this idea with roaming the planet, such as real-world data, this would need to be actual compass-based in lat/long/head to work realistically across the globe, otherwise just firing a slope north-east (based on 0,0,0 and XYZ) isn't going to work elsewhere and would be erroneous.

2) You'd think since the Slope Limits do in-fact work globally, that you'd only add a feature like this that also works globally and correctly.

3) The psuedo-idea here seems could be handled another way, like a Distance Camera sort of shader to paint slopes/faces it sees for more localized effects, using it's own internal viewport angling as directional masks.

1) Like I said before I think "roaming the planet" is a minor use case. I'm sorry.
I'm definitely not the one to call the shots(!!), but if I were Matt I'd look at use cases of TG and choose to develop features which are of use to as many users as possible.
In the many years here I haven't seen many "planet roamers" and the vast majority does their stuff around the origin.

2) Yes indeed, see my previous post.

3) The "localized effects" confuses me a bit. Do you want a planet-wide solution or something "local"?
Or do you mean if global is too hard/slow/whatever that a local approach may work for you as well?
For camera based approaches you need to shoot additional rays into the scene, so I'm not sure whether if that would be the preferred method.
Using my analogy that the heading calculations are very similar in nature to calculating slope I think that the surface layer shader may be able to calculate heading along with slope. See it as a cheap happy by-product of already having your surface values calculated for slope, then you can also use that calculated values for a different type of calculation without going all over it again.
Shooting camera rays sounds more costly to me + when animating a flying camera you will notice the areas which are occluded by the heading mask camera. A surface layer type of function would avoid that.

Hetzen

I was taught recently a far simpler way of masking a side using dot product. Copy and paste below and connect to your mask input. Then adjust the Constant Vector to the side you want.

<terragen_clip>
<dot_product
name = "Dot product 01"
gui_use_node_pos = "1"
gui_node_pos = "-200 380 0"
gui_group = ""
enable = "1"
input_node = "Get normal in texture 01"
gui_use_preview_patch_size = "0"
gui_preview_patch_size = "1000 1000"
input_2 = "Constant vector 01"
>
</dot_product>
<constant_vector
name = "Constant vector 01"
gui_use_node_pos = "1"
gui_node_pos = "-100 440 0"
gui_group = ""
enable = "1"
input_node = ""
gui_use_preview_patch_size = "0"
gui_preview_patch_size = "1000 1000"
vector = "-1 0 -1"
>
</constant_vector>
<get_normal_in_texture
name = "Get normal in texture 01"
gui_use_node_pos = "1"
gui_node_pos = "-280 440 0"
gui_group = ""
enable = "1"
input_node = ""
gui_use_preview_patch_size = "0"
gui_preview_patch_size = "1000 1000"
>
</get_normal_in_texture>
</terragen_clip>

Dune