Planetside Software Forums

General => Terragen Animation => Topic started by: briareos_kerensky on January 20, 2015, 02:42:43 am

Title: Render elements output format
Post by: briareos_kerensky on January 20, 2015, 02:42:43 am
I'm playing around with imported cameras from 3ds Max to test out render times, quality, etc etc.
Ive noticed that render elements (depth and motion blur) are always saved as EXR no matter what format I choose in the Sequence/Output tab: the file name is like FileName.tgSurfDepth.FrameNumber.tif.exr
I will post the animation in After Effects so there shouldn't be any problems, but is this behaviour correct?
Title: Re: Render elements output format
Post by: Oshyan on January 20, 2015, 04:40:55 pm
Yes, that behavior is correct. EXR is the only format that correctly preserves the data, especially for things like motion vectors and surface normals, I believe.

- Oshyan
Title: Re: Render elements output format
Post by: briareos_kerensky on January 21, 2015, 03:38:16 am
OK, thanks.
I need to understand a couple of things. I apologise for the constant "in 3dsMax" but it's the fastest way for me to understand how Terragen works.

First, motion output.
If I output the velocity element in 3dsMax, I get this:
movement along the X, Y, and Z axis are translated to RGB values. I use this sequence in After Effects with a plug-in from Re:Vision (RSMB Pro Vectors) to apply motion blur in post.
However, this is what I've got in Terragen (cloud layer only):
The sequence works fine as a mask for the RSMB Pro Vectors, but apparently the EXR only has one colour value, so I need to manually add X and Y strength to the blur effect.
Was the motion output thought for a different purpose and/or compositing program/plug-in?
I'm asking this because the motion output of the surface looks like this:
At this moment, the camera points directly to the sky, and rather than strength and direction of the motion (as in 3ds Max), this appears more of a general position of the camera in the world.

Second, depth of field.
The output I've got from Terragen is a completely black image; I think the parameter is controlled by the camera DOF controls: is it possible to control the near and far planes (when the blur effect of the DOF is not affecting and fully affecting the image, respectively) in the viewport, without constantly tweaking the aperture and rendering?
Title: Re: Render elements output format
Post by: Matt on January 21, 2015, 06:08:41 pm
The blue channel should be black, so I'm very surprised by your render. It might be caused by a specific combination of setting that we haven't tried before. Could you send me a copy of your setup? I only need the Render node, Render Layer node and Camera. You can copy and paste nodes into a reply here on the forum, or attach a node clip (.tgc), or email it to if you prefer.

The motion vectors are designed to work with Nuke's vector blur. Red and green channels represent motion in pixels in the X and Y directions. It should be possible to get it to work with RSMB or something like it, but that plugin's settings need to be changed or you need to offset the data. This is because Terragen's motion vectors have both positive and negative values. Zero motion is represented by the value 0 (black), not grey. Motion vectors are written directly to the file without any remapping.

Depth values:

The depth values aren't completely black except in the background. They are always stored as 1/z, measure in metres. For most scenes this means they'll be quite dark, but you should be able to extract information by gaining up the values. The range is hardcoded so that Terragen artists don't have to think about ranges when sending depth data to compositors, and the data can be consistent as the artists iterate. Camera settings don't affect the range, nor do any other settings.

This "inverted" depth map that uses 1/z allows for cleaner selection of mattes based on depth when the depth map is anti-aliased (which it is in Terragen). This can be really helpful in some situations. Using 1/depth also means that the entire scene can be stored in the file, no matter how big or small. Everything in the scene that is further than 1 metre from the camera fits in the 0..1 range, so can be stored in a 16-bit TIFF if necessary. Pixels closer than 1 metre have values above 1, but information is kept if you work with EXRs or floating point files.

But there are some cases I would prefer the depth map not to be inverted, e.g. when using the depth map to add atmosphere in the comp.

I think Nuke has a built-in tool to convert to and from this inverted depth map. I don't really know AfterEffects so I don't know how easy it would be to convert. But I hope you can get what you want out of these maps with some colour adjustments? I want Terragen's output to be useful to people, not just limited to my own potentially narrow view of the problem, so let me know if this is still causing problems.

Title: Re: Render elements output format
Post by: briareos_kerensky on January 22, 2015, 01:26:42 am
I've attached the file here, tried to import it into a new scene and everything seems there.
Some more info might help: the camera is from 3dsMax 2014, exported to a FBX, and finally imported in Terragen; the camera was constrained to a path in 3dsMax and transformed it to keyframe animation prior to exporting.
The terrain is generated from a GeoTIFF, if that influences anything.
The Terragen motion images I've attached are screenshots from After Effects, if I import them in Photoshop I get black images (whatever option I choose upon importing).

Thanks for the explanation about depth, I'll try to see what I can get in AE. I doubt I'll get my company to buy Nuke when we already have several license of the Adobe Master Suite lying around.
Title: Re: Render elements output format
Post by: Matt on January 28, 2015, 10:15:28 pm
I rendered some frames of the default scene with your camera and render nodes, between frames 309 and 369 where the camera is looking upwards. I couldn't see any problems with the tgSurf2dMotion images, except that they have the extension ".bmp.exr" because Terragen forces these images to be EXRs.

Do you have the original EXRs? I could take a look at those.

Title: Re: Render elements output format
Post by: Matt on January 28, 2015, 10:22:06 pm
This is what I got on frame 334.