Jump to content
  • 0

Tree LOD Shaders


doodlum

Question

I made a shader modification for tree LOD where I'm currently happy with the results. Because lighting is simulated through normal maps, it would need DynDOLOD to support it by adding a config to check for what worldspaces use the format, and drawing out normals to the bottom of the atlas. There's an additional mask in the alpha channel available which is unused. Additionally the atlas could be tiled further for additional masks.

Only the texture coordinate is available for unique information about the current pixel. The vanilla shader is so stripped down there is only that. Additional information is provided through RE plus generated normals and tangents.

https://www.nexusmods.com/skyrimspecialedition/images/182805

I don't really know how good of an option this is. If it's a bad idea or just won't be supported then I'll drop this. It should theoretically be beneficial in bottlenecked situations over object LOD, and can be tweaked specifically for flora 

 

Link to comment
Share on other sites

Recommended Posts

  • 0

That's cool. That can be added as a feature for the tree LOD atlas generation of DynDOLOD. So basically a "complex" tree LOD atlas texture, where the lower half are the normal maps for the upper half diffuse textures?

I suppose it looks and reacts about the same as ultra tree LOD with Billboard1 or Billboard2 and HD tree LOD billboards just without any of the additional advantages doing billboard tree LOD in object LOD has over standard tree LOD?

Link to comment
Share on other sites

  • 0

Thanks for answering.

Yeah, right now the bottom half is the normal + additional mask. One idea I had was an ambient mask, which could be used to simulate shadows relative to the horizon vector of the sun? So then the diffuse of the atlas is actually just purely the original colour. I'm not sure how correct that is. Regardless there can't be "ambient" or "diffuse" modifiers, a tree needs to match the lighting of the original model I think. Because the vertex normals are not present, the "sphere map" method is ideally baked in somewhere.

Yeah there's no benefits apart from as I understand it, slightly better performance, primarily with draw calls. And the ability to simulate more advanced lighting. Object LOD is still needed for edge case so tree LOD would need to be almost visually indistinguishable, at least at a distance. i have not tested the "ultra" tree lod so there may be additional performance impacts from that.

It only uses one billboard right now, but what I can actually do is use the normal vector to select a different atlas offset. So there could be as many tree billboard versions that fit within a 16k texture, or I can actually load additional separate textures if that's better.

Link to comment
Share on other sites

  • 0

Have a look at https://dyndolod.info/Help/Tree-LOD#Limitations to see a list of things that doing billboard tree LOD in object LOD solves - since a lot of years ...

Creating normal map textures for standard tree LOD billboard and creating an complex tree LOD atlas texture should be easy enough to implement though.  I might have a test version to test things soon.

25 minutes ago, z929669 said:

Could this be useful for grass LOD compatibility as well? Specifically thinking of ENB complex grass LOD compatibility.

https://dyndolod.info/Help/Grass-LOD
Grass LOD uses grass LOD billboards in object LOD, similar to ultra tree LOD. 

Grass LOD does not suffer from any of the standard tree LOD problems.

It would/should be up to ENB to apply effects made to full grass also to the distinct grass LOD shapes in the object LOD meshes.

Link to comment
Share on other sites

  • 0

Ah I didn't see this page, only looked at the other ones.

 

I'll note what could be fixable:

"No normal map textures resulting in limited lighting." - Fixed.

"No x or y rotation angles, always pointing straight up." - This could be done slightly randomly, otherwise unlikely to be fixable.

"Fixed billboard center, so there can be a lot of transparency overdraw because diffuse textures can not be trimmed." - As far as I know, the game still uses z-prepass culling on tree LOD, so I don't know how important this actually is. The CPU is more limiting than the GPU due to the single-threaded renderer so even if there's a tradeoff it may still be worth it.

"One billboard side per tree." - Can be done randomly. Still needs to fit into the atlas, or needs multiple atlas textures.

"One tree LOD atlas texture per worldspace. Maximum of 256 billboards per tree LOD atlas texture/worldspace." - Sounds unlikely to hit this?

"Tree LOD only unloads correctly if the load order of plugins adding tree references does not change after tree LOD generation. Tree LOD in parent worldspace used for LOD does not unload in child worldspaces. Tree LOD does not unload for references added by ESL flagged plugins. FPS problems in Skyrim when 3rd person camera crosses cell borders."

The first two might be fixable with changes to EngineFixesSkyrim64/treelodreferencecaching.cpp otherwise probably aren't fixable without addtional data.

 

