I spent two days trying to re-create this method in Unreal.
First
I used an elaborate IF node tree and then I discovered the 2D Array
Lookup node. I thought it would take the texture's UVs, split it into a
given number, and then basically turn each square section into a 0,1 UV
space. Then that would let me have an array of textures I could select.
So I tried it with a simple 1024x4096 texture.
Also attached is the copy/paste from the UE4 material editor. I thought I cracked it but when I tried a real texture:
I'm
now assuming the 2D array node just looks at one specific point at the UV
coordinates. I tried looking it up but I keep getting stuff about blueprints that don't have anything to do with this specific node. Any
other nodes I should look at?
I know I could do this without a texture array, I just hoped to be able to use them.
Replies
I'm trying to do the same, I've found this (https://www.youtube.com/watch?v=fuvDy4lvGOM) but it's an old custom engine modification, in 4.26 it's not working (I've already tried ) and on 80lvl a guy basically tried to approach it without creating a tex2Darray but using a mask.
On UE4 forums people is still asking about it and apparently, it has got still some limitations.
I'd wanted to ask you if you did any progress?
Thanks for sharing, it's nice not to feel alone
lele83 said: Is this the one you are talking about:
https://80.lv/articles/ue4-gradient-array-mask-material/
Would be nice to have like 8 or even 16 materials in one. Is there a reason why ue4 or ue5 hasn't implemented this fully in the last 5 years?
Doing it in ue4 I think makes things faster and smoother.
What Eric Zimmer did is different from what CD project has done in The Witcher 3.
A good example is what Arvin Villapando did, which is pretty much mine same approach.
https://www.artstation.com/artwork/PoJqmB
The one on github:
https://github.com/fracturedbyte/UE4-T2DA
I understand this was a modified version of ue4. I am guessing it supported mipmaps. Without mipmaps, it is going to have a bad look in the distance and might affect performance since its using the full texture size so I think I get why @icegodofhungary implemented it this way..
Virtual texture array would be nice.
Ignore the texture, just a placeholder. Tweaking the mipmap value with a scalar parameter in a material instance. Seems to work. I am using ue5 btw.
Changed the 2d array texture settings- Mip Gen settings to - From No mipmap to Texture Group and it is streamed.
In the end, are you saying that you got everything working?
Albeit with the need to control mips by camera distance in the shader.
I'm on UE5EA as well and I'm using a lot of tiling textures and I'm wondering whether I can consolidate a bunch of materials into one using Texture Arrays to improve performance.
the only downside is not really performance-wise, but I guess if you are using this approach for a shader that is going to cover your entire environment, maybe it would be affordable.
@TECHNOBOG Drive your MIPS by camera distance is an interesting approach but it may get even more expensive.
Honestly, from UE5 I believe RVT is the best way.
This is a Tutor, and I work with him here for the MA in games, have a look, really good stuff and what he shows is game dev focus.
https://www.youtube.com/watch?v=XW6-SVGS22M
The issue is in having many (potentially dozens) of different elements, all seperately unwrapped onto a tiling texture (meaning the UVs are overlapping and are outside of the 0-1 space) makes it necessary to use multiple materials. With the method outlined in the post about the architectural workflow from Witcher as well the fracturedbyte UE4 modification videos linked above, you could use a single material (and therefore induce a single drawcall instead of multiple)