After seeing some posts asking about UE4 and udims, I decided to make some material functions and material templates for those people who would like to use this technique in their favorite game engine...
Download here:https://www.dropbox.com/s/zzn7eb59i6b5q15/Udim.zip?dl=0 The collection contains:
- 4 material functions
- 4 material templates (4x1,4x2,4x3 and 4x4 tiles)
- a dummy texture to be used in unused slots in the material function, when the user wants to use less textures than what would be required to fully fill up all the slots of the used function. This texture is already embedded into the functions, you don't need to do anything with it.
- 16 color, metallic, roughness, ambient occlusion and normal maps for showcasing and as examples
- 2 simple example meshes (both of them were unwrapped to be used with the 4x4 tiles function)
- Minimum required engine version is 4.16.1
All the functions has similar rules to the ones described here on Allegorithmic size, for Substance Painter:
https://support.allegorithmic.com/documentation/display/SPDOC/UDIM Same:
- Negative space isn't supported
Not the same:
- Because of how the functions are constructed, its limited to 4x4 tiles at maximum, when using the 4x4 function (up to 16 tiles). If you have different UV layout on your mesh, like UVs go on U until U10 for example, please change your UV arrangement before the final export, to fit and get it working with the 4x3 material template.
How to use them:
The pack contains material templates, made for all functions, so you can just create a material instance, and assign your textures. The material templates contains setup for base color, metallic, roughness, ambient occlusion, and normal map textures. Metallic, roughness, and ambient occlusion, are packed into the r-g-b channels of a single texture. If this description isn't clear, take a look into the provided examples. The material templates are set up to use this format, but you can make your own material template with the function, based on the original ones, if you need different type of textures, or more textures.
For best performance and efficiency, please always use the material template, that has the necessary amount of tiles for your needs. Don't use the 4x4 template if you have less than 13 tiles, Dont use the 4x3 template if you have less than 9 tiles, and don't use the 4x2 template if you have less than 5 tiles. Unused slots will use the dummy texture coming with the package, don't delete it, because if you do, the functions will report missing texture errors.
Folder structure:
- Examples: contains example content like textures and meshes
- Material functions: the actual functions to be used in the material templates
- Material instances: Example instance for each material template
- Materials_Base: The material templates that you can use to make instances
Reminder - The more tiles V space you use, the more expensive will this become when you use these material templates. The 4x4 (can be used to have 16x5 maps) template shows 314 instructions in the material instance, the 4x3 (12x5 maps) is 255, 4x2 (8x5 maps) is 197, and the 4x1 (4x5 maps) is 139. All texture samplers are set to use shared sampler, this is why it allows to use more than 16 textures in a single material.
Enjoy!
Replies
1) Make a function that would go from 1001-1010 instead of the 4x4 square as it would require less changes in the models' UVs.
2) Make a series of switches to increase/decrease the amount of texture samplers that are being used and always have an optimized graph.
But before I dive into this, I wanted to check with you if there was a reason you hadn't added these features to your original design.
I'm used to VFX but relatively new to Unreal so could you please tell me if these 2 features would be cause any problems?
Thanks
Unfortunately UDIM's are not working as they should in UE 4.23.1 :-(
https://forums.unrealengine.com/unreal-engine/feedback-for-epic/1618618-virtual-texturing-feedback?p=1686084#post1686084
This can seen in this example below using 100 udims spread on 10x10 tiles.
LEFT: correct order in Maya; RIGHT: wrong order in Unreal
UDIMs should always read from left to right, bottom to top, whichever application is being used.
https://forums.unrealengine.com/unreal-engine/feedback-for-epic/1618618-virtual-texturing-feedback?p=1688979#post1688979
However it implies recompiling the UE source code yourself.
Hopefully the fix will make it into 4.24.1.