feat: add Terrain Variation
This is the final version of my plugin, Terrain Variation. It fixes the in game texture tiling visible on terrain via Stochastic Texturing. Works with vanilla, PBR, Complex Materials and Parallax. Untested with CS Terrain Helper. Untested in VR, no clue if that has a different pipeline for terrain or anything.
How it works:
- Transforms UV coordinates into a triangular grid space using a skew transformation matrix, creating a more natural-looking pattern than square grid sampling.
- Uses barycentric coordinates (the barry variable) to interpolate between three chosen points in this grid.
- Applies hash-based randomisation with the hash2D2D function to create pseudo-random but deterministic offsets for each sample point. Some blending is applied, and the offsets are applied to all texture layers the same, resulting in the texture being offset by the correct, same amount, for each layer.
In addition to the line comments:
- Ensure there are no hlsl warnings or errors caused by your changes. You may have to turn on debug mode. To the extent some warnings are there from older code in the files you've touched, consider cleaning them up in a prereq PR.
- Test with the feature off both in config (if an option) and with disable with boot under advanced.
- You may post a test build after addressing both 1 and 2. All major errors should be handled before we merge to dev.
-
No errors with my compile, I have tested 4 different states: AIO compiles fine AIO With plugin disabled at boot Individual plugins, with terrain variation disabled in MO2 Individual plugins, with terrain variation enabled in MO2. 1a. I'm not sure what you're saying, are you saying that previous warnings unrelated to my code need to be tidied before i can get my plugin accepted? I don't really get why. There are pre-existing warnings within lighting.hlsl, and i'm not gonna spend a day trying to troubleshoot those when they are unrelated to my changes.
-
Compiles just fine
-
I have a test build AIO posted in the discord, davo's Terrain Variation thread in the community channel.
- I said consider. If you don't want to help, that's fine. Just don't cause more problems.
Please check the names of things. The feature is Terrain Variations but it shows up in the menu as something else.
Please check the names of things. The feature is Terrain Variations but it shows up in the menu as something else.
Fixed this up, sorry was flipping between names but i think the tooltip is enough to explain what it does, and allows me to add more features or "Variation" ideas in future ( i was thinking something with texture-bombing, like puddles or other things onto terrain randomly)
Prior to merge I need to see a performance comparison, e.g. https://www.capframex.com/
Also, please see if using the new functions from this commit are useful for you.
Also, please see if using the new functions from this commit are useful for you.
That is very cool, I'll incorporate that in time. I have done a very large rewrite of the code on suggestion of exist and a couple others who were testing. The function now works on a distance-based slider, a video in action is visible in discord. Idk if its best to do a new PR or merge it into this (i created a separate branch as i didn't know if it was gonna work)