Planetside Software Forums

General => Terragen Discussion => Topic started by: dhenry2112 on January 16, 2017, 02:57:04 PM

Title: Fake stones on a heightfield issue
Post by: dhenry2112 on January 16, 2017, 02:57:04 PM
I am running into an issue that is new to me. I have a fractal terrain to which I have imported a height field map from world machine and then applied height field erode and then added a strata and outcrops shader.
Beyond that, I have added several surface layers for colors only.
I am trying to add a layer of fake stones which should sit ON TOP of the surface layers but no matter what approach I take, my stones are showing up as displacement to the terrain and are not properly textured. I have tried both a direct fake stone shader node link as well as plugging the stones in as a child to an additional surface layer (this is what I want anyway because I plan to merge multiple stones layers).
The only culprit I can think of is that its an issue with the height field because without one, my fake stones function as intended.
In the image im just using the fake stones color option to color them white and have no further displacement on them. As you can see, the white color is only appearing on the tops of the stones and the other surface layers are bleeding into them.
Its almost as if the slope constraints in the surface layer which are intended to limit the stones are also somehow limiting the texture of the stones themselves?

Am I missing something here that needs to go after my height field possibly? I tried adding a compute terrain and/or compute normals after the chain of surface layers but that had no effect. Do I need to merge all those surface layers for colors down into one?

If anyone can clue me in on what I might be missing and actually explain how to correct the problem in a way that can be understood by someone who is still learning I would be most grateful lol.
Thanks in advance.
Included a render image, node connections, .tgd and height map (Could not load the .tiff height map as its too big. Just revert it back to a .tiff)
Title: Re: Fake stones on a heightfield issue
Post by: fleetwood on January 16, 2017, 08:53:03 PM
In the fake stones shader don't check the box where it says "Apply color". You had it set on and to pure white. If you uncheck it the planet surface colors will be used on the stones.


A couple other things jump out. Only the final Compute Terrain is needed. The extra one will slow things down and isn't needed.
Several of your surface layers are using power fractals with both high and low color turned on. When blending layers, better to only turn on the high layer. Having both high and low active tends to overwrite the previous layer and almost completely wipes out any earlier layers.

Also if you want to blend surface layers don't set the surface layer coverage slider all the way to 1.  Keeping the coverage slider near the middle allows better blending and also works more effectively on fractal breakup.   
Title: Re: Fake stones on a heightfield issue
Post by: dhenry2112 on January 16, 2017, 09:16:37 PM
Thank you very much for the info Fleetwood.

"In the image im just using the fake stones color option to color them white and have no further displacement on them. As you can see, the white color is only appearing on the tops of the stones and the other surface layers are bleeding into them."

I had the apply color checked to show how the color does not cover the entire stones. The other surface layers bleed over onto them. I dont want the planet shaders on my rocks. The issue is that I want to color the rocks independently and neither the fake stones apply color, nor using a power fractal as a color input for the fake stones solves the issue.
I have a lot of surface layers. Are the rocks picking up all of them?

In other projects I've never had an issue with being able to texture my stones independently using power fractals, regardless of how many surface layers I used. The only difference with this project is that this is the first time Ive used an imported height field map. (Just got world machine a couple weeks ago).



Title: Re: Fake stones on a heightfield issue
Post by: fleetwood on January 16, 2017, 10:32:18 PM
Well if you want independent color or displacement on the fake stones you would connect the colors to the fake stone input that is labeled "surface layer".
A big part of the problem is your masking set up.  In the distribution shader you have the slope limited to 30 degrees or less. Use Planet/object normal as the slope key instead of Final normal. What is happening with using final normal in your set up is that slope is being applied to slope of each stone so the planet colors are being restricted to the less than 30 degrees or less which is the under part of the stones and the white applied color is showing on the top parts.

A useful way to set up fake stones is to make them the child of a surface layer that has its color unchecked. This isolates the stones color from the planet better and you can then use the altitude and slope restrictions of the surface layer itself so you don't need a separate distribution shader mask just for that. You should still use Planet/object normal as the slope key to have the colors appear all over the stones.   

Here is an example of what I mean.
Title: Re: Fake stones on a heightfield issue
Post by: fleetwood on January 17, 2017, 07:58:32 AM
One additional thing. The erode heightfield is out of place in your terrain section.
When you want to erode a heightfield, you connect the erode after the heightfield you have loaded and then run the erode by clicking "erode now". It will take some time (seconds to many minutes depending on the strength) for the erode to run. Putting the erode first means it is receiving no input to work on.
Title: Re: Fake stones on a heightfield issue
Post by: dhenry2112 on January 17, 2017, 10:55:50 AM
Many thanks my friend. You have enlightened me to many things I was unaware of but make total sense.
I had suspected the fake stones texture issue was something to do with the slope constraints in the surface layer they were plugged into.
I'm reading up on slope key settings in order to better understand how it works.
Will be working with your suggested approach this afternoon.

