Chaos Corona Forum

Chaos Corona for 3ds Max => [Max] I need help! => Topic started by: Jpjapers on 2021-09-14, 11:23:31

Title: Any way to randomise gamma within texture tiling?
Post by: Jpjapers on 2021-09-14, 11:23:31
I want to add a bit pf patchy variation across a fabric surface to simulate panels stitched together. Im looking for a way either with corona or some OSL shaders that would let me randomise the gamma of a single tiling bitmap so every time it tiles its slightly different. Has anyone got any ideas on how this might be achieved?
Title: Re: Any way to randomise gamma within texture tiling?
Post by: aaouviz on 2021-09-14, 11:38:10
I wouldn't over-complicate it with gamma?

That being said: Some combination of MultiMap plugged into the UVW?

Or do a floor-gen on the object (so long as it's a flat surface, probably isn't?) and do a multimap onto that?
Title: Re: Any way to randomise gamma within texture tiling?
Post by: Jpjapers on 2021-09-15, 13:41:30
I wouldn't over-complicate it with gamma?

That being said: Some combination of MultiMap plugged into the UVW?

Or do a floor-gen on the object (so long as it's a flat surface, probably isn't?) and do a multimap onto that?

Its swagged fabric for large canvas tents like circus tents so im trying to get it to look slightly patchy so floorgen just wouldnt work.
I cant see a way that multimap would be able to provide randomisation to normal tiling as there isnt a mode for it which is why i wonder about the OSL route but i have no idea how much of OSL corona supports.
Title: Re: Any way to randomise gamma within texture tiling?
Post by: Avi on 2021-09-17, 19:58:59
Is it possible for you to attach a scene file or a reference Image showcasing what exactly you are trying to achieve?

Looking forward to it.

Regards,
Avi
Title: Re: Any way to randomise gamma within texture tiling?
Post by: maru on 2021-09-19, 15:38:18
Multimap has gamma randomization which you can use even with a single item.
If you are using the UVW Randomizer for the tiling randomization, you can plug this UVW Randomizer into Multimap, enable the gamma variation, profit!
Title: Re: Any way to randomise gamma within texture tiling?
Post by: PROH on 2021-09-19, 17:16:26
@Maru - This will only work on instances, primitives or mesh elements. NOT on a surface.

I believe OP is asking for a slight color-variance on every repeated bitmap/tile, based on the map-size/UV-size rather than geometry. Would be usefull to give more natural variation on f.ex. grass, dirt and fabric.

I think there is an OSL map dooing this - but I'm not sure.

Regards
Title: Re: Any way to randomise gamma within texture tiling?
Post by: Frood on 2021-09-20, 09:07:32
Would be cool if there would be a simple OSL solution. Currently I would still do that kind of variation (and more) using BerconTile + MultiMap.


Good Luck



Title: Re: Any way to randomise gamma within texture tiling?
Post by: pokoy on 2021-09-20, 10:04:47
While it's probably doable with OSL - not sure if any map shipping with Max currently can do this - a Per-Tile mode, where each tile gets handled differently would be a neat addition to the MultiMap. It could be used to add some variance in any regularly tiling map like fabric, grids etc with ease.
Title: Re: Any way to randomise gamma within texture tiling?
Post by: romullus on 2021-09-20, 11:08:51
Maybe you should apply KISS principle here? You can randomize everything that way, gamma, hue, saturation, etc. Imagination is the limit :]
Title: Re: Any way to randomise gamma within texture tiling?
Post by: PROH on 2021-09-20, 11:18:45
Hi romullus. Looks great. How is this set up?
Title: Re: Any way to randomise gamma within texture tiling?
Post by: pokoy on 2021-09-20, 11:43:50
Yeah, thought about this as well, but you need the bitmap to be bigger than what you'll show because this one will tile as well. Might work depending on the case, but it's probably really easy to setup.
Title: Re: Any way to randomise gamma within texture tiling?
Post by: PROH on 2021-09-20, 11:58:54
Okay - figured it out. But this will not work with the UVW-Randomnizer on top.

Personally I would love a solution where one could patch and randomnize sveral different bitmaps on one surface.

Regards
Title: Re: Any way to randomise gamma within texture tiling?
Post by: romullus on 2021-09-20, 12:05:09
How is this set up?

There's nothing to it, really. Bitmap is tiled 10 times, so to match this i set tiles count to 10 by 10 (note that tiling in coordinates rollout needs to be left at default in order to get proper randomisation), then it's up to you how you want it to mix it with bitmap, in this case i used Corona mix in softlight blend mode, but you can use native mix, composite, or even RGB multiply, mask and any combination of them.

Yeah, thought about this as well, but you need the bitmap to be bigger than what you'll show because this one will tile as well. Might work depending on the case, but it's probably really easy to setup.

