Author Topic: Any way to randomise gamma within texture tiling?  (Read 4268 times)

2021-09-14, 11:23:31

Jpjapers

  • Active Users
  • **
  • Posts: 1650
    • View Profile
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?

2021-09-14, 11:38:10
Reply #1

aaouviz

  • Active Users
  • **
  • Posts: 892
    • View Profile
    • Another Angle 3D
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?
Nicolas Pratt
Another Angle 3D
https://www.instagram.com/anotherangle3d/

2021-09-15, 13:41:30
Reply #2

Jpjapers

  • Active Users
  • **
  • Posts: 1650
    • View Profile
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.

2021-09-17, 19:58:59
Reply #3

Avi

  • Corona Team
  • Active Users
  • ****
  • Posts: 505
    • View Profile
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
Arpit Pandey | chaos-corona.com
3D Support Specialist - Corona | contact us

2021-09-19, 15:38:18
Reply #4

maru

  • Corona Team
  • Active Users
  • ****
  • Posts: 12741
  • Marcin
    • View Profile
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!
Marcin Miodek | chaos-corona.com
3D Support Team Lead - Corona | contact us

2021-09-19, 17:16:26
Reply #5

PROH

  • Active Users
  • **
  • Posts: 1219
    • View Profile
@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

2021-09-20, 09:07:32
Reply #6

Frood

  • Active Users
  • **
  • Posts: 1919
    • View Profile
    • Rakete GmbH
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



Never underestimate the power of a well placed level one spell.

2021-09-20, 10:04:47
Reply #7

pokoy

  • Active Users
  • **
  • Posts: 1861
    • View Profile
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.

2021-09-20, 11:08:51
Reply #8

romullus

  • Global Moderator
  • Active Users
  • ****
  • Posts: 8829
  • Let's move this topic, shall we?
    • View Profile
    • My Models
Maybe you should apply KISS principle here? You can randomize everything that way, gamma, hue, saturation, etc. Imagination is the limit :]
I'm not Corona Team member. Everything i say, is my personal opinion only.
My Models | My Videos | My Pictures

2021-09-20, 11:18:45
Reply #9

PROH

  • Active Users
  • **
  • Posts: 1219
    • View Profile
Hi romullus. Looks great. How is this set up?

2021-09-20, 11:43:50
Reply #10

pokoy

  • Active Users
  • **
  • Posts: 1861
    • View Profile
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.

2021-09-20, 11:58:54
Reply #11

PROH

  • Active Users
  • **
  • Posts: 1219
    • View Profile
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

2021-09-20, 12:05:09
Reply #12

romullus

  • Global Moderator
  • Active Users
  • ****
  • Posts: 8829
  • Let's move this topic, shall we?
    • View Profile
    • My Models
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.
I'm not Corona Team member. Everything i say, is my personal opinion only.
My Models | My Videos | My Pictures

2021-09-20, 12:08:36
Reply #13

romullus

  • Global Moderator
  • Active Users
  • ****
  • Posts: 8829
  • Let's move this topic, shall we?
    • View Profile
    • My Models
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.
I'm not Corona Team member. Everything i say, is my personal opinion only.
My Models | My Videos | My Pictures

2021-09-20, 13:12:14
Reply #14

PROH

  • Active Users
  • **
  • Posts: 1219
    • View Profile
no, I don't need it in this example. But with other things like f.ex. ground materials that would be neet :)

2021-09-20, 14:03:53
Reply #15

romullus

  • Global Moderator
  • Active Users
  • ****
  • Posts: 8829
  • Let's move this topic, shall we?
    • View Profile
    • My Models
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.
I'm not Corona Team member. Everything i say, is my personal opinion only.
My Models | My Videos | My Pictures

2021-09-20, 19:23:41
Reply #16

PROH

  • Active Users
  • **
  • Posts: 1219
    • View Profile
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

2021-09-20, 19:48:21
Reply #17

pokoy

  • Active Users
  • **
  • Posts: 1861
    • View Profile
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.

2021-09-21, 09:56:10
Reply #18

romullus

  • Global Moderator
  • Active Users
  • ****
  • Posts: 8829
  • Let's move this topic, shall we?
    • View Profile
    • My Models
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.
I'm not Corona Team member. Everything i say, is my personal opinion only.
My Models | My Videos | My Pictures

2021-09-21, 11:27:49
Reply #19

GeorgeK

  • Corona Team
  • Active Users
  • ****
  • Posts: 838
  • George
    • View Profile
Hi everyone I believe we have something similar logged that should cover this as well.

(Report ID=CRMAX-734)
George Karampelas | chaos-corona.com
Chaos Corona QA Specialist | contact us

2021-09-22, 09:41:12
Reply #20

Jpjapers

  • Active Users
  • **
  • Posts: 1650
    • View Profile
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!

2021-09-22, 10:37:03
Reply #21

romullus

  • Global Moderator
  • Active Users
  • ****
  • Posts: 8829
  • Let's move this topic, shall we?
    • View Profile
    • My Models
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.
« Last Edit: 2021-09-22, 10:40:47 by romullus »
I'm not Corona Team member. Everything i say, is my personal opinion only.
My Models | My Videos | My Pictures

2021-09-22, 11:02:45
Reply #22

Jpjapers

  • Active Users
  • **
  • Posts: 1650
    • View Profile

2021-09-27, 16:31:58
Reply #23

maru

  • Corona Team
  • Active Users
  • ****
  • Posts: 12741
  • Marcin
    • View Profile
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)
« Last Edit: 2021-09-27, 16:54:22 by maru »
Marcin Miodek | chaos-corona.com
3D Support Team Lead - Corona | contact us

2021-09-27, 19:08:31
Reply #24

romullus

  • Global Moderator
  • Active Users
  • ****
  • Posts: 8829
  • Let's move this topic, shall we?
    • View Profile
    • My Models
I would love to see this evolving in to Corona Tiles ;]
I'm not Corona Team member. Everything i say, is my personal opinion only.
My Models | My Videos | My Pictures