Author Topic: Export Terragen terrains and all displacements and color details to Arnold?  (Read 1505 times)

Offline digitalguru

  • Member
  • *
  • Posts: 399
This is all assuming  falcooat is trying to render a micro polygon export in Arnold.

If it is, then this is what is probably going on:

Looks like an import of an object into Arnold that has the normals turned off, hence the faceted appearance. This is probably compounded by the camera position in the render that is looking at very small section of the terrain and there is just not enough resolution in the mesh.

Turning on normals in the micro polygon exporter in Terragen can smooth the triangulation look / faceted appearance but the render can then look a bit "soft" . Also in some instances the file size can double with normals turned on (more on file sizes later) so I usually leave it off and smooth the mesh in Maya if I need to.

Main problem is, if you export your entire terrain as a mesh and then zoom into it,. you're going to see those individual polygons. You then come to appreciate how Terragen handles it's geometry - always rendering a proceedural version no matter how close you are to the terrain.

Ajcgi has a good approach,  and it's something I've tried during my vector displacement experiments, but there is a limit to how much detail you can get.

I tried rendering 8k and even 16k displacement maps from Terragen and using them on a simple plane in Maya/Arnold, but in order to realise the detail in the map in the render a very high subdivision level is needed. This can take quite a while to calculate and uses lots of memory. I have 64gb in my machine and it ran out of memory before it could render a surface subdivision high enough for a 16k map!

There are ways around it, and my approach is to use tiling. Many smaller files (meshes or displacement maps) can be handled much better by Maya / Arnold than one gargantuan file :-)

This is how the texture UDIMs work, rather than create a huge 32k texture for a character, it is split into tens or even hundreds of smaller 4k tiles that are easier to deal with.

Matt mentioned you can render the micro from the camera perspective - for a still shot this will work fine, but if the camera moves then the still mesh capture will be redundant and a top down projection will be needed.

In my experiments, I've found the best approach is to export the entire terrain to the micro exporter, previs to find where the camera is going to be animated, then replace just the close up section with a much higher resolution mesh (or vector displacement map)

I'm going to publish a new version of my Terraman script soon. In it, you'll be able to use an orthographic camera in Maya to Boolean out a chunk of terrain close to a render camera, then export that same orthographic camera to Terragen to create a micro polygon mesh of the area in high resolution (this can even be tiled further for even more detail)

You will then be able to import the  higher resolution terrain (or terrain tiles),  and it will slot right into the hole created by the Boolean .The Maya scene will only have detail where it needs it and low poly detail in the background.

I'm working on an animation using this at the moment and will post when completed!

Anyway, I hope this was what falcooat was asking :-)

If not, hopefully someone else might find it useful!
« Last Edit: October 05, 2018, 04:36:45 PM by digitalguru »

Offline falcooat

  • Member
  • *
  • Posts: 12
Thank you so much for your lengthy reply! I have not been at the computer to respond this past week, but I appreciate everyone who had suggestions!

I must admit, I am new to Terragen, so it is taking me a bit of time to digest all the recommendations. @digitalguru, you are correct in your assumptions. I was working through your tutorial for TerraMan, and the image I posted was the result rendered within Maya/Arnold. My ultimate goal is to render an original terrain that will serve as the base for an animation. It sounds like your latest tutorial is exactly what I am looking for, so I will eagerly await for your guidance on this.

Offline digitalguru

  • Member
  • *
  • Posts: 399
Did you try to tile the terrain in that render?

Quote
My ultimate goal is to render an original terrain that will serve as the base for an animation.

If you let me know more on what you want to do, will be glad to help.

Offline falcooat

  • Member
  • *
  • Posts: 12
Yes, the terrain in the image is following the steps exactly as you laid them out in your tutorial. Right now my problem is calculating my terrain coordinates properly. My terrain is smaller (and much less detailed) than the one in the tutorial and am having some trouble getting the correct result. Again, this is probably more an issue of me being new to Terragen, as well as a different issue at this point from the triangulation. Below is rendered in Maya/Arnold and clearly has something set incorrectly in the coordinate setup.


Offline digitalguru

  • Member
  • *
  • Posts: 399
How many tiles has the terrain been split into?

p.s - send me the Terragen file if you can - I'll have a look
« Last Edit: October 15, 2018, 07:41:54 PM by digitalguru »

Offline falcooat

  • Member
  • *
  • Posts: 12