The bitmap is tiling the same number of times as the tiles map in this case, but it's not crucial, since the bitmap is seamless so you don't have to match their tiling. One can be tiled 5 times and the other 7 times and you won't notice anything strange.
Title: Re: Any way to randomise gamma within texture tiling?
Post by: romullus on 2021-09-20, 12:08:36
Okay - figured it out. But this will not work with the UVW-Randomnizer on top.

Personally I would love a solution where one could patch and randomnize sveral different bitmaps on one surface.

Regards

Why would you need UVW randomizer in this example? You can't randomize transformation of fabric texture and get sensible result anyway.
Title: Re: Any way to randomise gamma within texture tiling?
Post by: PROH on 2021-09-20, 13:12:14
no, I don't need it in this example. But with other things like f.ex. ground materials that would be neet :)
Title: Re: Any way to randomise gamma within texture tiling?
Post by: romullus on 2021-09-20, 14:03:53
But why would you want straight square random gamma/hue patches on ground material? Doesn't sound very realistic to me :] Wouldn't it be better to apply same principle like above, just replace tiles map with noise, or some grunge texture? I'm struggle to think about scenario where random texture transformation would also require HSL randomisation per tile, but even if there are such, they probably are highly specific and wouldn't justify cluttering already crowded UI of UVWRandomization texmap.
Title: Re: Any way to randomise gamma within texture tiling?
Post by: PROH on 2021-09-20, 19:23:41
No, you are right. Square random gamma/hue patches on ground material doesn't make much sence. Unless we get a way to add noise to the randomization edges - like the OSL randomization-map.

Regards
Title: Re: Any way to randomise gamma within texture tiling?
Post by: pokoy on 2021-09-20, 19:48:21
But why would you want straight square random gamma/hue patches on ground material? Doesn't sound very realistic to me :] Wouldn't it be better to apply same principle like above, just replace tiles map with noise, or some grunge texture? I'm struggle to think about scenario where random texture transformation would also require HSL randomisation per tile, but even if there are such, they probably are highly specific and wouldn't justify cluttering already crowded UI of UVWRandomization texmap.

Let's say you have a regular pattern for displacement, something that tiles of course, a grid for example, and you need to introduce some irregularities. I'd use that tiled map and compose a noise map over it, using a circular mask which blends to black on its borders so the noise isn't visible on tile borders. The multimap  would introduce different brightness/gamma to that circular map so each grid tile center would get variable contribution from the noise.

Maybe you remember the disco tile map from cebas, it was part of finalrender a long time ago. I had one job where I needed exactly this map. This mode would allow easy creation without workarounds. Of course, it was doable in other ways but not as easily.

I don't want to clutter the thread with my own thoughts but I happen to think that a way to randomize map properties without randomizing UVs might indeed be useful.
Title: Re: Any way to randomise gamma within texture tiling?
Post by: romullus on 2021-09-21, 09:56:10
You don't clutter the thread at all. If there's a need to improve funcionality of Corona tools, then users discussions is one of the way to make developers notice that.
Title: Re: Any way to randomise gamma within texture tiling?
Post by: GeorgeK on 2021-09-21, 11:27:49
Hi everyone I believe we have something similar logged that should cover this as well.

(Report ID=CRMAX-734)
Title: Re: Any way to randomise gamma within texture tiling?
Post by: Jpjapers on 2021-09-22, 09:41:12
Romulus your method would work great if I hadn't set everything up with real world uvs haha. But im glad there's interest in this!
Title: Re: Any way to randomise gamma within texture tiling?
Post by: romullus on 2021-09-22, 10:37:03
Real world scale is not an obstacle, because it's just a scale, it doesn't change anything. You just need to multiply tiles count by your fabric texture RW size and you will get exactly the same result. If your fabric has 50 by 50 cm RW size and you want 10 unique patches, you just need to set tiles to 500 by 500 cm RW size.
Title: Re: Any way to randomise gamma within texture tiling?
Post by: Jpjapers on 2021-09-22, 11:02:45
Ah very good point!
Title: Re: Any way to randomise gamma within texture tiling?
Post by: maru on 2021-09-27, 16:31:58
This is a surprisingly hard task! :)
One thing I can think of is making the texture tiles dependent on the geometry faces. So for example if the fabric is supposed to be 10x10 tiles, the object would be a plane with 10x10 faces. Then you could use things like 3ds Max MaterialByElement modifier with Multimap's randomization by Material ID. Or the V8 randomization by polygon.
But if the fabric's geometry is independent from the texture tiling, it really gets tricky.

What I imagine here would be some kind of UVW Randomizer merged with Multimap node. Or Multimap randomization mode "By UVW Randomizer tiles". :)
I'll log it as a general feature request with a simple example and we will see what can be done about it. 

(Report ID=CRMAX-1006)
Title: Re: Any way to randomise gamma within texture tiling?
Post by: romullus on 2021-09-27, 19:08:31
I would love to see this evolving in to Corona Tiles ;]