Page 1 of 2

UV Mapping Rotation

Posted: Sun Feb 11, 2018 3:33 pm
by B.Y.O.B.
Hi,

is there a reason why there's no "rotation" option for 2D mappings?
We can only scale and translate it.

Can this feature be added?

Re: UV Mapping Rotation

Posted: Sun Feb 11, 2018 4:25 pm
by Dade
B.Y.O.B. wrote: Sun Feb 11, 2018 3:33 pm is there a reason why there's no "rotation" option for 2D mappings?
We can only scale and translate it.
It is faster: it requires a 2x(Mul+Sum) instead of a multiplication per a 3x3 matrix. Anyway, it was implemented like this because it was the way old Lux was working as far as I remember.
B.Y.O.B. wrote: Sun Feb 11, 2018 3:33 pm Can this feature be added?
Yes, it could be an additional kind of mapping or replacement for the current 2D mapping. Is it needed ?

Re: UV Mapping Rotation

Posted: Sun Feb 11, 2018 4:27 pm
by Dade
Dade wrote: Sun Feb 11, 2018 4:25 pm
B.Y.O.B. wrote: Sun Feb 11, 2018 3:33 pm Can this feature be added?
Yes, it could be an additional kind of mapping or replacement for the current 2D mapping. Is it needed ?
Uh, isn't uvmapping3d what are you looking for ?

Re: UV Mapping Rotation

Posted: Sun Feb 11, 2018 4:39 pm
by B.Y.O.B.
Dade wrote: Sun Feb 11, 2018 4:27 pm Uh, isn't uvmapping3d what are you looking for ?
Maybe. I forgot it existed.
I'll test it.

Re: UV Mapping Rotation

Posted: Sun Feb 18, 2018 7:47 pm
by B.Y.O.B.
I tried to use uvmapping3d on an imagemap, but I get this error:

Code: Select all

RuntimeError: Unknown 2D texture coordinate mapping type: uvmapping3d
I guess I can only use it for 3D textures?

What I need is the option to rotate an imagemap.
It is used if you want to cover up the tiling of an image texture, see attached material setup.
It's a bit like this: http://www.neilblevins.com/cg_education ... _trick.htm

Maybe this feature could be added in a new type of mapping (a copy of uvmapping2d with rotation support) to avoid a performance hit for un-rotated uvmapping2d?

Re: UV Mapping Rotation

Posted: Sun Feb 18, 2018 8:41 pm
by Dade
I'm looking into this problem.

Re: UV Mapping Rotation

Posted: Mon Feb 19, 2018 1:39 pm
by Dade
Dade wrote: Sun Feb 18, 2018 8:41 pm I'm looking into this problem.
I added the support for ".rotation" to uvmapping2d:

Code: Select all

scene.textures.checktex.type = checkerboard2d
scene.textures.checktex.texture1 = 1.0
scene.textures.checktex.texture2 = 0.0
scene.textures.checktex.mapping.uvscale =  5 5
scene.textures.checktex.mapping.rotation = 45
Note: the order of uvmapping2d transformation is scale than rotate than translate (before was scale than translate).

Re: UV Mapping Rotation

Posted: Mon Feb 19, 2018 5:59 pm
by B.Y.O.B.
Thanks! I added support for it to the addon.

Re: UV Mapping Rotation

Posted: Tue Feb 20, 2018 8:01 pm
by B.Y.O.B.
Finally had time to try it in a scene I'm working on.

without_scrambling.jpg
with_scrambling.jpg
with_scrambling_uvs.jpg
setup.PNG

Re: UV Mapping Rotation

Posted: Wed Feb 21, 2018 10:22 am
by Luximage
Nice result B.Y.O.B., it seems you broke the repetition of the texture.