Jump to content

[SOLVED] material graph : interior mapping texture2d.msubgraph


photo

Recommended Posts

Hi, I'm using this cool node to fake interiors (2d node, simpler to produce textures), however i'm wondering if it would be possible to modify it so it would support an atlas as texture input in order to save some materials (ie not have one material per window), there's a tiling option but I can't figure out how to use it. What I'd like to do is to use uv1 I generate procedurally which are scaled and randomly translate in stepped grid pattern with some logic, (multiple of 0.125) since the atlas I want to use is 8*8 (64 tiny 2 point perspectives of some ai generated interiors, layout in one single 4k texture). I don't really know if this is possible,since the uvs are not 0-1, but I guess this is doable. Thanks for some inputs on that.

Link to comment

Hello! If you want to create UV for windows by yourself than you just need to take the material from samples (which I suppose you're already using) and set the tiling according to your input atlas texture. So basically if you have an atlas with 64 chunks (8 by 8) than you need to set the tiling as 8 by 8. You don't need to change offset because you're going to create UVs by yourself. UV of a single window should look like one chunk from your input atlas. So in your case uv of a single window will be a square from 0 to 0.125. After that you can freely move this uv horizontally and vertically randomly for each window with this fixed step (0.125). That's it

Link to comment

Hi thanks, that's how I supposed it worked (I do exactly what you're saying, each of my windows have uvs1 which are a different 0.0125*0.125 chunk) but I got weird result:

if tiling is set to 1,1 and depth is 0, each window is correctly mapped (each quad display a chunk of the atlas using uv1), if I set tiling to 8*8, it scales the uv up and then it maps all the texture (all atlas in all windows). Problem is with the depth, which doesn't work then as I guess it's applied before (or on the 0-1 space), not inside the 0.125 chunck...not sure I'm being clear enough, I'll see if i can illustrate the problem with some pics. 

PS, only interior is using uv1, albedo, normal and shading of the window uses uv0, for more details in that case but it actully doesn't matter, i have same problem with the depth using only uv0 and atlased textures

Edited by romain.janil
Link to comment

ok here are 3 pics showing the problem.

1 first tiling is set to 1 1, each chunk is correctly mapped but flat as depth is 0

intmap_tiling1.thumb.jpg.16496775ae023f7eecaabd41c520d3c3.jpg

2 tilings set to 8*8 depth 0

intmap_tiling8.thumb.jpg.10f2c9fd71273094960568e10527d787.jpg

3 tiling 1*1 depth >0

intmap_tiling1depthsup0.thumb.jpg.e55131b6a7547f6a9cf542d6510cd297.jpg

as you can see the parallax uv deformation is done globally on 0-1 space so it can't work

PS I haven't tested the cubemap node, but  I guess it's the same

Edited by romain.janil
Link to comment

My bad! I think I didn't get you right. Well, I found a solution for your case. I've attached a screenshot. I tried it on 2 by 2 atlas and it works. In this case you must use different uv channels or use vertex color. so uv0 will work for parallax and uv1 is for window identification. As you may guess you need to use more check range and branch nodes if you want your atlas to have more chunks. 
Another way is to use texture arrays which will be available starting from 2.16. with arrays you will be able to have identical uv (0-1) for everything and change the index of array on each window with vertex color values for example. So  the index of array will be different on different windows.

Feel free to ask if you have more questions about it =)
image.png

Link to comment

hi, ok I managed to do that for 4*4 for the moment so it works. 

Thanks!

by the way, texture arrays sound promising !, will it work like UDIM also, (standard indexed offset from 0-1) so it would be possible to index this way too (instead of vertex colors) ? 

Edited by romain.janil
Link to comment

Good to hear!
Well, right now it will be only texture arrays creation in editor. So you will be able to import vertical texture with several square textures inside which are stocked together and then set texture type to array on the import. This texture will be automatically recognized as an array. For now , no UDIMs unfortunately( But we'll definetely consider it!
And I think you will still be able to design your own material graph, which will work as you like. Probably you can try to get index from your uv. So, I believe it will be easier with texture arrays anyway)

Link to comment

Ok, but will it mean that we'll be able to import many square textures with some numbering convention and then define all this as an 1d array column in editor (so it will be possible to define "giga" textures array (ex more than several thousands pixels) that would not fit in regular textures , because  that's what UDIM are actually for but like 2d arrays? Anyway seems always good to have :)

 

Link to comment

Right now we've implemented simple solution - you can only import one texture (which is a vertical combination of few square textures) and convert it to texture array inside editor. Later we plan to make it more advanced

Link to comment
  • silent changed the title to [SOLVED] material graph : interior mapping texture2d.msubgraph
×
×
  • Create New...