Trees Of Daggerfall [PERFORMANCE PROBLEM/SOLUTIONS]

Discuss modding questions and implementation details.
User avatar
VMblast
Posts: 491
Joined: Wed Mar 29, 2017 12:22 pm
Contact:

Re: Trees Of Daggerfall [PERFORMANCE PROBLEM/SOLUTIONS]

Post by VMblast » Mon Aug 12, 2019 6:11 pm

Ive tested almost everything concerning this mod. I am not tech savy, but Ive noticed (found out) few things that may help some other people.

-Sptree billboards (or what ever it is), use CPU rather than GPU and it uses a lot of it. (even when GPU on the shaders are turned on)
-Changing resolution (lowering it down) didnt have any impact on framerate.
-Lowering down the detail settings (in DU game menu) didnt help -even tho hills got barren, framerate remained the same.

This is also important quote from Speedtree docs:
"Draw Distance: It seems obvious, but bears discussion: a large draw distance greatly impacts performance. For the most part, the 3D tree rendering system is unaffected, but the CPU load needed to stream billboards in and out of a large frustum will take its toll. Considering that the volume of a frustum increases exponentially with distance, the number of visible billboards can get out of hand very quickly. We've routinely tested with one- and two-mile visibilities, but they do come at a price."
https://docs.speedtree.com/doku.php?id=cpu_topics
Last edited by VMblast on Mon Aug 12, 2019 6:34 pm, edited 4 times in total.

User avatar
VMblast
Posts: 491
Joined: Wed Mar 29, 2017 12:22 pm
Contact:

Re: Trees Of Daggerfall [PERFORMANCE PROBLEM/SOLUTIONS]

Post by VMblast » Mon Aug 12, 2019 6:14 pm

MasonFace wrote:
Mon Aug 12, 2019 4:05 pm
You may want to just try to disable the "animate cross-fade" option and see if it will allow you to use the DF Billboard Batch shader in your LOD before you go any further.
This doesnt have any impact on framerate. Ive tested all variations, settings, LOD numbers and LOD distances transitions.

User avatar
MasonFace
Posts: 284
Joined: Tue Nov 27, 2018 7:28 pm
Contact:

Re: Trees Of Daggerfall [PERFORMANCE PROBLEM/SOLUTIONS]

Post by MasonFace » Mon Aug 12, 2019 6:49 pm

VMblast wrote:
Mon Aug 12, 2019 6:14 pm
MasonFace wrote:
Mon Aug 12, 2019 4:05 pm
You may want to just try to disable the "animate cross-fade" option and see if it will allow you to use the DF Billboard Batch shader in your LOD before you go any further.
This doesnt have any impact on framerate. Ive tested all variations, settings, LOD numbers and LOD distances transitions.
I was just interested to know if disabling the "animate cross-fade" option would fix this issue, but I'm guessing it did not. I was already aware that you'd adjusted those other parameters and it hadn't helped.

Can you elaborate on what you meant when you said:
"Update - its dead end using DU billboard Batching for LOD billboards for trees."

Do you know definitively that DFU billboard batching shader can't be used for LOD billboards, or just that it can't be used with SpeedTree LOD billboards? That's what I'm trying to answer. If I wasn't at work right now I'd be tempted to test it myself. Unfortunately I've got a massive back log of personal projects on my plate, so I really don't have any free time to speak of when I get home. But I'm really itching to try to help you solve this issue because it is very important.

User avatar
VMblast
Posts: 491
Joined: Wed Mar 29, 2017 12:22 pm
Contact:

Re: Trees Of Daggerfall [PERFORMANCE PROBLEM/SOLUTIONS]

Post by VMblast » Mon Aug 12, 2019 9:06 pm

MasonFace wrote:
Mon Aug 12, 2019 6:49 pm
Can you elaborate on what you meant when you said:
"Update - its dead end using DU billboard Batching for LOD billboards for trees."
How to explain it best, Ill do it in term of one 3D tree asset. Ive managed to make a prefab out of it and delete last lod, which was sptree billboard. Than replaced it with empty container and attach onto it Daggerfall Billboard Batching script and Billboard Batching shader. Than I've managed to find that particular tree in the DU billboard batch atlas (which is by pushing million times -randomize- button on the script). That DU tree sprite image was shown normaly.

Ive made new Unity test scene (not a part of DU scripts) and added that tree on the default terrain Ive created. Tweaked desired lod groups for 3D assets and DU billboard batching. In the test scene view (and default camera) it all worked. 3D tree made normal transition into billboard as it should and Daggerfall sprite tree graphic was visible. Ive made mod out of this prefab and imported into DU for testing.

When game was loaded, there was no billboards of that tree. Everything transitioned up until that billboard and than tree just disappeared into nothing, not showing Daggerfall tree sprite graphic.... Oh and I forgot to mention the main thing - the speed (performance) was just insane, everything was flying like in vanilla DU billboards. Thats why Im aiming that the main problem lies in default speedtree bilboards system.

So, that was the long story. All in all, entire setup worked in Unity (test scene), but havent showed up in DU....and god knows why was that. Thats why Ive suggested that the best option is to someone write MOD tree billobards scrpit from ground up - one that can use one image (one texture) atlas for all trees of the zone. So pre-generated, pre-made (as a texture) and not generated at a runtime.

PS - You let me know what assets do you need for testing and Ill send them to you.

l3lessed
Posts: 34
Joined: Mon Aug 12, 2019 4:32 pm

