Exporting tgd file

Started by BigTom, May 05, 2010, 09:03:46 AM

Previous topic - Next topic

BigTom

I have a .tgd file created in TG2 with a terrain that I need to export. I don't see any options to export it in TG2 but I know that Terragen classic will do this. There is a plugin that I've installed there which enables me to export the terrain portion as a .dxf file. My main goal is to have this terrain as a .dxf file. My problem is that I haven't found the way to get the .tgd file into Terragen classic.

Can I save the .tgd file as a .ter file using TG2 and if so, how? Can the export plugin I installed for TG classic be used in TG2?

I'm using the free versions of each program at this point. Is this a problem for me because of the limitations of the freeware? Are the exporting and save as features available in the full versions?

Tangled-Universe

TG2 and TG Classic are very different from each other. Their file-formats, except for the .ter-file, are not exchangeable.

TG2 can export sections of its procedural terrain by either:
heightfield lwo export
heightfield export
lwo microexporter

To use a TG2 generated terrain you'd like to export a section to a heightfield. Yesterday I described that briefly here:

http://forums.planetside.co.uk/index.php?topic=9726.msg101822#msg101822

This should also work in the free version if I'm not mistaking.

Cheers,
Martin

BigTom

Thanks Martin, that info and the link to your other post are answers I need.

In TG2, I right-clicked the Heightfield Generate 01 node and selected "save as" and a window opened up to allow me to save the heightfield as a .ter file but when I clicked "save" an "Erorrs and Warnings" box popped up saying "File not saved". There's no explanation of what went wrong.

Can anyone out there please enlighten me about this?

Tangled-Universe

#3
Can you show a screenshot of your node-network showing how you connected the terrain to your heightfield?
I see Richard also gave you some useful clues here: http://forums.planetside.co.uk/index.php?topic=9746.msg101901#msg101901

Martin

BigTom

Attached is the node network

Tangled-Universe

Ok, I see what's up here:

You have the heightfield-shader at the top of the network, this means that it "generates" a heightfield or displacements as first. Going down along the nodes you add displacement with other nodes/functions. Then when that's finished you add a compute terrain to calculate the normals and texture coordinates and then start to shade/texture the terrain in the shaders-group. That's the general workflow.

So keep that in mind, that data flows from top to bottom. So, once the terrain is made by powerfractals (for example) then compute the terrain and connect a heightfield-shader to that.
In the heightfield-input port of the heightfield-shader you connect a heightfield-generate operator (green node). This node has a "shader" input port on the right.
Connect the compute terrain to the shader input port of the heightfield-generate and to the main input of the heightfieldshader.
Now go into the heightfield-generate and press "generate now".

Replace the powerfractal terrain by the heightfieldshader and you'll see the result. There may be some vertical rescaling necessary. However, I'm not sure why these differences occur.

See the attached image for an example of this whole story :)

Martin

BigTom

Martin - Unfortunately this is soaking in very slowly. In frustration, I started from scratch to simplify the thing. After generating terrain I did get the save as command to save a .ter file. The file is only 1kb so I'm not sure it worked. When I tried to open the .ter file in TG classic I got a message that said "Run-time error '9': Subscript out of range" and the program shut down.

Attached is the node-network for my new TG2 file. is it structured correctly?

My Game Plan and needs are simple: I have a greyscale image of my grades (attached) with black as the lowest point and white as the highest. I need a terrain with no features except the grade changes (no rocks, grass, or texture of any kind - the only color needed is white or default. no sky, plants, nothing.) I'm going to export the terrain as a .ter file open it in TG classic and export the terrain as a .dxf file. From there I will import the .dxf file into SketchUp for use in that program. The world outside of this property doesn't matter because it will never show in my views. This is more like a city park than the Grand Tetons - its a very tame site compared to other scenes created with TG2.
The project dimensions are:
X=1192.5 m
Z= 778.0 m
Y= from zero to 18.2 m

Oshyan

Not sure what the problems you're having with TER export are (see reply in your other thread), but you might consider exporting as LWO and then converting to DXF, or perhaps Sketchup even loads LWO directly (many 3D programs still do).

- Oshyan

BigTom

Today is a good day!

Thanks...BIG THANKS...to those on this forum and the Ashunder forum. I've had a taste or two of success and I'm feeling like I may have started to understand some of the preliminary stuff. Thanks to Bobby Stahr who generously constructed a file which I've been able to reverse engineer and understand how to begin the setup and to Martin who guided me to the save as command to generate a .ter file and Oshyan for keeping me looking forward. All of these folks and those who have created the tutorials kept me from throwing up my hands and walking away!

I want to understand the "Generate Now" button. I've used the grey-scale image of my project to create the terrain so when I click "Generate Now" I see the terrain of my project and all of the surrounding terrain created by TG2. When I right-click on the Heightfield node and pick "Save As" to save the .ter, how much of the scene is TG2 saving as a .ter file. I want to save only the 1192.5m x 778m portion that is my projects terrain in order to keep the file-size as economical as possible.

