Can you generate procedural terrain based off a custom map's ocean locations?

Started by AlianaAR, September 26, 2024, 02:57:15 PM

Previous topic - Next topic

AlianaAR

Is there a method to use TG's native procedural terrain generation to build randomly seeded terrain according to the land areas on a planet texture map? In other words, create custom shaped and positioned continents?

I was kind of thinking along the lines that creating a base planet first, then adding a second sphere for the oceans but using a mask on that sphere to cut out the land shapes I want or something along those lines.

Anyone figured out a good method to do this?

Kevin Kipper

First create an image based on your planet texture map that can be used to mask areas on the planet.  It would sort of look like an alpha channel of the planet's continents.  The continents would be white and the ocean area black.  Load the image into an Image Map shader and set its projection to spherical, then change the Y axis Position value to match your planet's Y axis Centre value.

30900_TextureAndMaskMaps.jpg

Connect the Image Map shader to the Mask Shader input on one of Terragen's procedural noise nodes, such as the Power Fractal shader v3.  Now you've constrained the surface displacement to just the continents.

To create different terrains, just change the noise node's Seed parameter.  Of course, you can change any of the noise node's parameters to further change the look of the terrain.

If you want to shift the positions of the continents, try using a Fractal Warp shader to distort the Image Map used to mask the continents.

AlianaAR

Quote from: Kevin Kipper on September 26, 2024, 04:31:59 PMFirst create an image based on your planet texture map that can be used to mask areas on the planet.  It would sort of look like an alpha channel of the planet's continents.  The continents would be white and the ocean area black.  Load the image into an Image Map shader and set its projection to spherical, then change the Y axis Position value to match your planet's Y axis Centre value.

30900_TextureAndMaskMaps.jpg

Connect the Image Map shader to the Mask Shader input on one of Terragen's procedural noise nodes, such as the Power Fractal shader v3.  Now you've constrained the surface displacement to just the continents.

To create different terrains, just change the noise node's Seed parameter.  Of course, you can change any of the noise node's parameters to further change the look of the terrain.

If you want to shift the positions of the continents, try using a Fractal Warp shader to distort the Image Map used to mask the continents.

Sounds like it'll do what I want but well beyond my nOOb skills. Beyond the images, no clue where to begin with that. Could you tell me where to plug it into the attached file?


Kevin Kipper

I'm attaching a simple Terragen project file to illustrate what I'm referring to.
30900_Example.zip


AlianaAR

Quote from: Kevin Kipper on September 26, 2024, 08:04:07 PMI'm attaching a simple Terragen project file to illustrate what I'm referring to.
30900_Example.zip


I've been experimenting now for a few days and I think this isn't the way to go. The principal problem is that all you can do is assign a blue color to the surface shader for oceans but you won't get any depth falloff as the color will be solid.

The big issue is that this won't hold up for low orbit views. Right now I'm on the path of creating a global procedural terrain but with a custom displacement map to increase terrain altitude specified by a displacement map. This creates global procedural terrain making an ocean floor and continents based on the geography I want. Then adding a sphere for an ocean, attaching the atmosphere to that sphere, very slightly shrinking the surface sphere so the terrain's altitude get's lowered below the ocean sphere line and success. I've succeeded in getting the geo-map that I want. What I've had no luck with is making the ocean sphere transparent so there is that tropical falloff from shallow water to deep water.

Is there a simple way to make a basic surface shader transparent? I want a global ocean with depth falloff. I tried a lake set to a diameter the same size as the ocean sphere but nada.

Suggestions?

Kevin Kipper

QuoteIs there a simple way to make a basic surface shader transparent?
The short answer is no.

Currently in Terragen, the Default shader's opacity is either on or off in the rendered image.  In some sense, this is like a clip map in other 3d applications, where values above 0.5 are "on" or "visible" and values below 0.5 are "off" or "invisible".  There is no "in-between".  In Terragen this means that opacity values above 0.5 will display the surface shader's properties, and those below will not.  If another shader has been assigned to the Main Input of the Default shader, then the other shader will show through in those areas.  If nothing has been assigned to the Main Input, the results will be black in the areas with an opacity value less than 0.5.

