Terragen RPC

Started by Belmont224, March 31, 2025, 12:10:38 PM

Previous topic - Next topic

Belmont224

Can the RPC access any of the animation properties? For example, setting a keyframe for a camera position (or anything else for that matter). There is currently access to get the camera position and set the frame number, so it is so close.


Kevin Kipper

Hi Belmont224,

Great question.  Currently RPC does not have access to the animation properties, or have the ability to set keyframes.  The best you can do "out of the box" that I'm aware of is to query and set values like position, rotation, etc.  This works great when an item isn't animated; it will even "temporarily" overwrite the parameter values of an animated item until you advance to a keyframe, at which time the keyframed data will return.

I've had some luck generating a motion path via a script and writing the keyframe values to a TGC (Terragen clip file) and then importing the clip file into the Terragen project and copy/pasting those values to an item I wanted to be animated; but that's not the same as being able to access keyframed data that's already there.

digitalguru

Before RPC I did the same as Kevin - wrtiting animation to a clip file - as well as .chan file. But it's a one way street afaik from my DCC (Maya) to Terragen.
Would be great to see animation added to the RPC though.

Simplest way is write a .chan file to then load manually in Terragen. Just remember to have your destination object (camera, geo) at the origin before you load the .chan.

Belmont224

Just for kicks I hooked Blender up to Terragen using RPC so I could move the camera in Blender and it would move the camera in Terragen. The same can be done with the sun or objects. Right now it's just a manually run script in Blender (no UI or anything), but it was neat to see the possibilities of RPC. I hope it is developed a little more in the future.

digitalguru

Quote from: Belmont224 on April 08, 2025, 11:25:32 AMJust for kicks I hooked Blender up to Terragen using RPC so I could move the camera in Blender and it would move the camera in Terragen. The same can be done with the sun or objects. Right now it's just a manually run script in Blender (no UI or anything), but it was neat to see the possibilities of RPC. I hope it is developed a little more in the future.
Nice. Agree, it would be great to see keyframing over RPC.

Kevin Kipper

I've just started playing around in Blender.  I'd love to see your workflow from Blender to Terragen, even if you think they're simple scripts!

Belmont224

I don't have a workflow, just playing around at this point. I'm not really competent in either program. I have completed the first part of my script though. I'm not sure if it's useful but it's been a good learning experience. 

So far it transfers the following back and forth:

  • Camera position
  • Camera rotation
  • Camera focal length
  • Camera focus distance
  • Camera aperture diameter
  • Sun position
  • Sun direction
  • Sun color
  • Image size

The scripts are run manually, so not really an add-on yet, and there definitely some bad code that needs to be cleaned up. With all this though, the scene in blender perfectly matches the scene in terragen, even down to the depth of field. The render in blender will be a little different because, unless you import the sky map from Terragen, the blender scene is only being lit by the sun, but it is a start.

Now I need a good way to pulling terrains into blender.

Kevin Kipper

Your script sounds really cool and it's good to hear that the parameter values are matching in Terragen.

Currently, I'm saving OBJ files from Terragen's microexporter, or exporting a heighfield map and importing those into Blender.  I've not found a satisfactory method of populating items, like trees, on the OBJ terrain.  I'm not totally familiar with Blender's instancing, but it seems to bog down my computer when there's lots of instanced objects, even if part of a collection.

digitalguru

Quote from: Belmont224 on April 17, 2025, 11:27:54 AMNow I need a good way to pulling terrains into blender.
I use a few ways to get terrain into my DCC - though it's Maya not Blender.

Since you've got way to get cameras into TG from Blender, you could try writing a tiling camera to split an area over a number of tiles and use that to write out multiple sections of terrain (as obj) for maximum detail. I see Blender also does vector displacments so you could setup TG to render vector displacment maps(also tiled).

Belmont224

How do you use your DCC of choice with Terragen? In other words, do you pull everything into Maya/Blender and render everything there? Do you pull everything into Terragen? Do you do a mix with rendering some things in each program and combine them later? Terragen excels at what it is meant for (outdoor landscape type renders with clouds and such) and other renderers excel at what they were meant for (typically not realistic outdoor landscape type renders with clouds), so I'm curious on how others use the two programs in conjunction with each other. 

digitalguru

#10
Quote from: Belmont224 on April 17, 2025, 12:53:46 PMDo you do a mix with rendering some things in each program and combine them later? Terragen excels at what it is meant for (outdoor landscape type renders with clouds and such) and other renderers excel at what they were meant for (typically not realistic outdoor landscape type renders with clouds)
That's what I'm working on a.t.m. Check out: https://planetside.co.uk/forums/index.php?msg=300437
Terrain is rendered in TG, everything else in Maya (car and foliage) and comped together in Nuke. This will be an animation, so I need to motion blur the car (no motion blur for objects as yet in TG).
I did try setting up all the foliage in TG, but it's better to have it Maya for this project, for shadowing, gi etc.
Once I've got a terrain, I setup a tiling camera in Maya and export that to TG, then use it to write out tiled terrain so I get managable (and higher rez) objs. For detail where the car is driving over the terrain, I'll replace those tiles with vector displacement tiles for the best detail.
I'm not rendering the imported terrain in Maya directly, but using it to generate shadow passes which is then comped over the terrain in Nuke (shadows from the car and plants)
The imported terrain matches the TG render pretty well and I can also use it to generated deep .exrs, so everything slots together in Nuke nicely.
p.s. all the terrain geometry and plants are converted to Arnold archives (.ass) - it's the only way to render efficiently in Maya. One of the things TG does really well is render huge plant populations, and of course, rendering complex terrains as micropoly displacements without breaking a sweat :)