evinrude opened this issue on May 02, 2008 · 8 posts
evinrude posted Fri, 02 May 2008 at 12:10 PM
Hi, everyone! Hope you're all doing well.
I'd like to start building my own terrain shaders from scratch. After doing manipulations in the content shaders, I have a pretty good idea what I'd doing. My main questions are: For elevation-affected shaders, how do you determine the actual ultimate altitude of your terrain? Is there a direct correspondence with the altitude in the terrain editor? Or is it based on some coefficient in relation to the scene size?
Thanks!
: )
MarkBremmer posted Fri, 02 May 2008 at 1:11 PM
Scene size is something to pay attention to for terrain shaders.
Patrick_210 posted Fri, 02 May 2008 at 3:17 PM
Terrains are a little funny when it come to shaders. When you create a terrain, say in a large size scene, it will come in at 100% size and it will be positioned with the center of the height at zero on the z axis. But, the elevation functions will start at the bottom of the terrain. Simply put, a terrain that is 2,000 ft tall, will be at listed at 1,000 ft on the Z axis with half above zero and half below zero. But the elevation shader will treat the terrain as if zero is at the bottom of the terrain. If you want to use the numeric positions on the z axis, then you must move up the terrain so that the Z position is the same as the Z height. In other words, a 2,000 ft tall terrain should be at 2,000 ft Z height position. Now when you use the elevation functions, the numeric height will match the actual position. Important: the shader functions will treat the terrain as if it is always at this size and position. That means after you set your shader at these positions, it will look the same even though you stretch it or move it. So, you should create your terrain shader before you stretch it. This is the reason terrain shaders made for a medium size scene don't look right on a terrain created in a large size scene.
Short tute version:
Create terrain, change Z position to be the same as Z height.
Now the elevation numbers will correspond to actual heights to create the shader.
The shader will stay the same now, even if you resize it or change the height position of the terrain. But, at least you will have a relative frame of reference if you want to tweak the shader afterward.
evinrude posted Sat, 03 May 2008 at 1:07 AM
Yes, but how is the height determined? Do you plug in the values in the Motion panel, or in the Terrain Modeling room. For instance, I bring in a terrain in a medium size scene setting. The scaling is 100%, the "size" on the z axis is 5.70 m; in the Terrain Modeling room, the height is 4.57 m. What is the relation between these two? Why the discrepancy? And which of these parameters does the terrain shader respond to?
Is it necessary to do unit conversions? Say, 1 m = 1 km?
To Patrick: How do you get a terrain to be at a height of 2000 ft? How do you plug in the values? In every variant in which I try to increase the height to 2000 ft, I get an EXTREMELY distorted terrain. I've tried this in all scene settings with different units of measurement.
Patrick_210 posted Sat, 03 May 2008 at 8:53 AM
Okay, first lets talk about a large scene setting. This is where you will be able to create a terrain that is 2,000 ft tall. Default terrains in the smaller size scenes are a lot smaller. If you want to work in metric, that's fine, same principles apply. Open a large scale scene, insert a default terrain. In the terrain room the height will say 1,500 ft, but in the assembly room it will say 1,870 ft. The reason is because of the effect of the shape filter and whichever generate filter you use. The size in the assembly room is the exact height, the size in the terrain editor is based on the generate filter and doesn't take into account the shape filters. You should start with a generate filter to get the basic type of terrain you want. This is where you can set a basic height. It won't be exact, because feature size and other filters will affect the height. If you want to create a tall and really wide terrain, you can increase the width and breadth in the world size settings. Any settings you apply in the terrain editor will be recognized by the shader. If you resize the terrain in the assembly room, whether it be by numeric input or dragging the scale tool, those changes will not be recognized by the shader.
Short version:
Start with a large scale scene, insert terrain, use generate filter to set a basic height.
Use other filters to get the look of the terrain you want, check height in the assembly room and adjust generate height if you want get closer to a specific size.
Set up the shader to look how you want it to look, then adjust the exact size in the assembly room to make it a specific height.
Working with heightfields in the terrain editor is not an exact science because you are mixing randomly generated fractal filters and other functions to create the surface. Carrara has a fairly decent amount of flexibility for random terrains, but not so much control over specific placement of features. If you really want to get deeper into terrain generation, I suggest you look at GeoControl. Right now Johannes is recovering from an accident, so I don't think the public beta of GeoControl 2 is available for a little while, but you can look at the site and buy GeoControl 1 I believe.
evinrude posted Sat, 03 May 2008 at 10:18 AM
Patrick, thank you. I'm completely stunned by the clarity of your information. Those are some extremely important facts to know.
That's really rough news about the accident; I hope Johannes makes a full recovery.
ThomasMacCallum posted Thu, 14 May 2009 at 1:30 PM
Very usefull terrain info here thanks all, Aaron, how did you get on with the terrain shaders?
PJared posted Mon, 25 June 2012 at 6:24 PM
When you creat the terrain the height can be determined by the 'Feature Size'. Select the terrain, and go into the model room; you'll see 'Feature Size' on the left hand side.