Randomized tiling function, eliminate repeating patterns in your textures!

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.

Thanks for reply, i’ve downloaded and open you updated in 4.23? Some things not open in my 4.22.3 version. I check the files and all they exist in the project but only 7 is in editor. I will download the 4.23.1 to verify.

Ah yes, I’m on 4.23 currently (built from source). I didn’t realize that this could cause such issues. I hope you can open it and migrate it over to an older version if necessary. I’ll make sure for future updates to pay more attention to that and update the readme file appropriately.

How does this compare to the built-in texture_bombing node?

https://forums.unrealengine.com/development-discussion/rendering/85140-texture-bombing
https://developer.download.nvidia.com/books/HTML/gpugems/gpugems_ch20.html

My material is much cheaper, as far as I can tell, even a single texture_bombing node in a material connected to only the base color output has already more instructions and texture lookups than my full material.

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.

I understand that many might like that, but outside of prototyping purposes using it like that won’t be very useful as each separate map would add three more texture fetches and that would quickly become very expensive.
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.)

@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 GitHub - 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.

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.

Material it is working alone, but why is so hard to use it in a landscape material? i don’t know what it’s causing D3DCompile Exception.

@witch-dev Do you already try to use it in some landscape material?

@LucianoJacomeli I’m using an older version of the material in a project and I’ve just thrown together a landscape material with the temporal version and it’s working fine for me. I can update the project later this week with an example of it in a landscape material with a few layers.

@witch-dev This will be amazing! i have a lot of landscape material, but with my version of RHAO it’s what i use since i use Quixel Megascans Textures and now is FREE for UE4 Developers.

I’d like to use this in a landscape too i’m migrating from Unity and this feature looks amazing specially if used in layers. i’ve tried to use but show a compile exception in Material.

@LucianoJacomeli Still going to work on this, I just didn’t find the time for it yet (also I’ve been wanting to wait for 4.24 because it finally makes array textures available).
@anonymous_user_917e6b1f The material might be a bit complex if you are just starting with unreal, I’ll try to have a more complete (and flexible) example available soon.

Same “D3DCompiler exception” for me when i try to do WorldAlignedBlend for more than 1 material with such function. Im not really experienced in ue4 materials to solve it by myself but its still a very cool function that helped me a lot. And anyway, i would be very appreciated if anyone helps me with that error. Here is my blend func if needed

It’s a bit difficult to figure out what is going on from your screenshot. I haven’t used the WorldAlignedBlend node before, If you can upload an example with the error somewhere I can take a look at it.

I’ve started working on my landscape master material, though it’s going to take a bit longer. The material is going to be fairly complex because I’m mixing temporal, tri-planar and height based blending techniques to achieve the best compromise between quality and performance (Also I’m looking forward to having array textures supported in the engine). I’ve also taken a look at Quixel Bridge and am now developing the landscape material with textures exported from there. I’ll document the correct export settings so that your textures from there will be compatible with the material (I won’t be able to upload my project with Megascan texture due to the license.)

This random grass texture I’ve downloaded from Megascans provides also a very good example of how effective my basic tiling function is:

2 Likes

@witch-dev @anonymous_user_917e6b1f @LucianoJacomeli doesnt megascans are free for ue4 users now? I thought its ok to share assets with anyone but its illegal for anyone to use them in their projects… But anyway, ive reproduced this issue here at 4.23 https://drive.google.com/file/d/1jjp…vnkMVqLYx/view

And also ive just solved the problem. At least a bit.
First, when i was searching for the problem, ive tried to pin the material to the end output first and it was ok. But when i pinned it to the blending function and then to the output - it ended up with error. So i thought the problem was in blend function or somewhere there.
Secondly, it can work with blending function, but it works only if material is outside any function as in the example project ive made. Cant say what the problem but i guess its something inside the engine.
But, thanks to you, ive come to try to reproduce the issue and accidientally solved it. Hope it will help anyone else who comes there with that thing. All setups that work\doesnt work is in the project link above.

@Zothie Weird error, I have really no idea why it would fail there when used inside a function, glad you have found a workaround. Here is the full error message for future reference:


LogShaderCompilers: Warning: 1 Shader compiler errors compiling TestMat for platform PCD3D_SM5:
LogShaderCompilers: Warning: C:/Development/UnrealSource/UnrealEngine/Engine/Shaders/Private/ShadowDepthPixelShader.usf(): Shader TShadowDepthPSPixelShadowDepth_OnePassPointLighttrue, Permutation 0, VF FLocalVertexFactory:
    D3DCompile exception
LogShaderCompilers: Warning: Failed to compile Material /Engine/Transient.TestMat for platform PCD3D_SM5, Default Material will be used in game.

Regarding the Megascan materials as far as I understand it, the license allows using it in any game made with unreal engine. But we are not allowed to share the textures, I’ll just ask whether having textures in a public project as *.uasset is okay or not.

@witch-dev amazing images, with Quixel Mixer do a texture with grass & dirt and with your function randomizing everything, tomorrow will occour a livestream about the new open world tools for UE4, lets see if they will say something about “array texture”, i hope it transform the UE4 like Frostbite in support for multiples landscape layers.

It’s time to tune it down again. Currently, I have 12 top and 12 lower layers with one layer that regulates how much the lower layer shows through, the lower layers also get more visible the steeper the terrain is. All layers are tri-planar projected (I’m using temporal blending, so having all layers tri-planar is the same cost as having one layer tri-planar) and blended with texture height information, my main issue right now is that I can’t have two sets of weight blended layers (top and bottom layers should be weighted separately). It’s now time to optimize the shader and probably throw out a few layers as 24 seems a bit excessive.



The textures are straight from Quixel Bridge, I didn’t adjust them and just chose them pretty much at random. (Which led to most of them being Iceland stone/rock textures)

1 Like