Program to Create a single Untiled Texture from Tiled Seamless Textures

richardandtracyrichardandtracy Posts: 5,665
edited January 2 in Freebies

I'm sorry, it's a very unwieldly thread title, but I'm not sure what else to call it.

I have been modelling up a little house (as below) and have run into a little problem.

The roof slate texture I'm using is a seamless tilable one and needs to be tiled to get it to have the right size slates. However this leads to a noticable repeating shaded pattern. As below:

Now, I can darken the repeating image, but then my ham fistedness while altering the shading will also repeat. Not good. I thought 'Wouldn't it be nice if I could take the tile and repeat it lots and create a single tex map that will do the job' and then that image can be edited to avoid some of the pitfalls of tiled textures...

So, imagine a tile with four colours, repeated 4 times along the U axis, offset 0.1, and 5 times in the V axis, offset by 0.2. This is possible manually, but a pain. The sort of thing I'm talking about is this:

Combining multiple tiles by hand into a single image in an image editor is a pain, so a program would be useful for this. If you think so too, well..., I've just done one for myself under windows (32bit, used under Win 11), as below:

This currently has slots for Diffuse, Bump, Normal & Roughness. Would anyone find it useful? If so, I'll try doing a help file & could add channels like glossiness, emissivity etc (all but one of which could be blank when not needed) so those channels can also be done at the same time. If you want it & can think of extra channels, please say what you want & I'll add them.

At the moment the program can produce four files automatically, using the example above they'd be called

  • Tiledpattern_Diffuse.png
  • Tiledpattern_Roughness.png
  • Tiledpattern_Bump.png
  • Tiledpattern_Normal.png

All the output files are always PNG and all are the same size as each other and the size specified in the program bottom two edit boxes (in this case 300x300).

Looking at the requirements of some MR textures, this may be a way to quickly modify a set of textures so a vendor is a good way to meeting a common MR requirement that the original texture is not to be distributed unaltered. To complete meeting the MR requirement would involve putting a material UVMap mask on top to blank out the outer edges.

Look forward to any comments. Need to bug zap and test it with vast (4k/8k) files etc, but thought as it worked just now, it might be useful to get additional input/usability ideas if others may want to use it. I'd put it up as a freebie on my website when done, similarly to my stl->obj converter program. I'd also supply the source code so you can check for yourself that there's no harm done by it. If no comments in the next few days, I'll assume it's a tool too far, that no-one else needs it and I'll avoid the effort of making the help file, adding channels if (or when) I need them.

Regards,

Richard

Render Patterns2.png
924 x 902 - 855K
Render Patterns 4.png
651 x 708 - 152K
Render Patterns 3.png
666 x 548 - 25K
Render Patterns6.png
800 x 800 - 261K
Post edited by richardandtracy on

