basic terrain modifications, like 'chop off the peaks', eludes me

Started by shadowphile, September 13, 2009, 08:24:50 pm

Previous topic - Next topic

Volker Harun

I try to give you 1:1 instructions ... as I skipped  8) 8) 8) a few steps for a good setup:

1. Get you PoV
2. Last shader should be an image map shader with a bright coloured bitmap (i.e. pure Pink)
3. keep the image map to camera projection and use your render camera (the whole field of view (FOV) turns pinkish ... good  ;D )
4. Create a new camera turn it 90° down and place it over your area of interest with use 'Orthographic'
5. plug the orthographic camera into your render node and change the image width and height to i.e. 800 / 800.
6. Move the orthographic camera around and adjust its width until you get the most of the pinkish area into the view.
7. Write down the width of the ortho-camera and its position, these will be the values of your new heightfield.
8. Plug your render camera back into the render node and delete that ugly image map shader of Step 2

9. Create a heightfield shader and add a 'Heightfield generate' to its 'Heightfield'-input
10. Disable the 'Flatten surface first' in the heightfield shader (I am not sure!?!?!)
11. Disable the 'Fractal detail' in the heightfield shader

13. In the Heightfield generate do the following:
13.a. The size in metres is the width of the ortho camera
13.b. The numbers top if these are the resolution of the heightfield use i.e. 4096 and 4096
13.c. I do not know if this is necessary, but I always set the 'Feature scale' to 0 ... same with the variation in the Tweak-tab
13.d. in the 'Use shader' tab ... plug in your terrain .... insert the location of that ortho-camera
13.e. I am not sure, but I would set the Position to center.
13.f. Press the generate now button
13.g. After the build process do a right click on the Heightfield generate-node and do a 'Save file as ...'
13.h. Save both Ter and Exr ... keep an eye on the file-extensions.

14. Delete the heightfield-generate and add a heightfield-load, load the Ter file of 13.h.
15. You might need to set the position of the heightfield in the heightfieldshader.
16. Into the blending shader of the heightfield plug in a new imagemap shader, use camera projection and the ortho camera.
17. Load the .Exr-image (or converted to BMP, etc.)

18. I hope that I did not forget anything ;)

Volker

domdib

Very comprehensive - thanks!

Will give it a shot. I've also tried the option of plugging the Terrain node into the Shader input of a Heightfield Generate, as suggested by Oshyan here: http://forums.planetside.co.uk/index.php?topic=7223.msg78184#msg78184
but unfortunately, the TER file this produces has a few holes, and I don't think there's any easy way to fix that. Unable to replicate the problem - seems TER files are fine produced in this way.

rcallicotte

This could be useful in the TG2 wiki.  Eh?


Quote from: Volker Harun on September 16, 2009, 11:46:06 am
I try to give you 1:1 instructions ... as I skipped  8) 8) 8) a few steps for a good setup:

1. Get you PoV
2. Last shader should be an image map shader with a bright coloured bitmap (i.e. pure Pink)
3. keep the image map to camera projection and use your render camera (the whole field of view (FOV) turns pinkish ... good  ;D )
4. Create a new camera turn it 90° down and place it over your area of interest with use 'Orthographic'
5. plug the orthographic camera into your render node and change the image width and height to i.e. 800 / 800.
6. Move the orthographic camera around and adjust its width until you get the most of the pinkish area into the view.
7. Write down the width of the ortho-camera and its position, these will be the values of your new heightfield.
8. Plug your render camera back into the render node and delete that ugly image map shader of Step 2

9. Create a heightfield shader and add a 'Heightfield generate' to its 'Heightfield'-input
10. Disable the 'Flatten surface first' in the heightfield shader (I am not sure!?!?!)
11. Disable the 'Fractal detail' in the heightfield shader

13. In the Heightfield generate do the following:
13.a. The size in metres is the width of the ortho camera
13.b. The numbers top if these are the resolution of the heightfield use i.e. 4096 and 4096
13.c. I do not know if this is necessary, but I always set the 'Feature scale' to 0 ... same with the variation in the Tweak-tab
13.d. in the 'Use shader' tab ... plug in your terrain .... insert the location of that ortho-camera
13.e. I am not sure, but I would set the Position to center.
13.f. Press the generate now button
13.g. After the build process do a right click on the Heightfield generate-node and do a 'Save file as ...'
13.h. Save both Ter and Exr ... keep an eye on the file-extensions.

14. Delete the heightfield-generate and add a heightfield-load, load the Ter file of 13.h.
15. You might need to set the position of the heightfield in the heightfieldshader.
16. Into the blending shader of the heightfield plug in a new imagemap shader, use camera projection and the ortho camera.
17. Load the .Exr-image (or converted to BMP, etc.)

18. I hope that I did not forget anything ;)

Volker

So this is Disney World.  Can we live here?

Volker Harun


domdib

EDIT: I seem to have been mistaken about this problem - I'm unable to replicate it. Sorry for misleading anyone!

Matt

shadowphile,

Sorry I didn't get to this earlier. There is a way to do this but I know that the process is not transparent enough.

