Announcement

Collapse
No announcement yet.

Randomized tiling function, eliminate repeating patterns in your textures!

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • replied
    I also had a D3DCompile error, but i managed to fix it by replacing HLSL hash function with material nodes. I'm guessing the problem of original function is that it's getting Sin of Float2 which is not possible in Unreal for some reason. You can check it by doing simple test:

    Click image for larger version

Name:	randtiling01.png
Views:	0
Size:	31.8 KB
ID:	1709923

    So i created this material function which is getting Sin before appending vector and replaced calls to Hash in TileFunction (its 3 of them in total). Now i don't have the error.

    Click image for larger version

Name:	randtiling02.png
Views:	0
Size:	122.8 KB
ID:	1709924

    I hope i didn't mess matrix multiplication because i'm not really good in math

    Btw, it's recommended by Epic to always try using material graphs instead of custom expressions, because it's better for performance and stability.

    Leave a comment:


  • replied
    So I tried out the new taa blend version, and it works. The biggest issue I have is that I am using a runtime virtual texture for my landscape, and it throws a d3d compile error only when trying to output to and then sample from it. I was hoping to be able to use it since it is an easier setup than the other method, but since there is also other some other weirdness with the shader and d3d errors when using other functions, I assume it may be caused my the same issue. I am not versed in the complexities of custom shader code, but in the future if a fix is released that will allow it to function with runtime virtual textures, this will be a game changer

    Leave a comment:


  • replied
    Hi, is there an simple example how to combine Randomizing Tilling and Layer bland?
    My problem is that Param Text Object can't join to node Layer Bland. Sorry, bad speak english.I Use Translate

    Leave a comment:


  • replied
    Originally posted by LucianoJacomeli View Post
    you used the array texture? if you use the virtual texture the performance will improve?
    I haven't used array textures for the material yet, they could be neat for different textures on the side of the tri-planar mapping or even to select a random texture per tile (You'd plug in a bunch of similar grass textures for example). For the current temporal blending based solution virtual texturing isn't too great, but for a version, without temporal techniques, it would bring large performance improvements. (Also with virtual texturing you could use that same virtual texture to blend in your static meshes, but I couldn't get the World Height virtual texture to work yet.)

    Leave a comment:


  • replied
    you used the array texture? if you use the virtual texture the performance will improve?

    Leave a comment:


  • replied
    Mostly done with optimizations now, made massive improvements:
    Click image for larger version

Name:	witch201912093.jpg
Views:	247
Size:	84.6 KB
ID:	1696008
    The terrain patch the cursor is pointing at is blending between 4 base and 4 top layers, so 8 layers total. The red one is still blending between a total of 24 layers. I've decided to leave them all available since the additional layers get compiled out without issues or additional cost (Well except making the material graph bigger).
    I've also changed how blending between the top and base layer is performed which is now dependent on the normal of the bottom layer. The way it blends at slopes with that is pretty nice. The biggest caveat is that the material only works well with temporal AA active and no tesselation.
    Click image for larger version

Name:	witch201912092.jpg
Views:	218
Size:	244.0 KB
ID:	1696009

    Leave a comment:


  • replied
    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.
    Click image for larger version  Name:	witch201912052.jpg Views:	0 Size:	197.9 KB ID:	1694697
    Click image for larger version  Name:	witch201912054.jpg Views:	0 Size:	71.0 KB ID:	1694700Click image for larger version  Name:	witch201912055.jpg Views:	0 Size:	218.0 KB ID:	1694701
    Click image for larger version  Name:	witch201912056.jpg Views:	0 Size:	225.9 KB ID:	1694702 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)

    Leave a comment:


  • replied
    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.

    Leave a comment:


  • replied
    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:
    Code:
    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.

    Leave a comment:


  • replied
    witch-dev NickGreenwood 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.

    Leave a comment:


  • replied
    Originally posted by Zothie View Post
    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.
    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.)
    Click image for larger version

Name:	witch201912031.jpg
Views:	373
Size:	175.9 KB
ID:	1693834

    This random grass texture I've downloaded from Megascans provides also a very good example of how effective my basic tiling function is:
    Click image for larger version

Name:	witch20191203.jpg
Views:	284
Size:	190.7 KB
ID:	1693835

    Leave a comment:


  • replied
    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
    Click image for larger version

Name:	image.png
Views:	310
Size:	178.9 KB
ID:	1693224

    Leave a comment:


  • replied
    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).
    NickGreenwood 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.

    Leave a comment:


  • replied
    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.

    Leave a comment:


  • replied
    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.

    Leave a comment:

Working...
X