Heightfield from Procedurals.

Started by scrambled2, November 07, 2012, 04:15:05 PM

Previous topic - Next topic

scrambled2

I apologize for my onslaught of questions on here, but Terragen has be quite excited. My current situation is this.
I have created a procedural terrain with fractals, painted shaders..ect. I am happy with it. I would like to use some of the heightfield operators for things like erosion...ect.
Is there a way to affect by procedural terrain with these operators? Can I convert the procedural terrain to a heightfield? Or would would be the best way to go about this?
Thanks for all your help. This forum is fantastic.

Chris

Oshyan

Hi Chris, glad to hear you're enjoying Terragen. Welcome to the community!

It's pretty easy to convert procedurals to heightfield, you just need to be aware of the consequences which are that you lose any information that can't be represented in the 2D/planar heightfield, i.e. overhangs, and that the resolution of the resulting heightfield is finite, unlike the procedurals that you're generating it from. So you can potentially lose some terrain features and some detail doing this. You can add back in procedural detail over the top of your heightfield terrain later however and possibly regain some of what you lost. This in fact suggests the best practice for how to approach this which would be to put your heightfield conversion and operations in the top or middle of your terrain network, where you've created the major terrain features, but are not yet creating fine details; this way you don't lose real detail and can effectively add on more detail afterward without wasting processing time on features that get lost.

In any case, to convert procedural to Heightfield, use a Heightfield Generate node and feed the output of your procedural terrain network into the Shader input for the Heightfield Generate. Then set the size and resolution in the Heightfield Generate: "Number of Points" is the heightfield resolution in pixels, higher values give more detail and a more faithful representation of your procedurals, but also use more memory and take longer to calculate; "Size in Meters" sets the area of coverage, since a heightfield terrain is finite, unlike procedurals, you need to set how large an area will be converted to heightfield in your scene, and this setting works together with "Number of Points" to define the resolution-per-area of the resulting heightfield. You can see the bounding box of the heightfield in the 3D preview to work out the size you need. Once you've sorted these settings out to your liking, just hit Generate and it will process the Shader inputs to create a resulting Heightfield. You can then run Erosion and other Heightfield operators on it. You can also apply procedurals further down the shader network to add in additional detail or effects that can't be represented in a heightfield (e.g. overhangs).

- Oshyan

scrambled2

This is uber helpful thank you! I will try this and play around with it. The customer service here is fantastic! I thank you again.

Chris

Oshyan

You're welcome. Let us know how it goes.

- Oshyan

scrambled2

It's incredible how much faster the heightfield renders vs the procedural. I used 2000x2000 points and I am getting an acceptable result based on my cameras POV. The test render went from 46 seconds to 11! Has anyone done in-depth tests comparing the render times of heightfields vs procedurals?

Chris

TheBadger

QuoteHas anyone done in-depth tests comparing the render times of heightfields vs procedurals?

Its very unlikely. The uses of each are pretty specific. So it should not mater if one can render faster than the other. People use the method they need for the task. So if you need an entire planet it does not mater at all if a heightfield would render faster.

I suppose its posible to construct a test where things could be made very similar, but the results would not be very useful. Because in order to apply the findings, you would have to preform the same test with every new situation.

If you just want to know of certain situations that will render fast regardless of the details, rendering from high orbit, and outer space always goes very quick.
It has been eaten.

Tangled-Universe

Quote from: scrambled2 on November 07, 2012, 07:24:24 PM
It's incredible how much faster the heightfield renders vs the procedural. I used 2000x2000 points and I am getting an acceptable result based on my cameras POV. The test render went from 46 seconds to 11! Has anyone done in-depth tests comparing the render times of heightfields vs procedurals?

Chris

Yes I did and I can verify your results.

What I sometimes do is that once I have the scene layed out, I export the terrain to .ter and replace the procedurals with it.
This is indeed faster.

You can even go a bit further by using a big plane object as planet. You need to keep the planet node for its atmosphere but the terain input is not used.

scrambled2

Thanks for the tips guys! Much appreciated!

C

penboack

Is the additional render time for the procedural terrain compared to the Heightfield a kind of fixed amount? If so it won't make much difference to the overall render time once you've added all the textures, populations, setup higher quality render settings and pushed the render time up to 1 to many hours per frame ;)

This workflow is a very useful way of integrating Terragen 2 with other 3D applications, as it provides a means to export part of a procedural terrain to use in something like CINEMA 4D, or Maya.

Tangled-Universe

Quote from: penboack on November 13, 2012, 09:45:30 AM
Is the additional render time for the procedural terrain compared to the Heightfield a kind of fixed amount? If so it won't make much difference to the overall render time once you've added all the textures, populations, setup higher quality render settings and pushed the render time up to 1 to many hours per frame ;)

This workflow is a very useful way of integrating Terragen 2 with other 3D applications, as it provides a means to export part of a procedural terrain to use in something like CINEMA 4D, or Maya.

No it is definitely NOT. I don't know what you mean though with if it was proportional, but since it's not proportional it doesn't matter.

If you have 5 powerfractals defining the shape of your terrain and you convert that into 1 single heightfield, then you "condensate" a LOT of data into a single small file with a much lower footprint as only altitude information is stored instead of normals, vectors and all the coordinates for every succeeding fractal.

Thus, the more fractals you have, the slower. That's a general thing in TG2 and probably in any 3D application.

One must be aware though that the biggest disadvantage of a heightfield is the lack of lateral displaced structures (which create overhangs and such) and detail.

penboack

What I am trying to ask is if you add clouds and water to a scene and increase the atmosphere sample and other related settings to improve the render quality will the time taken to calculate the procedural terrain be approximately the same as it was before these elements were added and will therefore be a smaller proportion of the render time or will it increase with the complexity of the scene?


Tangled-Universe

So basically you're asking if in general other elements than terrain take longer to render?
If you use a heightfield instead of a powerfractal terrain the relative time to render the terrain will decrease.
Everything else is very dependant on scene design and how exactly you push those settings you mention. It's impossible to say.
I know this is not really the answer to your question.

I don't know how exactly TG2 samples the atmosphere, for example. I suppose it's doing that after mesh creation,  shading and then casting shadows.
I suppose its working that way, since the render element has an option to save RGB before atmosphere and shadows. So along that order of calculations the render element offers output of render stages.
So I suppose the more complex the terrain is the more "complex" the subsequent calculations will be. In other words, you need higher atmosphere sampling when there's a lot of detail in your terrain and thus in the shadow areas (as those areas are the ones that show lack of atmosphere samples the most obvious).

The general answer remains the same though: Everything is very dependant on scene design and how exactly you push those settings you mention. It's impossible to say.