Note that in the 3D preview window, the results can look different than the rendered image; which admittedly is confusing.  Additionally, it is sometimes necessary to disconnect and reconnect a node being assigned to the Opacity function in order to see the results "refreshed" in the 3D preview window.

Here are the online docs to these parameters:
https://planetside.co.uk/wiki/index.php?title=Default_Shader_4.5#Opacity_Tab


AlianaAR

Quote from: Kevin Kipper on October 01, 2024, 01:18:03 PM
QuoteIs there a simple way to make a basic surface shader transparent?
The short answer is no.

Currently in Terragen, the Default shader's opacity is either on or off in the rendered image.  In some sense, this is like a clip map in other 3d applications, where values above 0.5 are "on" or "visible" and values below 0.5 are "off" or "invisible".  There is no "in-between".  In Terragen this means that opacity values above 0.5 will display the surface shader's properties, and those below will not.  If another shader has been assigned to the Main Input of the Default shader, then the other shader will show through in those areas.  If nothing has been assigned to the Main Input, the results will be black in the areas with an opacity value less than 0.5.

Note that in the 3D preview window, the results can look different than the rendered image; which admittedly is confusing.  Additionally, it is sometimes necessary to disconnect and reconnect a node being assigned to the Opacity function in order to see the results "refreshed" in the 3D preview window.

Here are the online docs to these parameters:
https://planetside.co.uk/wiki/index.php?title=Default_Shader_4.5#Opacity_Tab


I think I'm following you.

So do you have any suggestions on how to get a global ocean to be clear enough to give that "tropical" depth falloff? The only way I seem to be able to get it at all is to use a "painted on" depth falloff with an image mask. This sort of works but doesn't properly reflect sunlight based on angle. That pretty blue shallow water near the shore is always visible which it wouldn't be looking straight down at surface when sun is low on horizon. That effect needs a "water" shader.

So, next question. Can a water shader be applied to an entire sphere for a global ocean?

Kevin Kipper

Yes, you can apply the water shader to a sphere object.

Stormlord has posted some in-depth tutorials that include water and shorelines too:
https://planetside.co.uk/forums/index.php?action=profile;area=showposts;sa=topics;u=18809

Dune

A lot is possible in Terragen, it's a terrific playground, and if you like experimenting, there's a ton to be learned. You can add a glass/water shader to a sphere same size as earth, but also make certain parts 'invisible', other parts non-transparent. And combine this stuff in crazy ways. Like this freakshow  ;D Beware that I unchecked defer all.

AlianaAR

Quote from: Kevin Kipper on September 26, 2024, 04:31:59 PMFirst create an image based on your planet texture map that can be used to mask areas on the planet.  It would sort of look like an alpha channel of the planet's continents.  The continents would be white and the ocean area black.  Load the image into an Image Map shader and set its projection to spherical, then change the Y axis Position value to match your planet's Y axis Centre value.

30900_TextureAndMaskMaps.jpg

Connect the Image Map shader to the Mask Shader input on one of Terragen's procedural noise nodes, such as the Power Fractal shader v3.  Now you've constrained the surface displacement to just the continents.

To create different terrains, just change the noise node's Seed parameter.  Of course, you can change any of the noise node's parameters to further change the look of the terrain.

If you want to shift the positions of the continents, try using a Fractal Warp shader to distort the Image Map used to mask the continents.

I have another question about this. When I use the rig you provided the displacement is going negative more than positive. To ask a simple question can you limit or turn off negative displacement from sea level?

I want to use the procedural terrain globally. I just want to displace the continent shapes upward leaving the global fractal terrain as a seafloor but still have fractal terrain generated on top of the displacement.

The rig you provided doesn't do this because the native displacement goes both up and down.

Kevin Kipper

I'm not clear about the rig you're using, but if you're using the Power fractal shader to displace the terrain, try checking the Adjust Coastline checkbox and then adjust the Coastline altitude and Coastline smoothing values to your liking.  These are found under the Displacement tab of the shader.
https://planetside.co.uk/wiki/index.php?title=Power_Fractal_Shader_v3#Displacement_Tab

AlianaAR

Okay, perhaps I'm asking the question incorrectly. I'll use the attached profile diagram and image to explain what I want to do.