Makes total sense as well that the erosion needs to be after the heightfield otherwise its applying erosion to nothing.

I think in many cases on my projects Im off to the right start but there are simple things which I either overlook or dont quite yet fully understand and its nice to have people like you whom I can show my files to and find out where I'm making mistakes.
Thanks again for your help and I'll be sure and share a render when it done! Now on to clouds and atmosphere so I can start formulating more questions :)
Title: Re: Fake stones on a heightfield issue
Post by: penboack on January 17, 2017, 03:16:38 PM
Very interesting, thanks for posting.

What does the 'Tex coords from XYZ 01" do in the shader network?
http://www.planetside.co.uk/wiki/index.php?title=Tex_Coords_From_XYZ (http://www.planetside.co.uk/wiki/index.php?title=Tex_Coords_From_XYZ)
Title: Re: Fake stones on a heightfield issue
Post by: fleetwood on January 17, 2017, 04:41:23 PM
Quote from: penboack on January 17, 2017, 03:16:38 PM
Very interesting, thanks for posting.

What does the 'Tex coords from XYZ 01" do in the shader network?
http://www.planetside.co.uk/wiki/index.php?title=Tex_Coords_From_XYZ (http://www.planetside.co.uk/wiki/index.php?title=Tex_Coords_From_XYZ)

It ensures that world space is being used on the stone colors. It isn't necessary in this example but I just forgot to remove it. Kind of like wearing a belt and suspenders.
Title: Re: Fake stones on a heightfield issue
Post by: penboack on January 17, 2017, 08:26:41 PM
Thanks for the clarification.
Title: Re: Fake stones on a heightfield issue
Post by: bobbystahr on January 18, 2017, 09:56:23 AM
Quote from: fleetwood on January 17, 2017, 04:41:23 PM
Quote from: penboack on January 17, 2017, 03:16:38 PM
Very interesting, thanks for posting.

What does the 'Tex coords from XYZ 01" do in the shader network?
http://www.planetside.co.uk/wiki/index.php?title=Tex_Coords_From_XYZ (http://www.planetside.co.uk/wiki/index.php?title=Tex_Coords_From_XYZ)

Kind of like wearing a belt and suspenders.

hee hee hee, good analogy
Title: Re: Fake stones on a heightfield issue
Post by: dhenry2112 on January 19, 2017, 12:31:05 PM
Ok, another quick question here...

I'm working on my rocks and river gulley but the problem Im running into now is that I am finding I need to apply smoothing to my surface layer that is the parent to all my merged fake stones shaders in order to have them function properly. However, this is having unwanted effects because it is applying smoothing to my height field and killing my erosion and strata features.
Is there a way around this by applying smoothing to the parent surface layers further up in the chain before the merge shaders?
I can limit the altitude of the smoothing in the surface layer which helps to some degree but I really don't want to lose my lower altitude features either.

I've included an updated file in which I have corrected all the mistakes which you previously pointed out.
It's my "experimental" version of the file.
Title: Re: Fake stones on a heightfield issue
Post by: fleetwood on January 19, 2017, 02:51:03 PM
The smoothing used in surface layers is based off the Compute Terrain and the patch size used there. If the default patch of 20 meters is resulting in too much smoothing, you can try lowering the patch size to 10 or 5 or 1 and see if that helps out. Try to avoid inserting any new Compute Terrains or Compute normal nodes as they make the render slow down.

In your new file you have fractal breakup attached to your fake stone surface layers. IMO Fake stones don't need or even look good with fractal breakup applied to the layer, it's just an extra complication so unless it gives some special effect I would not use the breakup fractals at all, I would just disconnect and delete them.

Your largest 3.5 meter stones aren't showing up at all due to having both a restricted minimum altitude setting and then sending them to the merge highest. The multiple restrictions just eliminate them altogether.
 
