Terragen RPC – One Year Later

    It’s been a little over one year since the Remote Procedure Call (RPC) feature was introduced into all the versions of Terragen 4.

    RPC doesn’t exactly have an interface, making it what I call Terragen’s “hidden gem”.

    In case you’re not aware of what the feature does, it allows external applications to communicate with an active Terragen project.

    For example, you can write a Python script to manipulate the parameter values of any node in the Terragen project. You can even add or remove nodes in this manner.

    The tg_kelvin_temperature Python script modifies the selected Sunlight node’s colour values based on a range of Kelvin temperature values.

     

    Generally speaking, scripts are a great way to handle repetitive tasks by automating them and reducing your workload to a single button click in some cases.

    You might be thinking “But hey, I’m not a programmer!” to which I would answer “Neither am I.”

    When the RPC feature was first released, I was given the opportunity to find a way to set the Terragen sun position to a certain time of day via the new feature. I did some online research and found an application that controlled the rotation of a solar panel so that it always pointed towards the sun. The application was a Python script and the author was kind enough to make the code available for general use. The data that the script provided fueled the first Python script I wrote.

    I watched a few good tutorials and began to understand some of the terminology, like “widgets” and “functions” and “tkinter”. The more I learned, the more I realized how much I didn’t know. About six months ago Matt clued me in on what “code smells” are. To quote Google’s AI Overview “A code smell is a characteristic in a program’s source code that may indicate a deeper problem”. I had a lot of smelly code, and at some point I need to revisit those first scripts and give them a bath.

    My point is that you don’t have to have a degree in Computer Science in order to start using RPC. In fact, you should start with an “idea” first. An idea of something you want to do in Terragen, or wish Terragen did. Then share that with the Terragen community, either on the Planetside Software forums or various social media platforms like Discord. The forum is already a wealth of Terragen related information, dating back to 2006. Imagine what it could be if we all shared our ideas of how to use the RPC feature!

    Looking forward, AI is playing a bigger and bigger role in everything we do. In some respects, you don’t need to learn how to write code, because ChatGPT can do that for you. I think it’s still a valuable skill to know the basics of writing good code because AI is still learning and we’re learning how to interface with it. So it’s still important to check the code that’s being automatically generated.

    At the time of this writing there are seventeen Python scripts on the Planetside Software forums available to all users for free. These scripts span a wide range of functionality and can provide you with a good idea of what scripting and RPC is capable of.

    Some of the seventeen Python scripts available for free!
    Just a few of the scripts available to download right now.

    To simplify the download and installation of these scripts, we’ve packaged them into one suite called redmaw_tg_toolkit.
    Here is a link to download a ZIP file of all the scripts. Unzip it to wherever you want to save your scripts.
    https://github.com/RedMawVFX/redmaw-tg-toolkit.git

    You’ll need to install Python on your computer if you don’t already have it. A few of the scripts have “dependencies” on other Python modules, so we’ve listed all the programs and modules that you’ll need in addition to the ZIP file here:

    Python
    https://www.python.org/

    terragen_rpc
    https://pypi.org/project/terragen-rpc/

    toml (Tom’s Obvious, Minimal Language)
    https://pypi.org/project/toml/

    pillow
    https://pypi.org/project/pillow/

     

    So after one year of using the RPC feature, what have I learned?  Well I’ve certainly learned how to write code at least at a beginner’s level, and that’s not a bad skill to add to your creative arsenal.  My workflow in Terragen has improved because I don’t have to expend extra thought or labor, i.e. mouse clicks, to implement the little preferences I like to have in a project.  I can stay focused on the artistic side of things and experiment more, finding new ways to control or combine nodes and shaders to get the look I’m after.

    I hope this post gets you excited about the possibilities of using the RPC feature, and I look forward to hearing your ideas for future scripts.

    AUTHOR

    Kevin Kipper

    All stories by: Kevin Kipper
    WordPress PopUp Plugin