Attached is the result I get (currently with my terrain, but also had a similar result with your tutorial terrain.) I am also attaching the Terragen file, but little is changed from your tutorial file, with the exception of using a tif height-map instead of a .ter file for height data.

Offline digitalguru

  • Member
  • *
  • Posts: 399
can you upload the tiff for the heightfield?
« Last Edit: October 15, 2018, 09:14:40 PM by digitalguru »

Offline falcooat

  • Member
  • *
  • Posts: 12
if you go to the link you can download the tif I am using...

https://drive.google.com/drive/folders/15YqHG2TM6zIHcAm7Bhp3wfKQTBAQ5CCf?usp=sharing

Offline digitalguru

  • Member
  • *
  • Posts: 399
thanks - having a look now...

Offline digitalguru

  • Member
  • *
  • Posts: 399
quick question - are you using the Professional version of Terragen?

Offline falcooat

  • Member
  • *
  • Posts: 12
Yes I have the professional edition, via an educational application. It looks like I need to up the polycount on the obj?

Offline digitalguru

  • Member
  • *
  • Posts: 399
Quote
Yes I have the professional edition

That's great, really helps working with heightfields (mainly for exporting high-quality displacements as 32bit exr)

Your heightfield is an 8 bit tiff - that's not optimum to use as a heightfield as it only has 256 levels of grey and your map is quite smooth - you'll need a 32bit map to capture those smooth gradients

The tiff is quite noisy too, and it's just random noise that's not going to look good on the terrain:
85445-0
You can fix that a bit by adding a heightfield smooth filter:
85447-1

But you can still see some square artifacts on the ridges of the (river/canyon ? sides) - if you painted this map in something like Photoshop - try creating a file in 32 bit and painting 32bit from scratch - you can also then paint at a smaller resolution and get the smooth broad strokes of the terrain and add detail on top with Terragens fractals.

In the Terragen scene you uploaded, there is one Bake Micro node to export the terrain to obj. This is good as a start as it enables you to get a mesh into Maya and start layout and adding animation etc. I chose 1024 x 1024 as an output size as it produces a mesh that is a workable size in megabytes - any larger and the mesh gets a bit unwieldy to work with.

So when a higher resolution mesh is needed in Maya, that's when tiling comes in - the same area can be split into a number of tiles and rendered out in 1024 x 1024 chunks and loaded into Maya.

It's getting late, so I'll have a proper look tomorrow and make a quick file to illustrate.
« Last Edit: October 15, 2018, 11:00:39 PM by digitalguru »

Offline falcooat

  • Member
  • *
  • Posts: 12
Wow, you are awesome! Thank you for taking so much time to look at this. Admittedly, the terrain map I have is less than desirable, Unfortunately the real-world map is even worse. (The Great Plains aren't nearly as interesting as Mount Everest. ;) ) I will work on making a better heightmap and  see how that goes. Would I connect a smoothing filter to the heightfield shader in Terragen?

Truly, thank you for your help, I have already learned so much!

Offline digitalguru

  • Member
  • *
  • Posts: 399
Quote
Would I connect a smoothing filter to the heightfield shader in Terragen?

Yes - connect a Heightfield smooth node after the heightfield load - this works well in the context of your heightfield, removing the hi frequency noise, but if the heightfield was more detailed this would smooth the detail along with the noise - so it's important to get a good noise free map to start with (32bit map as a source)

I loaded your heightfield into Terragen and added some fractal detail and some fake stones in the foreground:
85473-0

Then exported the whole terrain to an .obj via the Micro exporter and loaded into Maya via Terraman:
85475-1
The whole terrain looks ok from a distance, but very lo-rez at this close angle.
WIth Terraman (an update coming soon) I used an orthographic projection camera to boolean out a section of the terrain close to the camera. Then exported the same camera to Terragen and used that to Micro Export the smaller section of terrain to import back into Maya:
85477-2
The terrain looks more detailed, and the low rez terrain in the background works from this camera angle also.
The foreground render in Maya is still not as detailed as the Terragen render, but this small patch of terrain can be further subdivided into more hi-rez tiles - it's possible to get pixel to pixel accuracy between the Terragen and Arnold renders.

I'll upload the scene files tomorrow - my upload speed is pretty slow :-)
« Last Edit: October 16, 2018, 10:55:01 PM by digitalguru »

Offline digitalguru

  • Member
  • *
  • Posts: 399
screengrab of the medium rez tile in the boolean section of the lo-rez terrain:
85479-0