Multiple UDIM UVs and Blender/Cycles displacement

Hello,

I have model prepared for animation and rendering in Softimage but I wanted to give Blender a shot and see how it works. It was sculpted and textured in Mudbox and after that imported to Blender using FBX. As it is meant to be used as main character with a lot of closeups it’s textures are made on multiple UDIM uvs. I mean it looks like this:



Here is better described how it works: http://bneall.blogspot.com/p/udim-guide.html

After import I started work on shader and I was able (with some help of google) to make UDIM mapping for textures in Cycles shaders. It works like that:




The problems started when I tried to add displacement shaders. The cycles one is not working or I can’t use it. As I understand it’s work in progress/experimental/pre-alpha so… when I turn displacement type to True in object settings and turn on subdivisions I get only black model.
After some reading I tried using displacement modifier. It works for UDIM 1001 (or u1, v1 - default one) but I wasn’t able to make it working for other tiles.

Is there a way to modify texture coordinates for displacement modifier or use displacement as a shader?

Same problem here :wink:

http://www.blenderartists.org/forum/showthread.php?301138-Multi-tile-uv-s

Uh… I didn’t see your thread when was searching for some help.
To be honest we need simple texture offset when using it with displacement modifier. I almost don’t believe it’s not there. Was trying with texture options -> image mapping but without success. It looks almost like a bug to me when you use Extension Repeat, crop min: 1, max: 2 and… it’s still only in 0-1 space.

Try this node group.

Pretty much use this inbetween your image and your uv vector input, and set the target U and V space

UVTiles.blend (563 KB)UVTiles.blend (563 KB)

Thanks! It looks quite cool. But how to use it with displacement?
(I alrady have it working with textures in shaders diff/normal/etc)

At this time, we can not use udim texture with displace because displace don’t works with the node editor.
It’s not in blender because users don’t use this feature and don’t ask to devs to create it. :frowning:
I haven’t found how to use UDim with displace and we can not use it until the displace will not works in the node editor.

It’s bad because it’s a really important feature for working on big projects and characters.

I really want this feature. I think it would boost blenders appeal massively.

