Itoo Software Forum

Author Topic: How does rotation by texture really works?  (Read 598 times)

CQ4380

  • Newbie
  • *
  • Posts: 25
How does rotation by texture really works?
« on: October 10, 2016, 10:29:51 PM »
Hey
I'm lost, spend 1.5h trying to understand it but common sense approach failed me. My understanding was that

if I have RG to rotate XY and I use color map RGB>XYZ meaning that

Red 100% would rotate to max, RED 1% would rotate to MIN. So saturation range 1-255 (not 0!)
Green 100% would rotate to max, Green 1% would rotate to MIN. So saturation range 1-255 (not 0!)
Meaning if I want all to stay up. Just make everything gray 125/128. If I want to rotate right I want to be 50+ saturation on RED , if I want to face up I need to add green saturation 50+ if down 50> green. But none of that actually works when I run my tests. So how do we control it ?
Here is example test. I tried controlling it using saturation and luminosity but it don't behave as it should at all !


The attached image has top left 2 boxes 100% red/green. I would expect RED box to face towards right, and green box face towards up.
Right 2 boxes are 100% saturation but 1% illuminosity. They still don't help me I don't understand why red still faces the same direction but green got flipped?
Left lower 2 boxes are 100% luminosity but 1% saturation. So is it a combo ? Saturation + luminosity?
 
Any help in understanding precise rotations would help a lot !



iToo

  • Administrator
  • Hero Member
  • *****
  • Posts: 3156
    • iToo Software
Re: How does rotation by texture really works?
« Reply #1 on: October 11, 2016, 09:26:34 AM »
Hi, what are your Transform values ?

Please note that saturation is applied as a percentage of the range for each axis.
I mean, if you use RGB:128,0,0 and want to rotate 0º on X, Transform range for X should be -180º to 180º, so 128 is exactly 0 degrees (50% of 255).

Carlos Quintero
iToo Software

CQ4380

  • Newbie
  • *
  • Posts: 25
Re: How does rotation by texture really works?
« Reply #2 on: October 11, 2016, 09:48:04 AM »
Hi, what are your Transform values ?

Please note that saturation is applied as a percentage of the range for each axis.
I mean, if you use RGB:128,0,0 and want to rotate 0º on X, Transform range for X should be -180º to 180º, so 128 is exactly 0 degrees (50% of 255).

Hey

"Hi, what are your Transform values ?"
Is it not shown above on the screenshot ?

-90 and + 90. My understanding was that 1-0-0 would produce -90 effect and 255-0-0 would produce +90 effect but that does not happen nat all.
« Last Edit: October 11, 2016, 10:30:56 AM by CQ4380 »

iToo

  • Administrator
  • Hero Member
  • *****
  • Posts: 3156
    • iToo Software
Re: How does rotation by texture really works?
« Reply #3 on: October 11, 2016, 11:08:57 AM »
Quote
"Hi, what are your Transform values ?"
Is it not shown above on the screenshot ?

Sorry, my fault ! For some reason the image shown clipped on my screen. I restarted the browser and now is correct.

First of all, Rotation axis may be a bit different from common sense: X means that items are rotated along the X axis (which goes from left to right on screen), so really they move upward/downward. In same way, Green (Y axis) rotate them from left to right.

Regarding colors, with your range settings (-90º to 90º, both for X and Y), pure Red has RGB:255,0,0. So, Green component is 0 which means -90º on Y. For that reason your items are facing to left with red and black colors.

Best way to understand how it works, is testing combinations interactively with a Color selector. You can use the attached scene for that.
You can see what RGB values are generated when changing Hue/Sat/Value.

I hope that helps. Please don't hesistate to ask is something is not clear.

Carlos Quintero
iToo Software

CQ4380

  • Newbie
  • *
  • Posts: 25
Re: How does rotation by texture really works?
« Reply #4 on: October 11, 2016, 11:23:46 AM »
Hey

I did more tests and I ended up rendering sphere using global world normal map as output and use that for directions of rotations.

But that does not explain the way they work really.

