so it wont work for default textures? i guess i need to merge textures myself. or add addition textureobjects somehow?
Announcement
Collapse
No announcement yet.
Randomized tiling function, eliminate repeating patterns in your textures!
Collapse
X
-
Originally posted by Solo-Paul View Postso it wont work for default textures? i guess i need to merge textures myself. or add addition textureobjects somehow?
For more texturobjects just look at the current "albedoRough" input in the "TiledHeightBlend" Material Function and build the new texture input from there, it's just a few nodes to add an additional texture.
If you don't have height information available calculating average colors(just add your RGB channels and divide by 3) or a normal map based blending should also lead to good results. I just went with height since I was using that already in my landscape textures anyway and it's simple to blend with.
The place you'd have to change for different blending methods are the connections going into the block commented with "texture height for blending" in the "TiledHeightBlend" Material Function.
- 1 like
Comment
-
Originally posted by witch-dev View PostThanks to this marketplace thread: wip-stochastic-height-blending-node-for-material-graph-never-see-tiling-textures-again I found out about this paper: Procedural Stochastic Textures by Tiling and Blending.
I implemented the tiling method shown in the paper (the main point of the paper is actually some kind of "Histogram-preserving blending" but I wasn't interested in that part since I knew I could use my existing height information for blending), I wasn't entirely satisfied because I couldn't manipulate the individual texture samples easily (like rotate, mirror or scale them on a per tile basis for additional randomization). I now implemented a different a solution based on two offset square tiles + and a third rotated by 45°. The function is written with my packed landscape textures in mind (two RGBA textures one with color and roughness and the other with two channel normal, AO and height), the function is commented and changing it for different texture setups shouldn't be difficult. If you are changing to a different texture setup there are some specifics in the function regarding swapping/flipping some channels of the normal map for rotation and mirroring which you have to watch out for.
It works very well for organic textures, for something like a brig wall probably not so much. (Maybe if the offsets would be modified so that they happen at fixed steps to match the size of the brigs or something, but I don't think that it is the best solution for those cases.)
Default texture:
Randomized:
Debug views showing how the tiles are composed together:
Depending on the value you set for "tileBlendWeight" the influence between the tiling pattern against the textures height map can be changed with lower values leading to a stronger randomized effect, though it will also start to heavily weight towards the heigher areas in your height map. The other parameters should be easy to figure out especially if you utilize the debug view.
The function was written for version 4.22.0 ( Which finally has a RGBA output on texture samplers and I used it, so no idea if that is going to break in earlier Unreal versions).
If you want to try it, just copy the text in the "randomizedTiledSampling.txt" file into a new function (delete the default output node first).
An example project with a texture and an optimized material set up can be found here: https://github.com/WitchDev/RandomizedTilingMaterials
Edit: There is one connection going directly into "texcoord" which should be connected to the respective "function input" instead.
- 1 like
Comment
-
Originally posted by LucianoJacomeli View Post
How we do this debug view in the final image?
I've also updated the way tiles get rotated if "rotateTiles" is turned on, now each tile gets a random rotation (before it was fake rotations which were basically just mirroring the texture coordinates on different axis and it was always the same for each kind, so all green tiles used to be rotated 180 degrees for example).
I also wanted to try using this with virtual textures, but the current implementation of virtual textures is not yet suitable for landscapes which is my main use case for this material.
- 1 like
Comment
-
Originally posted by witch-dev View Post
That wasn't possible in the version on GitHub, I've updated it with a new version that makes this possible, just toggle "showDebugColors" in the material.
I've also updated the way tiles get rotated if "rotateTiles" is turned on, now each tile gets a random rotation (before it was fake rotations which were basically just mirroring the texture coordinates on different axis and it was always the same for each kind, so all green tiles used to be rotated 180 degrees for example).
I also wanted to try using this with virtual textures, but the current implementation of virtual textures is not yet suitable for landscapes which is my main use case for this material.
- 1 like
Comment
-
How does this compare to the built-in texture_bombing node?
https://forums.unrealengine.com/deve...exture-bombing
https://developer.download.nvidia.co...gems_ch20.html
Comment
-
Originally posted by OptimisticMonkey View PostHow does this compare to the built-in texture_bombing node?
Comment
-
Hi @witch-dev ,
Great material, thanks!
As feedback, it would be very interesting to have an option (static switch param) to use separate maps as normal, heightmap, base color, etc, instead of unified ones. Yesterday I (fastly) tried to add that options and to share it here, but I didn't found an easy way to do it and didn't get a perfect result, as I hadn't time to analize the whole logic of the material.Last edited by Miguel1900; 10-23-2019, 09:28 AM.
Comment
-
Originally posted by Miguel1900 View PostHi @witch-dev ,
Great material, thanks!
As feedback, it would be very interesting to have an option (static switch param) to use separate maps as normal, heightmap, base color, etc, instead of unified ones. Yesterday I (fastly) tried to add that options and to share it here, but I didn't found an easy way to do it and didn't get a perfect result, as I hadn't time to analize the whole logic of the material.
But I have now added a new material that uses TAA for blending without a heightmap, so the transitions are just linear gradients. It still looks surprisingly good and with this adding another texture sampler will only add a single texture fetch. (for reference the height blending based material has with my two textures has 230 instructions and 6 texture samples, the TAA based material has 237 instructions and 3 texture samples (one of those is for temporal blending)). The new material can't be used with tessellation though.
Comparison screenshot left side is the old height based method, right is the new material. (The two ground planes are touching and I can't really tell anymore where one material starts and the other ends.)
- 1 like
Comment
-
witch-dev , hi i don't know how to use Github so i've downloaded as .ZIP your project anyway... i put back in github https://github.com/LucianoJacomeli/RandomTiledRHAO in my version i add the RHAO version, my packed textures is: albedo, normal, mask = Roughness, Height, AO. Please test and check if is correct i think i've destroyed some parts, because my colors look strange. I only not understand why we need to put the mask texture weightmap in all texture.
- 1 like
Comment
-
It looks fine to me, the colors look strange possibly because the skylights intensity was fairly high. You only messed up the output for the debug colors (you had the switch on your RHAO output and it should have been on your albedo), then I changed the normal map to use the normal map sampling mode. You aren't using a channel packed one, so you can just use Unreals standard that means the offsets around the rotation aren't needed and the function at the end which reconstructs the blue channel isn't needed either.
I've made a pull request to your GitHub project, it should merge without any issues.
Weight map works such that it multiplies the masks from the tiles with the height values from your textures and then calculates a weight for each of the 3 texture samples such that the total adds up to 1. With this weight, you can now multiply the 3 texture samples and add them together to get your final values.
In the next revision of this I'll make sure to include a version with a seperate normal map, but for anyone looking to use it with a standard normal map your version with my fixes should be a good starting point now.
Comment
Comment