Generally I think there are too many separate stone restrictions which gets very "fiddly". Merge highest shaders by themselves keep stones from landing on each other and in my opinion setting the altitude and/or slope in the last surface layer where all the stones are combined is usually enough to look natural. Too many interacting restrictions obviously can get out of control because what we visualize doesn't always match what goes on when the shaders are processed at render time.
Title: Re: Fake stones on a heightfield issue
Post by: dhenry2112 on January 19, 2017, 05:40:08 PM
When using the parent surface layer as the sole method of controlling the slope and altitude of the stones, those settings also constrain the smoothing effect. Could I plug in another surface layer above the parent layer for the fake stones and have it do nothing but apply smoothing so that it is unconstrained?
Title: Re: Fake stones on a heightfield issue
Post by: fleetwood on January 19, 2017, 08:49:33 PM

Without knowing what look you want or don't want it's hard to say much  :)

You could put a compute normal right after the last merge shader of your stones and then that becomes the closest recent terrain calculation so it will be used. But again the patch size will determine what changes happen to the stones and the terrain they sit on. Large sizes making things smoother and small making them rougher.

If by chance you are looking to get rounder stones the extra compute normal is not the way to go as it can jump the render time way up.

For rounder stones add some displacement offsets in the displacement tab of the stones color fractals. Think of the stones as little footballs and the offsets are like pumping air in to them. A negative offset will shrink them and positive offsets will inflate them. You can play with the amounts and the spike and roughness settings.
Title: Re: Fake stones on a heightfield issue
Post by: dhenry2112 on January 20, 2017, 01:23:55 AM
Ill post some more renders and explain in greater detail tomorrow what my overall project is all about but it's late and I gotta sleep. I have mentioned it in other posts in the past but I am doing an animated video and I will be doing both fly through scenes as well as close up shots which will be composited in After Effects with character animations rendered in 3D Max.

Here is an early example:
https://www.youtube.com/watch?v=SeY3z7CjtNE

I'm getting close to what I want in this render but first of all, I do not like the strata and outcrops being applied after the height field erosion. I tried DK's erosion plugin and I think it works on a scale too large for what I need as I could not find any parameters that didn't almost flatten my height field. I'm looking to get a more natural gradient in the strata that doesn't look so "minecraft".
I would also like the larger rocks to cluster more around the bottom slopes of the mountains, with smaller sizes of rocks as you get deeper into the gully. ie: big rocks break off, then smaller rocks from them etc and then you have the finest rocks in the deepest areas due to past water flow.
Title: Re: Fake stones on a heightfield issue
Post by: dhenry2112 on January 20, 2017, 01:46:37 AM
The thought just occurred to me that it might be possible to use my heightmap as a mask to run a distribution shader perhaps? Would be most interested in the best way to achieve this.
Title: Re: Fake stones on a heightfield issue
Post by: Dune on January 20, 2017, 02:56:10 AM
2 notes: you can use the tallness function to make a transition from small stones to larger by using a distribution or (white) surface shader with a soft altitude setting as a mask/function. And secondly; your PF's still have the default sizes when applied as displacement for your stones. It's better to relate those sizes to the rock sizes. So for any rock, set highest size to about the rock size, average size about 1/3 or 1/4 of that, depending on how detailed/rough your displacements need to be.
Offset is indeed handy to blow them up, but beware; if you blow them up too much the calculated triangles don't get proper XYZ information. You might have to add an XYZ shader after it to get good further displacements again.
Title: Re: Fake stones on a heightfield issue
Post by: penboack on January 20, 2017, 09:06:02 AM
That video look cool, I shall be very interested to see the final result.
Title: Re: Fake stones on a heightfield issue
Post by: dhenry2112 on January 20, 2017, 12:55:24 PM
Quote from: Dune on January 20, 2017, 02:56:10 AM
And secondly; your PF's still have the default sizes when applied as displacement for your stones. It's better to relate those sizes to the rock sizes. So for any rock, set highest size to about the rock size, average size about 1/3 or 1/4 of that, depending on how detailed/rough your displacements need to be.

I am trying to ascertain exactly which parameters match what you are describing as there are no parameters labeled as "highest size" or "average size":

What controls highest size? Would this be the feature scale? So if the scale slider for my rocks is set to 3.5 then my power fractal feature scale should be 3.5 as well?
What controls average size? Is it lead in scale? smallest scale? Displacement amplitude?

I very much appreciate the help. I just need a bit more clarification in order to understand what you are telling me.
Title: Re: Fake stones on a heightfield issue
Post by: bobbystahr on January 20, 2017, 02:25:53 PM
Quote from: dhenry2112 on January 20, 2017, 12:55:24 PM
Quote from: Dune on January 20, 2017, 02:56:10 AM
And secondly; your PF's still have the default sizes when applied as displacement for your stones. It's better to relate those sizes to the rock sizes. So for any rock, set highest size to about the rock size, average size about 1/3 or 1/4 of that, depending on how detailed/rough your displacements need to be.