I've attached 2 screen-shots to let you see how I set this up. Is it correct to specify the "Size in metres" of my project in the Heightfield generate 01 section if I've set those dimension in the Image map shader 01? I'm not sure that I understand the purpose of the "Size in metres" section in the heightfield generate 01 node.

If the .ter file is too big, can I scale down the terrain within TG2 and enlarge it elsewhere in the other program I want to use?

Oshyan

Specifying the "Size in Meters" works as you appear to think it does. What I'm not clear on is whether you're trying to generate and save a heightfield terrain using the hieghtfield generate node's built-in generation functions (which is what your network appears to be setup to do based on the screenshots) OR whether you want to take a *procedural* terrain (e.g. Power Fractal) and *convert* it to a heightfield for export as TER. Again in your network as configured, the Heightfield Generate is just using its internal algorithms to create heightfield-only terrain. The size of the terrain specified dictates the total size of the terrain and outside of that area the planet will remain flat. If you had a procedural terrain that affected the entire planet, and you fed the output of that terrain network into the Shader input of your heightfield generate, then the "size in meters" setting would be controlling what portion of your procedural terrain is sampled and converted into a heightfield. In that configuration pressing Generate actually tells TG2 to turn the procedural terrain into a heightfield with the same shape, whereas without something plugged into the Shader input, it uses internal algorithms to create unique terrain, as I mentioned before.

So it really depends on whether you're trying to use the Heightfield Generate to create terrain on its own, or rather to use it to convert procedural terrain for output. It can do both.

- Oshyan

BigTom

I've been trying to understand what to do from your post Oshyan and I'm not getting the results I need yet.

If I don't care at all about the rest of the planet, what is the best way to tell TG2 to generate only the terrain created by my greyscale image? When I specify the "Size in metres" in the Heightfield generate 01 node I get a warning when I click the Save As option which tells me "The X, Y and Z scaling are not equal in this heightfield." 

When I click OK the .ter file is generated but when I try to open it in TG classic (where I intend to export as a .dxf file) it gives me numerous warnings among which is that the file is too large. If I don't specify the size in meters there I get no warning but the file is still unusable in TG classic.

How can I correct my mistake?

BigTom

I can't find the way to control the scale of the .ter export. Each attempt has exported a file that is approx. 70mg. How can change the scale of the terrain so that the size is half that or a third?

I still want to generate a terrain that only encompasses the greyscale image I've assigned as the image map shader.

Is there anyone who can explain this? or is there some other source of information I can study. I've read and watched all the tutorials numerous times and will continue to do so because I have to solve this problem. The explanations for most of the uses of TG seem to involve making scenery. I need to export the .ter file to be opened in TG classic and then to export a .dxf from there.

I've seen very small file-size .dxf terrains that where complicated with mountains and valleys so I know it can be done. I can see a great terrain in my TG2 model - its just what I need but noone can explain to me how to properly save it.

Oshyan

I would need to see an image or TGD of the specific settings you're using in your heightfield generate, but my guess is you're either confusing the *size in meters* and *size in pixels* fields, or not using one or the other. Admittedly the size in pixels fields are not clearly labeled, but they're the ones next to the "New Heightfield" checkbox. It defaults to 1000x1000, which would be a heightfield 1000 pixels square. This will generate a pretty high resolution file that would not convert to DXF easily. You might want to lower this, or resize in TG Classic before exporting to DXF. I would suggest something like 257x257 or 513x513 (both TG Classic native resolutions).

Below that is the Size in Meters which defaults to 10,000. If you have the New Heightfield box checked, you should see a bounding box for the heightfield in your 3D preview. Adjust the Size in Meters so that it matches the size (and shape) of the terrain you want to export. You may need to reposition it as well, which you can do by clicking on the middle of the bounding box where the axis points cross (it will highlight yellow when you hover over this point, and you'll get axis indicators when it's selected), and then dragging it to where you want it to go. You can of course also specify its position numerically in the shader.

Once it's positioned and sized correctly, and you have determined a reasonable export resolution, Generate Terrain and save as TER again. The resulting TER should load in TG Classic. If not, try creating a new scene in TG2 and using a Heightfield Load to see if the terrain you're generating is actually what you intend. You could also try a 3rd party program like Wilbur (free) or World Machine, which are dedicated heightfield editors.

All that being said, from what I can see here I'm not sure you really need TG2 at all. It seems like you're just using it very simply to convert an image that you have created into a heightfield (TER) format. If that's the case I would strongly suggest either using Wilbur: http://www.ridgenet.net/~jslayton/software.html
Which can natively load many image formats and natively export direct to DXF. There are other dedicated terrain editors that can do the same, but Wilbur is also free. Just File->Open then File->Save As. Possibly much simpler than this workflow you're working on, depending on what you're actually trying to accomplish.

- Oshyan

BigTom

I will attach my .tgd file to this post but the greyscale image is too big (3mg) you would need that to complete the file wouldn't you?

Oshyan

I can't really verify it properly without your image file. Did you take a look at Wilbur?

- Oshyan