It's worth me noting that the instance buffer has 8 unused floating point values. It may be possible to upload additional tree data as long as it is cached. e.g. taking the tree ref's rotation.

Link to comment
Share on other sites

  • 0

x, y rotation determine if a tree grows at an angle or lies on the ground etc. so it should match the full trees orientation to be useful :)

Overdraws aside, trimmed textures have less width, so there could be potentially be more texture on atlas. Not worth loosing much sleep over.

People hit the 256 limit with large worldspaces (Tamriel,  Skyblivion etc.), many tree mods with lots of varying trees or making tree LOD billboards for shrubs and bushes as well. More users hit space problem on single atlas texture first though.

DynDOLOD writes an extra *.txt file next to the *.lst file with pluginname;formid for each tree reference for a potential DLL to fix unloading. Can have more extra data if needed of course. The BTTs have 2 unknowns a 4 bytes for each tree that DynDOLOD currently writes the CRC32 of the plugin that adds the tree reference to.

It seems like a lot of work to do these things beyond the complex atlas texture, since all of those limitations are already addressed with using object LOD. If somebody is that desperate for the draw calls they should probably have full models, lower INI settings for full models, lower object LOD distances, generate less detailed LOD etc.

Link to comment
Share on other sites

  • 0

I did a test using the current DynDOLOD. Same settings apart from tree LOD(with new shaders in complex mode) vs object LOD. This was overlooking Riften with Engine Fixes installed, probably the worst-case.

Tree LOD in complex mode: 87fps, 69fps 99% average

"Ultra" object LOD using default resources, high preset, and "ultra" ticked: 73fps, 61fps 99% average

 

Edit: Looks like this setting by default is 3D... I will need to test again.

Edited by doodlum
edit
Link to comment
Share on other sites

  • 0

To compare also make sure to set the standard tree LOD distance as far as object LOD level 16 shows, assuming you generated with Billboard1 or Billboard2 in all 3 object LOD levels.

Download this test version of DynDOLOD https://mega.nz/file/tM5QVTTB#FmapuABtFMlws_fj8Gq1B6cZYlOIid7pJhcmzG53Bn8 and unpack as usual.

Set TreeNormalMaps=1 in ..\DynDOLOD\Edit Scripts\DynDOLOD\TexGen_SSE.INI and run TexGen with [x] Tree checked to generate standard tree LOD billboard diffuse and normal map textures. Install TexGen output as usual.

Set TreeLODComplexAtlas=1 in ..\DynDOLOD\Edit Scripts\DynDOLOD\DynDOLOD_SSE.ini and run DynDOLOD as usual with [x] Tree LOD checked. It should generate standard tree LOD but with a complex tree LOD atlas texture where the lower half has the normal maps as discussed.

Let me know if it works and if anything else is needed for any other things you might want to do with standard tree LOD in the future.

Link to comment
Share on other sites

  • 0

Set fTreeLoadDistance to the same as fBlockMaximumDistance. You can do that in the DynDOLOD SkyUI MCM Settings live in the game. TBH I never tested this in particular, so maybe eyeballing it works too. Make tree LOD go about as far as the rocky mountain object LODs. It will most likely not line up perfectly but for an estimate it should be OK.

Link to comment
Share on other sites

  • 0

Awesome!

I'll be releasing this soon. It would be good to have a way to check the dyndolod output to see if it was made with complex tree LOD like a simple ini file, then I don't need users to manually toggle it within the mod.

Link to comment
Share on other sites

  • 0

This test version creates a INI for each tree LOD texture. https://mega.nz/file/EVQT3ShQ#7c9gdFXTZyZN6VM0WyAG7CPLyoxP88KNtKx_LRU1BBw

So, same filename as the texture .INI instead of .DDS

[Information]
ComplexAtlasTexture=1

INI missing or containing ComplexAtlasTexture=0 for diffuse only texture

Note that there can be seasonal textures if Seasons Of Skyrim is used. For example, the folder Textures\Terrain\Tamriel\Trees\ can contain these files:

TamrielTreeLOD.dds
TamrielTreeLOD.ini
TamrielTreeLOD.SPR.dds
TamrielTreeLOD.SPR.ini
TamrielTreeLOD.SUM.dds
TamrielTreeLOD.SUM.ini
TamrielTreeLOD.AUT.dds
TamrielTreeLOD.AUT.ini
TamrielTreeLOD.WIN.dds
TamrielTreeLOD.WIN.ini
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Guidelines, Privacy Policy, and Terms of Use.