I am trying to ascertain exactly which parameters match what you are describing as there are no parameters labeled as "highest size" or "average size":

What controls highest size? Would this be the feature scale? So if the scale slider for my rocks is set to 3.5 then my power fractal feature scale should be 3.5 as well?
What controls average size? Is it lead in scale? smallest scale? Displacement amplitude?

I very much appreciate the help. I just need a bit more clarification in order to understand what you are telling me.

I think Dune is referring to Feature scale, Lead in scale and Smallest scale...
Title: Re: Fake stones on a heightfield issue
Post by: fleetwood on January 20, 2017, 04:16:33 PM
I guess I will chime in. There are several different things being talked about,  Tallness function, Scale function, and more basically what scale of PFs to use for fake stone displacements/ or colors.

When sending input to the tallness and/or scale functions white equals 1 and black equals zero, so whatever gradation mask or altitude distribution mask or PF  you feed in will alter the fake stones basic tallness or scale according to the whiteness level in the spot were that stone occurs.  It you have a set of 1 meter scale fake stones originally and then feed the scale function input a 50 percent gray constant all the stones will now be half a meter. If you feed in a Pf the stones will vary between full 1 meter and zero or they could actually go greater or  negative if you were to feed in unclamped values.

The other item being talked about is simply the colors and displacements applied to the fake stone surface input. The "feature" scale in a PF is the "average", the lead-in will be the largest massed or clumped areas, and the smallest sets the tiniest details . For a one meter stone I would  usually choose average feature scale somewhat smaller than one meter. These are things you can easily see in the fractal previews just scale the window to a 1 meter or 3 meter area and see what results you get as you change the scales up and down, but stones may be very plain if the features are too big for them.

Separate from the PF scales is the amount of displacement set in the displacement tab of the PF. It should be chosen to be appropriate for the stones you are defining. A one meter stone may only need 0.3 of displacement or less. Different looks can be gotten with negative displacement.  Leaving displacement at the default of 1 may be too much. Again you can quickly use the fractal or stone preview window to see if the displacement is ugly or too great or too small or causing spikes. And there are also the roughness and spike limit settings to work with as well as continue spike limit.

  For a 0.2 size stone trying to use 1 meter displacement will most likely be way too much resulting in blown up or spiky stones.
Title: Re: Fake stones on a heightfield issue
Post by: dhenry2112 on January 20, 2017, 06:16:01 PM
Excellent and again, many thanks to all of you for your help and for being patient and tolerant of me hehe :)
I am very much looking forward to working on it this weekend and will post some updated results.

Sometimes I wish I could have one of you knowledgeable folk sitting in my office with me to answer questions and explain things lol but the help I have received here on the forums is outstanding.
Title: Re: Fake stones on a heightfield issue
Post by: Dune on January 21, 2017, 01:59:34 AM
Thanks fleetwood for explaining more indepth. Mine was a bit short  :P
Title: Re: Fake stones on a heightfield issue
Post by: dhenry2112 on January 21, 2017, 03:24:49 AM
I spent several hours tonight playing with rocks and power fractals. My 3.5m rocks now have a feature scale of 2.3, lead in 1 and smallest scale 0.01. I also adjusted the other rocks accordingly, with displacement values adjusted as well. Its definitely looking better and I'll be working with it all day tomorrow. I thought it would be prudent to share an update to show that your help is being put to good use :)
Title: Re: Fake stones on a heightfield issue
Post by: fleetwood on January 21, 2017, 04:35:11 PM
Quote from: dhenry2112 on January 21, 2017, 03:24:49 AM
...My 3.5m rocks now have a feature scale of 2.3, lead in 1 and smallest scale 0.01.....

Rocks looking pretty good.

Not sure if you mistyped or not, but the "normal" set up is to make the lead in scale bigger than the feature scale. Terragen will create a fractal with whatever numbers are supplied, and if you get a good looking result it's not a problem, but logically the lead in is expected to be the biggest. Every default PF is set up that way, but you can for instance set up the numbers all the same or nearly the same scale for specific effects especially when using the voronoi flavor noise to get distinct cell type structures.
Title: Re: Fake stones on a heightfield issue
Post by: dhenry2112 on January 22, 2017, 03:04:33 AM
Results of today's efforts. Didn't get as far along as I would have liked but I can work on it more tomorrow.