Planetside Software Forums

General => Terragen Discussion => Topic started by: N-drju on May 06, 2020, 03:41:07 AM

Title: Text-editing translucency values
Post by: N-drju on May 06, 2020, 03:41:07 AM
Guys, do you think it is safe, to open a project file in text editor and set translucency values from there?

The thing is, XFrog trees, by default, do not have any leaf / needle translucency enabled. This basically results in user having to set preferred values on their own... Which takes forever...

Also, it is not possible to just open up an object and then save it again as another, edited object. It looks like XFrog has hard-coded some of the models (quite understandably) to prevent this.

I have found some strings in the .tgd file that are responsible for translucency in objects. I just don't know if it is safe to do it this way. ::) Theoretically, one could just type some values, use the "change all to..." option and save lots upon lots of time that way!
Title: Re: Text-editing translucency values
Post by: Dune on May 06, 2020, 04:13:36 AM
I think it's possible as long as you are certain only the XFrog plants are affected, not translucency in other default shaders. If there are no others, I think it's safe. You could at least try with a copy of your file.

You can save the altered objects as tgc, AFAIK. Import would call the unaltered object, but alter it within that tgc once imported as tgc.
Title: Re: Text-editing translucency values
Post by: KlausK on May 06, 2020, 04:15:18 AM
Just make a backup copy of your project file and try it 8)

CHeers, Klaus
Title: Re: Text-editing translucency values
Post by: N-drju on May 06, 2020, 04:21:55 AM
Quote from: KlausK on May 06, 2020, 04:15:18 AMJust make a backup copy of your project file and try it 8)

CHeers, Klaus

You think I didn't already? ;)

It seems to work indeed, but, as Ulco says, one has to make sure that only leaf and needle shaders are affected. Which, still, is a lot of work. Besides, I tried to change the translucency on African Boxwood and my edits had no impact on the object at all...

It's doable, but a hassle nonetheless. I wish there was an easier way to macromanage translucency, but the problem definitely lies within how XFrog objects for TG are made.
Title: Re: Text-editing translucency values
Post by: cyphyr on May 06, 2020, 04:32:12 AM
I do this all the time.
Very useful when you have multiple values that all need to be changed at the same time, a simple search and replace does the job very quickly.

(There are other text editor hacks you can do too, like changing imported FBX nulls incl animated nulls to point lights).
Title: Re: Text-editing translucency values
Post by: N-drju on May 06, 2020, 04:56:14 AM
I'm convinced now. I'll start doing it starting with the next project (that being the contest). Could take some practice to find appropriate chunks of information though. And of course, it could be helpful to create some nice greenish hues, save them, then copy-paste as necessary.
Title: Re: Text-editing translucency values
Post by: jaf on May 06, 2020, 11:21:24 AM
You also might want to try the text editor Sublime Text -- https://www.bing.com/search?q=sublime+text&PC=U316&FORM=CHROMN
It's free to evaluated without a time limit.  When you load your tgd file, set the View|Syntax to XML and it will color code like the image below.
Title: Re: Text-editing translucency values
Post by: WAS on May 06, 2020, 03:07:29 PM
Hmm

Because there are more than one default shader per plant, this really is just going to be work too.

The best route I can think of considering the circumstances is working in a new project, loading the trees you want as a single model (not pop) and than editing and saving them "[filename]-modified.tgo". Than you can load it up in any population in any project with the fixes are present without the work again.

Other than that I'd only go extreme from there if it was so prudent. I'd probably write a PHP XML parser, and just gather a list of default shaders and checkboxes and input values for translucency. Then check all that apply and have it edit only those results.
Title: Re: Text-editing translucency values
Post by: aokcub on May 06, 2020, 03:48:02 PM
I sometimes edit tgd with text editor (i prefer VSCode) to modify values.

As the another way to re-use the setting, we can save shaders as tgc.
Clip default shaders and import them in a new project.
Title: Re: Text-editing translucency values
Post by: WAS on May 06, 2020, 03:50:46 PM
Quote from: aokcub on May 06, 2020, 03:48:02 PMI sometimes edit tgd with text editor (i prefer VSCode) to modify values.

As the another way to re-use the setting, we can save shaders as tgc.
Clip default shaders and import them in a new project.

He can just save the whole model as a new TGO or OBJ to save the trouble ever again in the future. I always prepare objects for Terragen prior to using them anyway so I don't encounter this issue. No obj is just going to import into TG right, unfortunately.
Title: Re: Text-editing translucency values
Post by: aokcub on May 06, 2020, 04:17:49 PM
Quote from: WAS on May 06, 2020, 03:50:46 PMHe can just save the whole model as a new TGO or OBJ to save the trouble ever again in the future.