Exactly. I’m coming with models from Mudbox/Mari/Softimage pipeline. I like very much Blender’s animation tools, especially with latest Pitchipoy’s additions to Rigify (https://github.com/pitchipoy/rigify). Cycles rendering is (or maybe rather is coming to be) first class quality. Maybe it’s not as fast as some other renderers but for simple scenes it works pretty well with CUDA.

For me to be production ready it needs render time displacement with Cycles (which works at some level right now but don’t with heavy 4k 32 bit EXR textures x5 UDIM, thou I’ve seen it working [without displacement modifier] with simple meshes and generated textures). Build in support for UDIM would be nice but with some minor tricks it works already (at shader level).

In addition to that I’ve just found out why my textures in 32bit EXR wasn’t working at some point. Blender is limited to 5 floating point textures. It is GPU rendering limitation but for some reasons it is also in place for CPU renders. Info about it is here. I can only say: WHAT?!

Saying that I’ll go to blender.org and submit some bug reports/feature requests. Maybe devs will make something sweet for 2.70. :wink:

As I said in the other thread, I’ve already discussed this at length with the relevant developers. All agree that it is an important feature and one that will be added. It’s just a matter of finding the time/developer to do so. Handling UDIM texture sets in Cycles would be relatively trivial. But they also want the option to create such textures within Blender, and this will require a HEAVY rewrite of the texture painting toolset.

Great to know! Thanks for info.

Cycles more or less is able to handle UDIM already. The real problem is displacement as it’s more or less not usable in Cycles and displacement modifier doesn’t work with UDIM at all to my knowledge.

But as I understand the work on displacement in Cycles is work in progress ATM and native UDIM is in plans. It looks like great future for Blender. :slight_smile:

Once Cycles gets proper render-time displacement, wouldn’t you be able to do UDIM displacement using the above node group and the displacement node output?

Of course I will be. Maybe it wasn’t clear but when I mentioned in my earlier post 2 thins - working and reliable render time displacement and plans for native UDIM I meant I’m waiting for at least one of them. :slight_smile:

Right now I have working displacement in cycles shader (which is WEEE!). But it’s not very reliable (sometimes doesn’t work) and I won’t be able to add any more floating point textures to scene due to Blender limitations described earlier. But anyway it’s great to see so good results in open source software.

I have to totally agree with oskar. we need rendertime subdivision displacement and UV tiles support. Doing huge characters is almost imposible with the here mentioned resololution limitation.
ihave been testing arnold for a while and created a character with 10x4096 textures in all maps an displacement and it retains all the details for extreme closeups.
not trying to compare both renderers, just saying this feature will have a huge impact in the quality of blender artworks and is almost essential for VFX.

:slight_smile:

If ton is doing a full length feature film this time around, hopefully things like udim will be pushed a little further up the dev queue

The problem is that open movie projects are not exactly about cooperation with other software… especially not with closed sourced one. This feature won’t be high on priority list.

I would also like this to be implemented into Blender too. UDIM workaround is fine for now, but render time displacement is must have these days.

Btw, you CAN use the experimental “true” displacement option. (enable experimental features, and look in the mesh panel). Don’t enable subdivision in that panel though, that deletes all your UVs. Use the subsurf modifier to tesselate your mesh. (not quite as efficient, but passable).

`Well basically that forces me to tessellate mesh before render time, right?

Kind of. You can put subsurf at the bottom of the stack and reduce the preview level (or turn it off in the viewport) and you’ll never have to deal with it while editing. The render level just gets applied to the version that gets sent to Cycles. The only downside compared to true render time subdiv is that tessellation happens at the beginning of translating and exporting it, and the already-tessellated version is what gets sent to Cycles. So it’s slightly slower to export than true render time subdiv could be (maybe a few seconds on most things). But otherwise, it’s the same.

I’ve written an OSL script that helps simplify bringing in UMID Textures tremendously. There are some Node Groups floating around that have been a huge help, but I find it limiting beyond a certain number of UMID patches and can be cumbersome to make changes to.

This script allows you to load an entire folder of textures with a single node. The textures need to be named according to UMID design, however. A good example is “texturename_UMID#.tif”

Here’s information on the script. To use the script:
1.) Use Cycles Render Engine
2.) Enable “Open Shading Language”
3.) Import a “Script” Shader and load up the OSL text

You have four parameters.
1.) Max UMID : Enter the max UMID patch number that your set of textures use. This caps a loop which scans for the textures.
2.) Folder : Specify Folder. Use Absolute or Relative Folder location. For instance, if there is a folder in the same directory as the .blend file named “diffuseTex” that holds a set of UMID Texture patches then type “//diffuseTex/” into the field.
3.) Name : Specify name of textures in folder preceding the UMID number. For instance if the images are “specTexture_1001.tif”, “specTexture_1002.tif” … “specTexture_1029.tif” then specify “specTexture_” in this field.
4.) Ext : Specify extension of files. Example would be to type “.tif” here

I’m sure there are optimizations that can be made to the code, but alas. It’s a start.

If you’re unacquainted with the power of UMID patches, I suggest googling to see how they are used in other programs. This is great because you can create one node for each channel (diffuse, spec, displacement, etc.) that feeds its own shader node.

**ONE CAVEAT: You must have an unused image texture node floating around in the node editor for this to work. Not sure why…but you don’t actually use it.




shader UDIM(
    string Folder = "tex",
    string texName = "tex",
    string texExt = ".tif",
    int maxUDIM = 1001,
    
    output point UV_out = point(0.0, 0.0, 0.0),
    output color image_col= 0
)


{
    //SETUP INITIAL UDIM PATCH NUMBER
    int UDIM = 1001;
    
    //SETUP LOOP THRU IMAGES
    int counter = maxUDIM - 1000;
    for (int i = 0; i < counter; i++) {


        //SETUP UV PATCH COORDINATES FROM UDIM NUMBER FOR MAPPING
        float uv_x = (UDIM - 1001) % 10 ;
        float uv_y = ((UDIM - 1001) - uv_x) / 10 ;
        //float uv_y_hundreds = ( uv_y / 10 );


        //GRAB TEXTURE FILE WITH GIVEN NAME AND FOLDER (RELATIVE TO BLENDER FILE LOCATION)
        string texUDIM = format("%d", UDIM);
        string texFile = concat(Folder,texName,"_",texUDIM,texExt);


        //SETUP UV Coordinates
        float u_coord = 0;
        float v_coord = 0;
        float w_coord = 0;
        point UV = point(0.0, 0.0, 0.0);
        getattribute("geom:uv", UV);
    
        UV_out = UV;  //Will output Object's UV Coords if needed for troubleshooting
    
        float uv_x2 = (uv_x + 1);
        float uv_y2 = (uv_y + 1);


        //IF current UV coords for shading are within respective UV PATCH AREA specified by UDIM NUMBER from Texture file 
        //then use the Texture.  texture() requires UV between 0-1.0, so we translate the UVs to fit in this area


        if ( ( (UV[0] >= uv_x) && (UV[0] <= uv_x2) ) && ( (UV[1] >= uv_y) && (UV[1] <= uv_y2) ) )
        {
            u_coord = UV[0] - uv_x;
            v_coord = UV[1] - uv_y;
            UV[0] = u_coord;
            UV[1] = v_coord;
            image_col += texture(texFile, UV[0], UV[1]);
        }
        
        UDIM += 1;
    }
}

[ATTACH=CONFIG]348137[/ATTACH]