Comments

  • richardandtracyrichardandtracy Posts: 5,665
    edited January 3

    Last night I tried to tile a 4k image, and ran out of resources at 6x5 (24576 x 20480 pixels for the intermediate full size image held in memory). This is a 32 bit programming limitation, bumping into a 2gig memory allocation limit rather than running out of machine RAM. So, I'll put in a check to see if the program is going to run out of resources before it does, then put in a way of making the intermediate tiled image the size of the final image. My preferred method so far keeps the max resolution copy of the images for as long as possible to reduce the chance of loss of detail.

    Regards,

    Richard

    Post edited by richardandtracy on
  • perlkperlk Posts: 854

    OMG, this would be so useful. 

  • richardandtracyrichardandtracy Posts: 5,665
    edited January 3

    @perlk , I thought that, if anyone, you'd be the most likely to feel it's useful - but I had no idea if you had an equivalent already. I'll see what I can do with it.

    My experiments last night meant that I have to double the conversion routine. Not all that difficult, as it's largely copy & paste, but it's just over a year since I last programmed anything and I've become quite rusty. Add in a new version of the programming suite and I'm really slow. I last programmed seriously with V10.1, 2 years ago, it's now 11.4 and ready to go to 12.0.

    In some ways I wish I could load in a tex mapped obj file, allow the user to select a surface for the texture and then mask everything else not allocated to that surface. However, at the moment with my current level of rustiness, that's beyond me. And, I have to say, the libraries either don't handle PNG graphics very well or (more likely) I don't understand the transparency associated with them very well.

    Regards,

    Richard

    Post edited by richardandtracy on
  • Eustace ScrubbEustace Scrubb Posts: 2,698

    What if you just had a basic shader that handled tiling, tile offsets, and pattern rotation internally?  Would that help?

  • richardandtracyrichardandtracy Posts: 5,665
    edited January 3
    Yep. It might help a fair bit, at the moment I'm planning on using the DAZ Uber shader that does those features, but it doesn't avoid visible repeats that you can erase if a tiled seamless texture is used as the background texture of one that you can paint on knowing none of the extra painting will repeat. If I were to target an alternative shader, it'd have some disadvantages: I currently can't create one, and I can't distribute other people's work for free without an appropriate license. Otherwise it seems like an interesting idea. Not sure how I'd get stains down the correct part of the roof from the chimney stack or stains on the planks of the house either, but it may be possible to get around the problem. Converting Tiled Seamless images into a fixed one allow you to paint such features on a ready made background. BUT, it has to be said, I am not good at it, somewhat better at making my own tools instead. Regards, Richard.
    Post edited by richardandtracy on
  • English BobEnglish Bob Posts: 113

    This looks interesting, in particular its ability to process a set of images simultaneously. I'm not clear how (or if) it goes about avoiding the "repeating shaded pattern" you mention. Paint Shop Pro - my ancient but trusty image editor - can replicate tiles easily enough, but those repeating patterns can be a problem that requires extra work, and of course individual maps from a PBR set, for example, must be dealt with one at a time.

    Anyway, I'd be interested in having a play if you decide to take this project further.

  • richardandtracyrichardandtracy Posts: 5,665
    edited January 8
    It doesn't avoid the repeating pattern problem, it just creates a single large image with the repeating elements already laid out for editing. Maybe my version of PSP is too elderly to have it built in (Version 5), but duplicating the tiles involves manual positioning of the tiles, and if you wish to tile something [say] 50*60 times, that's going to be tedious and error prone, especially if the same functions have to be applied to the diffuse, normal, roughness, emissivity and opacity maps too. Anyway, I am also going to add the option to mask the image based on the texture mapping for a particular surface material zone in an obj file model, so that the different material zones can be layered on the same image as if it's a coloured-in texture template. The combination of the individual material zone texture layers into the final multi surface texture won't be possible programmatically, but could be carried out with drag and drop in GIMP. Not sure I'm explaining this very well, will have to show it once the program is programmed. Regards, Richard.
    Post edited by richardandtracy on
  • lilweeplilweep Posts: 2,487
    edited January 8

    I thought daz could already bake tiled textures into single texture - using shader baker.

    I think it is for 3Delight, correct me if wrong, but if it's just for baking image maps, dont see how using 3delight is a problem

    edit: link https://www.daz3d.com/forums/discussion/comment/6072412/#Comment_6072412

    Post edited by lilweep on
  • richardandtracyrichardandtracy Posts: 5,665
    edited January 9

    I must admit, with the DS documentation being quite as fulsome and comprehensive as it is, I had entirely missed the existence of the 'Shader Baker' & have never heard of anyone refer to it either in the 4-ish years I've been back in the forums. I will investigate. If it's limited to image maps, it will be a problem, as I'd like to use it in one hit for every map associated with a surface, including diffuse, roughness, normal, bump, emissivity, metalicity, opacity & anything else associated with the DAZ Uber shader.

    Regards,

    Richard

     

    Post edited by richardandtracy on
  • English BobEnglish Bob Posts: 113

    richardandtracy said:

    It doesn't avoid the repeating pattern problem [...] Maybe my version of PSP is too elderly to have it built in (Version 5) ...

    Thanks, I see - hopefully you have enough positive comments to encourage further development, because I still think this could be a useful tool to have.

    I use PSP 7, which has the ability to define styles for the foreground and background: solid colour, gradient, pattern or null. Using patterns with the fill tool is the key to repeating a tile - it's been too long since I used version 5, but if you want to chat further perhaps we should do it via messaging, so as not to clog up this thread with discussion of ancient image editor technology. ;) 

  • perlkperlk Posts: 854

    I don't know why I've never heard of a Shader Baker either, sounds like I need a chef's hat...agreed, I only use image maps for details, not for surface shaders because I prefer to allow people to change textures should they want to use something else. 

    If you make any progress, @richardandtracy, I would be happy to beta test!

  • richardandtracyrichardandtracy Posts: 5,665
    edited January 10

    I am getting on slowly. Rather more slowly than I had planned. 

    My dad is in a care home 200 miles away, and my unrelated step brother (who lived nearby) was looking after his finances, day to day expenses etc. Unfortunately my step brother's body was found at home on 3 January. He was only 51. As the next nearest relative, I'm now going to have to take over my dad's things & sell his house (which was always going to happen this year). It's one heck of a shock, and I have been unable to get through to the right eople in the last week. So, things are going slowly and it's taking a fair bit to organise. Then just to add to the pot, my Mother-In-Law who came out of hospital on 19 December had an emergency & went back to A&E yesterday morning. She's staying in hospital for an undefined time.

    Progress with the program so far has been to identify when the memory limit is going to be hit and divert program flow to a not yet written routine to save RAM. I have also set up the interface for opening an obj file for the image masking, and the selection of the surface groups to be associated with the images being tiled. Then I've put in a check that mirrors or flips the tiled image if the tiling value is below zero. That's as far as I have got since the initial post.

    Regards,

    Richard.

     

    Post edited by richardandtracy on
  • SkelchSkelch Posts: 275

    richardandtracy sorry for all you are facing I pray it goes well. My brother passed in October and I am the executor it is quite the pain dealing with this type stuff so I feel what you are facing. Hope all goes well for you taking care of these finance issues and sorry for the loss to your family.

  • AOBBAOBB Posts: 957

    @richardandtracy - We are both in a very similar situation, so I really feel for you. I am holding you in my thoughts and prayers. heart

Sign In or Register to comment.