If I have 100% Red on X axis (now after re-checking) then the instances should face UP - not side left/right, so if I want instances to face down, what color should I use ? I though that min/max rotation would be mapped to RED value and depending on either saturation or lightness that would translate to rotation in scene.

RED = 1 = -90
RED = 255 = +90
But that don't happen at all.

From your screen we have red only value and the only change is luminosity from what I can tell. So it must be mapped to saturation - or at least that is what I was expecting. But in reality no matter what saturation I put in I can't flip them to face the other direction. Not to mention weird stuff happens where RED channels is affecting Green rotation coordinates...

Regards
Dariusz

iToo

  • Administrator
  • Hero Member
  • *****
  • Posts: 3156
    • iToo Software
Re: How does rotation by texture really works?
« Reply #5 on: October 11, 2016, 12:34:14 PM »
Quote
If I have 100% Red on X axis (now after re-checking) then the instances should face UP - not side left/right, so if I want instances to face down, what color should I use ? I though that min/max rotation would be mapped to RED value and depending on either saturation or lightness that would translate to rotation in scene.

Well, in this case instances face left/right because Y map rotation is enabled in Transform rollout (with same range -90º/90º). Forest takes the green component or RGB color to determine rotation on Y.
When using pure Red (RGB:255,0,0), Green component is 0 which means use -90º for Y rotation... so items face to left side.

With this configuration, if you want that items face up, color should be RGB:128,128,0 (shown as yellow i guess).
To face them down, first it's necessary to change the range beyond 90º (as -180º/180º or 0º/360º) and use the appropiate RGB values.

Quote
From your screen we have red only value and the only change is luminosity from what I can tell. So it must be mapped to saturation - or at least that is what I was expecting. But in reality no matter what saturation I put in I can't flip them to face the other direction. Not to mention weird stuff happens where RED channels is affecting Green rotation coordinates...

I used only red in the test scene, but you can test other combinations adding green component. If you change HSL, see what is the correspondence to RGB (shown in the color selector), to understand what values are used internally.

Carlos Quintero
iToo Software

CQ4380

  • Newbie
  • *
  • Posts: 25
Re: How does rotation by texture really works?
« Reply #6 on: October 12, 2016, 12:14:24 AM »
Hey

Humh I see, I think I got it now. Right will give it a go a bit more later on. For now I'm using the image attached below as my sample test pattern. Depending on orientation of scene that texture can be used to direct grass to face specific direction.

CQ4380

  • Newbie
  • *
  • Posts: 25
Re: How does rotation by texture really works?
« Reply #7 on: October 12, 2016, 02:46:55 PM »
Hey

Here is some update on the vertex paint. It is quite painful at the moment as painting over 30x60m land with 100k vertexes is quite slow. I will try canvas paint next hopefully that would provide a good feedback and quick updates but we will see...

However given the difficulty of precise control I think it is a good option to tweak grass looks. Being able to flatten grass in certain area or direct it in other area allow us for more natural reproduction of grass-based environments.

I'm also posting in 2 other topics about possible solutions for a tool to precise control the grass...

Paul Roberts

  • iToo Software
  • Hero Member
  • *****
  • Posts: 1551
Re: How does rotation by texture really works?
« Reply #8 on: October 12, 2016, 04:49:17 PM »
Thanks for the feedback. We'll certainly look into this.

Kind regards,

Paul
Paul Roberts
iToo Software

CQ4380

  • Newbie
  • *
  • Posts: 25
Re: How does rotation by texture really works?
« Reply #9 on: October 12, 2016, 05:59:25 PM »
Thanks for the feedback. We'll certainly look into this.

Kind regards,

Paul

Thanks. Will definitely help a lot to have a good set of tools for grass modelling. I tried using canvas paint, and as cool as it is with all the brush masks/scattering and variants - really cool. Sadly the fact that I have to save&update&see change makes it equally frustrating as if I were to use 100000k vertex paint based mesh... and that is only 60x30meters size grid. Where as normally a house can go up to a 100x100 + but then anything above 100 won't need the precise modelling.  So yeah, please do look in to it...

Regards
Dariusz