Re: Trees Of Daggerfall [PERFORMANCE PROBLEM/SOLUTIONS]

Post by l3lessed » Mon Aug 12, 2019 9:45 pm

I'm not claiming to be an expert in this area, so take this as you want.

The process you are describing doesn't clearly prove or disprove the issue DU billboard Batching. It could be an issue with the way you're creating the test mod in unity, how it was exported/imported, or even possible bad directory/file path/name, or a number of any other things. One user error does not make a whole system broken.

Again, not expert though, but from what you said, I would not say it is a dead end yet. Now, if someone could try and replicate this to see if it happens, we would have a better idea.

Also. it's going to be faster because you aren't rendering any of those billboards anymore. For some reason, the engine is not seeing the billboard file, and thus is not rendering it, freeing up tons of CPU and GPU load.

User avatar
VMblast
Posts: 491
Joined: Wed Mar 29, 2017 12:22 pm
Contact:

Re: Trees Of Daggerfall [PERFORMANCE PROBLEM/SOLUTIONS]

Post by VMblast » Mon Aug 12, 2019 10:34 pm

l3lessed wrote:
Mon Aug 12, 2019 9:45 pm
I'm not claiming to be an expert in this area, so take this as you want.

The process you are describing doesn't clearly prove or disprove the issue DU billboard Batching. It could be an issue with the way you're creating the test mod in unity, how it was exported/imported, or even possible bad directory/file path/name, or a number of any other things. One user error does not make a whole system broken.

Again, not expert though, but from what you said, I would not say it is a dead end yet. Now, if someone could try and replicate this to see if it happens, we would have a better idea.

Also. it's going to be faster because you aren't rendering any of those billboards anymore. For some reason, the engine is not seeing the billboard file, and thus is not rendering it, freeing up tons of CPU and GPU load.
Well, what Ive meant and said was just that. Ive described what happened and I dont claim that the issue is in DU billboard Batching and some internal errors. I just said -I dont know what was the problem and why its not working. I can certainly provide assets if someone whats to test it.

l3lessed
Posts: 34
Joined: Mon Aug 12, 2019 4:32 pm

Re: Trees Of Daggerfall [PERFORMANCE PROBLEM/SOLUTIONS]

Post by l3lessed » Mon Aug 12, 2019 11:00 pm

Well, if no one can get you out of this hole in near future, I might be able to assist wherever I can. However, right now, I need to just get a grasp on how unity and daggerfall assets are working and communicating. Once I get into it and start trying my mod, I may be able to assist and answer to this issue better.

User avatar
VMblast
Posts: 491
Joined: Wed Mar 29, 2017 12:22 pm
Contact:

Re: Trees Of Daggerfall [PERFORMANCE PROBLEM/SOLUTIONS]

Post by VMblast » Mon Aug 12, 2019 11:17 pm

@l3lessed
Sounds like a plan.

User avatar
MasonFace
Posts: 284
Joined: Tue Nov 27, 2018 7:28 pm
Contact:

Re: Trees Of Daggerfall [PERFORMANCE PROBLEM/SOLUTIONS]

Post by MasonFace » Tue Aug 13, 2019 12:57 pm

Thanks for the elaboration, VMBlast. I'm going to try to carve out some time this weekend to do some tests and see what I can do. I've seen the quality of your work and I believe you when you say you've optimized your assets. I am 100% confident that the problem exists somewhere on the SpeedTree side of this equation; either the culling or the poor optimization of its billboard shader.

User avatar
VMblast
Posts: 491
Joined: Wed Mar 29, 2017 12:22 pm
Contact:

Re: Trees Of Daggerfall [PERFORMANCE PROBLEM/SOLUTIONS]

Post by VMblast » Wed Aug 14, 2019 11:51 am

MasonFace wrote:
Tue Aug 13, 2019 12:57 pm
Thanks for the elaboration, VMBlast. I'm going to try to carve out some time this weekend to do some tests and see what I can do. I've seen the quality of your work and I believe you when you say you've optimized your assets. I am 100% confident that the problem exists somewhere on the SpeedTree side of this equation; either the culling or the poor optimization of its billboard shader.
Ok, let me know if you'll need anything.

I just want to add, that Ive tryed my best to optimize graphics, which is my line of work. I even deleted two middle lods in 3D assets and what remained was just main 3D asset (highest quality) and billboard lod. Previously there were 4 lod groups in the speedtree prefab - 3 3D assets and 1 billboard. This is because Ive noticed that when I delete one lod, performance increases and when I deleted all of them except the first and last, performance jumped even higher. As Ive red sptree docs, this is because it use CPU mostly to calculate and also this includes updating the instance vertex buffers as well...

But biggest problem, as Ive mentioned is billboard lod and speedtrees own scripting and how they are doing it. What Ive gathered, speedtree billboards are made to perform like a normal 3D assets but only much simpler and with totally reduced geometry to the number of 4 triangles, or something like that. But they are still acting the same as 3D assets. Replacing billboards with standard lod 3D asset didnt change much performance, even that Ive expected it to be like a complete hardware crash. Performance with all 3D trees, dropped just a little bit when compared with billboards.....

Suggestions for the testing:
Best way for optimizing this, aside making script from ground up, is use of premade ATLAS texture, which means one big texture with all the billboard trees for the zone in it. Also it would be good, but not super necessary, to include atlas normal map as well.

Post Reply