Page MenuHome

Improve UDIM functionality
Confirmed, NormalPublicDESIGN

Assigned To
None
Authored By
Tokens
"Love" token, awarded by zanqdo."Like" token, awarded by SLAD1026."Love" token, awarded by Loginzoom."Love" token, awarded by mistajuliax."Love" token, awarded by brilliant_ape."Love" token, awarded by Yegor."Mountain of Wealth" token, awarded by Alumx."Love" token, awarded by Shimoon."Love" token, awarded by Jaydead."Love" token, awarded by GageChristopherRenn."Love" token, awarded by Zino."Burninate" token, awarded by iWaraxe."Like" token, awarded by knightknight."Burninate" token, awarded by bnzs."Mountain of Wealth" token, awarded by juantxo."Love" token, awarded by RodDavis."Love" token, awarded by SomeAB."Love" token, awarded by andruxa696."100" token, awarded by Frozen_Death_Knight.

Description

The UDIM code from D3509 covers basic use cases, but there still are quite a few ToDos:

Related Objects

Mentioned In
T84594: UV editor loads all UDIM images even if not needed
T79360: Baking diffuse map generates black image if the UV is not on UDIM tile 1001
T77989: UDIM Textures: support for different file name schemes
T75116: UDIM tiles not recognized when reloading images
T74325: Export UV Layout option only exports UDIM tile 1001
T73730: 2.82 UDIM "Edit externally" is capable of opening ONLY the first tile
T73110: UDIM Texture Paint Crash
rCcb5ea9f3bc84: Add support for tiled images and the UDIM naming scheme
T72648: 2.82 Texture Paint/UDIM - color sampling always samples only 1st tile when using UDIMS
T72734: UDIMs don't behave properly on imported geometry
T55435: Support for UDIM textures and tiled images
T66305: Render & Cycles Module
rBc30d6571bb47: Add support for tiled images and the UDIM naming scheme
D3509: Add support for tiled images and the UDIM naming scheme
Mentioned Here
T77989: UDIM Textures: support for different file name schemes
T75116: UDIM tiles not recognized when reloading images
T74325: Export UV Layout option only exports UDIM tile 1001
T73730: 2.82 UDIM "Edit externally" is capable of opening ONLY the first tile
D6492: Support packing UDIM textures
rBe4413dc72bfb: Cycles: Use OIIO UDIM tag instead of %04d
rBfa5e28ab08c7: Cycles: Support UDIMs with OSL shading
rBf9e65fcea72f: Textures: Support UDIM images
D6456: Use 2D texture arrays for UDIM drawing in Eevee to avoid texture limit
rBbdbcb0df1060: Image Editor: Load UDIMs even if secondary tile is selected
rB850aa3a6cfe1: Image Editor: Disable tile operators if tile 1001 is missing
rB11d927180444: Image Editor: Add option to fill UDIM tiles during creation
rBe0cd5b980fc5: Image Editor: Add option to create multiple tiles at once
D6421: Workbench Engine: Add support for UDIM textures
D3203: Baking system overhaul: Move baking settings from render settings into BakePasses
D3509: Add support for tiled images and the UDIM naming scheme

Event Timeline

Hey @Lukas Stockner (lukasstockner97)

Testing this out on my end. In GafferCycles if I create an image_texture node but have the filename path blank, I will get an assert. My workaround is:

if(!path_exists(filename)) {
  return -1;
}

In: https://developer.blender.org/diffusion/B/browse/master/intern/cycles/render/image.cpp$319

So that in https://developer.blender.org/diffusion/B/browse/master/intern/cycles/render/nodes.cpp$410 this doesn't get set to true on an invalid filename path.

While I have your attention, may I suggest using the <UDIM> syntax to force is_tiled to on? This is aligned with how OpenImageIO works and other renderers using OIIO adhere to this system (and I assume the TextureCache branch might also use):
https://github.com/OpenImageIO/oiio/blob/master/src/libtexture/imagecache.cpp#L300

Cheers, great work so far Lukas!

@Alex Fuller (mistaed) I can't reproduce that issue - if I set an empty filename, it just renders pink without any asserts. Can you tell me which assert you're hitting?
Regarding the <UDIM> tag: Good point, implemented in rBe4413dc.

Hi @Lukas Stockner (lukasstockner97)

I just did a clean build off of Blender master to my standalone Cycles and I can't recreate the issue now, it is pink so that's good. I am balancing the texture cache, openvdb, adaptive sampling & light-groups patch here which probably one of them introduced something weird with the udim patch which I'll try to investigate on my side (gut-feeling it was the openvdb one).

In my case it is triggering has_image to true (first slot is not -1) despite having an invalid path so it never assigns pink and thinks there's an image so it'll eventually assert in the kernel somewhere when it can't find the right INTERPOLATION_* or EXTENSION_* as they were never uploaded to the device properly.

Cheers for adding the <UDIM> tag, that'll work consistently inside of GafferCycles next to Arnold, Appleseed & 3Delight.

I just had another thought/idea which isn't necessarily UDIM-related but it might be a good feature to have. In the other renderer backends you are allowed to set the pink missing texture to a color plug. This works well as a fallback, so often in lookdev we would assign a safe texture fallback to the missing texture plug or set it to black if we don't care (like if the model/texture is WIP) or if there's an asset variant change and only some UDIMs are modified and the missing ones would just sample from the base UDIMs via the fallback plug.

In addition to this, I haven't done much testing here with Cycles UDIMs but usually a toggle to fail the render on missing UDIMs (when there are some tiles but not all tiles available based on the mesh UV requests) can be set in other renderer's image samplers, which you can turn off and show the missing texture colour instead of failing. This might go hand-in-hand with the above feature.

Cheers!

Hey Lukas,

I got a chance to test out UDIM support in GafferCycles/Standalone, and I think I've found a bit of an issue here. I noticed in the blender_shader.cpp that this is where the known tiles available are discovered eg.
https://developer.blender.org/diffusion/B/browse/master/intern/cycles/blender/blender_shader.cpp$669

However, in the case of Cycles standalone there's no real way to give this information if all you've got is a file path, so there is an early exit made here:
https://developer.blender.org/diffusion/B/browse/master/intern/cycles/render/nodes.cpp$311

Should this use a filesystem check to see what tiles are available, or should I made something custom in GafferCycles to do something similar to what Blender is doing? I'm guessing for regular Cycles standalone that a <UDIM> path won't know/check for more than 1001 either and would need code as well to set the tiles vector.

I wanted to post it here to see if it was an oversight or by design.

Cheers

vas (Alumx) added a subscriber: vas (Alumx).

By the way, UDIMs are not autodetected if using ctrl+shift+t for simultaneous shader channels population with image nodes. But may be it's up to the node wrangler addon functionality.

I don't know if this is already addressed, but I have python script that load tiled image (texture_1001, texture_1002) into texture node but preview only show first tile.

Did some more tests. So If I name textures in 3d-coat like this: Mesh_diffuse_1001..1002.jpg
Then use blender python script to create texture node and load images files into it. The preview will show only first tile. Now if I go back to 3d-coat and create textures again and this time name them Mesh_1001_diffuse.jpg, etc... then use texture node folder button to load images manually and select this new file ...1001.jpg file. Then preview view changes to look correct.

UDIM baking is not working yet, please update in the latest upcoming blender version.