Ah, i see. :)
Just wondering, how can we do if the original model is TGO?
I believe OBJ reader can export model as TGO/OBJ but TGO reader cannot. (Please correct me if I am wrong.)
Title: Re: Text-editing translucency values
Post by: WAS on May 06, 2020, 04:20:02 PM
TGO reader can export back to OBJ.

---

Here's a quick screen grab of cycling a project file for default shaders and listing translucency. Once could target leaves or needles, either manual selections or procedurally, and change the values accordingly via manual input or procedurally.
Title: Re: Text-editing translucency values
Post by: N-drju on May 06, 2020, 04:21:16 PM
I am aware of this possibility. However, as I mentioned in the first post, some objects simply cannot be saved anew. Must be some hardcoded form of protection.
Title: Re: Text-editing translucency values
Post by: WAS on May 06, 2020, 04:29:59 PM
Ah yes, old xfrog TGOs. A mistake on their part honestly. I always get OBJ format. TGO is just a glorified OBJ format with ability to save shader networks. Not sure why they decided to lock those old files.

I am pretty sure you can still save the populations as clips.
Title: Re: Text-editing translucency values
Post by: aokcub on May 06, 2020, 04:46:36 PM
Yes since I mainly use Xfrog so I didn't notice that tgo can be exported from right-click menu.
I tried with another tgo and found that export feature works. Thank you WAS.
Title: Re: Text-editing translucency values
Post by: cyphyr on May 06, 2020, 05:54:06 PM
Quote from: WAS on May 06, 2020, 04:29:59 PMAh yes, old xfrog TGOs. A mistake on their part honestly. I always get OBJ format. TGO is just a glorified OBJ format with ability to save shader networks. Not sure why they decided to lock those old files.

I am pretty sure you can still save the populations as clips.
IIRC the Xfrog TGO's were locked so people didn't have the option of exporting them as obj's and then using them outside Terragen.  This was a stipulation from Xfrog when a package was sold that had Terragen and the entire current library (at the time) of Xfrog models sold as a single package.  It was quite a bargain at the time, an awful lot more "bang for buck" than buying Terragen and the Xfrog libraries separately.
Title: Re: Text-editing translucency values
Post by: WAS on May 07, 2020, 02:59:17 AM
That makes sense to a degree, but at the same time it's creating a single-application restriction, when OBJ is available for almost any software. Makes little sense when you can import the obj, export the tgo, import the obj, export the 3ds, etc, etc.

By and by I am writing a little default shader editor which will bring up all the default shaders and relative editable info. May come in handy later.
Title: Re: Text-editing translucency values
Post by: N-drju on May 07, 2020, 03:03:24 AM
Quote from: WAS on May 06, 2020, 04:29:59 PMI always get OBJ format.

So you say .objs should allow me to re-save as .tgo?

That would be fantastic. Apart from having to re download every library as an .obj set... ::)

Quote from: cyphyr on May 06, 2020, 05:54:06 PMIIRC the Xfrog TGO's were locked so people didn't have the option of exporting them as obj's and then using them outside Terragen.

Just as I thought.

Quote from: jaf on May 06, 2020, 11:21:24 AMYou also might want to try the text editor Sublime Text -- https://www.bing.com/search?q=sublime+text&PC=U316&FORM=CHROMN
It's free to evaluated without a time limit.  When you load your tgd file, set the View|Syntax to XML and it will color code like the image below.

Great. A good resource to have, just in case everything else fails.
Title: Re: Text-editing translucency values
Post by: N-drju on May 07, 2020, 03:05:10 AM
Quote from: WAS on May 07, 2020, 02:59:17 AMBy and by I am writing a little default shader editor which will bring up all the default shaders and relative editable info. May come in handy later.

I guess you don't really have to spend your time on that if .obj turn out to be editable... Or do you wish to design a TG plugin? ;)
Title: Re: Text-editing translucency values
Post by: WAS on May 07, 2020, 03:31:08 AM
Nope, it's for people stuck with the old TGOs lacking proper default settings, or just for quick changes, such as file paths or what not to large sets. My buddy has all old TGO formats. He doesn't really mess with TG anymore, but it was a thought I had that could be an annoyance with old packs.
Title: Re: Text-editing translucency values
Post by: WAS on May 07, 2020, 03:33:29 AM
Also have nothing to do in PHP recently so might as well keep refreshed.