The basic concept is as follows. You have some terrain which is generated by shaders. Follow that with a Displacement Shader ("Add Terrain" -> Dislacement Shader -> Displacement shader) to perform the modification. The displacement function needs to: 1) get the current altitude (it's in metres or world units); 2) modify it using scalar functions; 3) subtract the original displacement so that the function result can be applied as a straightforward displacement of the original surface without doubling up the original displacement.

Here's a screenshot of a network that simply clamps a powerfractal terrain to a maximum altitude of 200. The constant scalar node has the value 200.

[attachimg=1]

There may be situations where this doesn't work as expected, e.g. if the terrain you want to modify is a displacement along some unusual direction and is therefore not simply generating altitude. In those cases you may need to get creative with the 'get' nodes to retrieve displacement vectors and modify those.

Matt
Just because milk is white doesn't mean that clouds are made of milk.

Henry Blewer

Matt, I like this solution. It's simple enough for someone with moderate experience to use. I also appreciate that you did not relabel to node functions. 8)
http://flickr.com/photos/njeneb/
Forget Tuesday; It's just Monday spelled with a T

Volker Harun

I like to be prooven wrong ... sorry that I mislead you, folks, I was sure that this node-setup would not work.

Matt

This is obviously something that I want to make easier and more intuitive. The setup I suggested is pretty simple and allows almost any kind of function-based modification of altitudes, but you have to think along particular lines to come up with the idea in the first place. So my question to anybody reading this is: how would like you like to see the interface work for general modifications of terrains by altitude? It needs to allow general function modifications like the above, in addition to any other easier methods which might be included. While a shader that allows you to perform basic modifications or to draw an altitude profile curve would be great (and may come in future versions), we also need a more intuitive way to utilise function nodes like the setup I showed above, but without the counter-intuitive node setup.

(I hope you don't mind me hijacking your thread, shadowphile. I hope you find the example I posted useful.)

Matt
Just because milk is white doesn't mean that clouds are made of milk.

Matt

Quote from: shadowphile on September 13, 2009, 10:49:48 pm
Let me be more clear: the examples I find always generate data from scratch using the position data, but I would like to interrogate an established shader and either change it directly or generate a new shader that is the result of my applying the function to the shader results.


The 'get' functions, such as "Get position in texture" or "Get altitude" query the current state, which stores information about the surface at the current point in the shading/displacement pipeline. Shaders, such as the Displacement Shader, change these values, so the values depend on what shaders have already been called earlier in the shader pipeline. Functions alone do not change these values - they perform maths operations on whatever values you provide them with, but they need to be plugged into some kind of shader to actually modifiy the surface, cloud, or whatever is being shaded. When you have a network of functions providing information to a Displacement Shader, the 'get' functions retrieve information about the surface being shaded by the Displacement Shader. Basically, information about the surface includes changes that were made by all the other shaders that provide input to the Displacement Shader (in my example they are the Power Fractal Shader and the Heightfield Shader.) Usually, the main 'input' connection of a shader is evaluated before any of the other inputs. If your function network were a RenderMan shader written in the RenderMan shading language, the 'get' functions would be the equivalent of the variables P, Pg etc. or simple relationships between these variables as in the case of "Get altitude", dot(P - Pg, Ng).
Just because milk is white doesn't mean that clouds are made of milk.

cyphyr

I think the problem lies not with the interface but with our lack of knowledge of the program. This is not meant as a criticism but more a simple statement of "fact", well at least as I see it :) You and the developers have a vastly deeper understanding of how the program works from the inside looking outwards. You understand its inner workings. I as an artist see the program from a different perspective.

The solution you posted above is so simple and effective and also one that the best of  us couldn't come up with. :( I don't want to change terragen. I like it just the way it is. The interface is unusual, but no more than any other node based graphics program, XSI, Lightwaves shader networks and even the internal node editor in Vue. I'm learning a lot about the concepts behind some of the functions now, Volker and others have been incredibly helpful but still large areas elude me. What the solution? Not really sure, but don't change the interface please, its too useful to have it open ended like this :) Wasn't that one of you "tenets", to allow the user to put pretty much any value, any combination of nodes together? :)

The best I can come up with is keep pushing the Terragen wiki, keep encouraging the community to share its knowledge and just possibly (if you've gut the time lol) start writing (or adding to the wiki) your "insiders view" of a guide, something that doesn't treat "functions" as a separate subject. :)*

Waffle over :)

Richard

*like you just wrote lol :)
www.richardfraser.co.uk
https://www.facebook.com/RichardFraserVFX/
/|\

Ryzen 9 3900X @3.79Ghz, 64Gb (TG4 benchmark 6:20)
i7 5930K @3.5Ghz, 32Gb (TG4 benchmark 13.44)

Matt

Just because milk is white doesn't mean that clouds are made of milk.

mogn

Matt, thanks for the explanation. It is difficult to understand how the altitude can be used to modify the altitude, without
understanding the order of calculations.

Henry Blewer

I've used ramp curves for many things (Curve Editors). The ability to add points to a curve and move them would be nice. It could be used for almost anything, from strata, altitude/slope, color, and power fractals. It could be used as an input or blending shader, and adapt to the function/s it's being called for.
http://flickr.com/photos/njeneb/
Forget Tuesday; It's just Monday spelled with a T

rcallicotte

No, no.  You.  It's yours.  You get credit.  I'm not the Ghost Author; you are.  Get the credit, sahib.



Quote from: Volker Harun on September 16, 2009, 02:49:34 pm
@Calico: Feel free to add it :)
So this is Disney World.  Can we live here?