Main goal: Create an exoplanet with islands and continents shaped the way I want them. This must be done with procedural surfaces so no matter what the camera altitude, i.e. near surface, low orbit, or planet wide view all hold up. The random seed terrain is great. I don't mind that but want it done only on dry land.

The only method thus far where I've gotten the dry land shape I want is with a displacement image map. I can get the dry land to displace in my custom shape, however in order to get a very gradual depth falloff I have to turn the global displacement down so low it creates all kinds of odd errors in the render.

This needs a global ocean. I want to be able to control level of displacement for dry land and the seafloor separately. The native displacement of the fractal terrain displaces random both up and down in elevation. I don't want it to go down so far you lose the depth falloff as view from low orbit or a whole world view.

The planet image below is Scarif from Star Wars: Rouge One. I want my planet to look this way but with the landmasses shaped the way I want them that holds up no matter the camera altitude.

Yes, I've played with the Adjust Coastline function. However, it seems that moving the coastline up in altitude is very limited and directly related to the amount of displacement in the PF shader.

Question 1: Can the random negative displacement of the Power Fractal Shader v3 be turned off or limited? If so how.

Question 2: Can displacement for terrain elevation be controlled selectively, vs globally when using a PF?

Possible solution - Will using two planets in the same location that are the same size give me the controllability I want? Or will that have bad results? Planet 1 for above sea level and planet 2 below?


AlianaAR

****UPDATE****

I'm starting to have substantial success. I've discovered it's all about the displacement map image!

I'll be working all night..I'm quite excited to have solved this major issue. I'll post a pic when I have some fine tuned results.

Dune

If you use a soft enough map the transition can be regulated through color adjust shaders, and you can use different seeds/fractals/displacement maps for bathymetry or dry ground, using that map as mask or inverted mask. Even use a third fractal for transition areas. So a lot is possible.
Also, displacement can also be fed by color, preferably unclamped. A (blue) smooth step can be used to 'flatten' peaks in a smooth way.

AlianaAR

Quote from: Dune on October 04, 2024, 02:08:57 AMIf you use a soft enough map the transition can be regulated through color adjust shaders, and you can use different seeds/fractals/displacement maps for bathymetry or dry ground, using that map as mask or inverted mask. Even use a third fractal for transition areas. So a lot is possible.
Also, displacement can also be fed by color, preferably unclamped. A (blue) smooth step can be used to 'flatten' peaks in a smooth way.

I wish I knew how to do any of that. Lol. I wish there was a tut out there on how to shape your landmasses the way you want them without sacrificing closeup terrain detail and cloud use. The biggest thing I can't get my head around is controlling displacement direction. It seems displacement will only go both ways along the Z axis. Is this changeable/controllable?

In other words if sea level is 0m, how can I get the default terrain displacement to only go UP, not down as well below a set limit? If this can't be done it's a major limitation that certainly needs to be on the list of enhancements. For a program this capable how can there be no way to limit negative displacement?

So let's say the seafloor is an average depth of only 304 meters for a small habitable moon. Is there a way to set the max negative displacement to stop the random seed from creating deep holes that far exceed that average? If so, how exactly is this done?

I've managed to get the basic look of what I want but this rig has a few major issues. The only way I was able to get the custom land shapes with the default terrain enabled was to use a grayscale displacement map in my landmass shape and crank up the displacement to 25000 meters. Go much lower then because the default terrain engine displaces up and down (which makes no rational sense whatsoever) the only way to get the landmass shape intact was a LOT of displacement that pushed up the default terrain high enough above the ocean sphere that it was all on dry land.

This creates a substantial issue with terrain detail and cloud functionality. Basically, making those useless. From my experimenting thus far it seems there is no controllability for procedural terrain max/min altitude beyond random seed that includes negative altitude displacement that cannot be turned off or limited. If this can be done please! Someone, for the love of the King and all that is holy give me a step by step or a link to a tut that explain this in detail!

Why is it so difficult to create custom landmasses in conjunction with the full procedural functionality of the software with a global ocean that has realistic depth falloff? Low orbit is really the pinnacle of success here. Creating beautiful terrain down low near surface level is easy. Creating gorgeous full planet views is as well. Yet getting a low orbit shot with all details isn't simple. The key is control over displacement direction within the PF shaders.