UV Mapping Rotation

Use this forum for general user support and related questions.
User avatar
B.Y.O.B.
Developer
Posts: 1112
Joined: Mon Dec 04, 2017 10:08 pm
Location: Germany
Contact:

UV Mapping Rotation

Post by B.Y.O.B. » Sun Feb 11, 2018 3:33 pm

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?
Support LuxCoreRender project with salts and bounties

User avatar
Dade
Developer
Posts: 1089
Joined: Mon Dec 04, 2017 8:36 pm

Re: UV Mapping Rotation

Post by Dade » Sun Feb 11, 2018 4:25 pm

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 ?
Support LuxCoreRender project with salts and bounties

User avatar
Dade
Developer
Posts: 1089
Joined: Mon Dec 04, 2017 8:36 pm

Re: UV Mapping Rotation

Post by Dade » Sun Feb 11, 2018 4:27 pm

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 ?
Support LuxCoreRender project with salts and bounties

User avatar
B.Y.O.B.
Developer
Posts: 1112
Joined: Mon Dec 04, 2017 10:08 pm
Location: Germany
Contact:

Re: UV Mapping Rotation

Post by B.Y.O.B. » Sun Feb 11, 2018 4:39 pm

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.
Support LuxCoreRender project with salts and bounties

User avatar
B.Y.O.B.
Developer
Posts: 1112
Joined: Mon Dec 04, 2017 10:08 pm
Location: Germany
Contact:

Re: UV Mapping Rotation

Post by B.Y.O.B. » Sun Feb 18, 2018 7:47 pm

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?
Attachments
hide_tiling.png
Support LuxCoreRender project with salts and bounties

User avatar
Dade
Developer
Posts: 1089
Joined: Mon Dec 04, 2017 8:36 pm

Re: UV Mapping Rotation

Post by Dade » Sun Feb 18, 2018 8:41 pm

I'm looking into this problem.
Support LuxCoreRender project with salts and bounties

User avatar
Dade
Developer
Posts: 1089
Joined: Mon Dec 04, 2017 8:36 pm

Re: UV Mapping Rotation

Post by Dade » Mon Feb 19, 2018 1:39 pm

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).
Support LuxCoreRender project with salts and bounties

User avatar
B.Y.O.B.
Developer
Posts: 1112
Joined: Mon Dec 04, 2017 10:08 pm
Location: Germany
Contact:

Re: UV Mapping Rotation

Post by B.Y.O.B. » Mon Feb 19, 2018 5:59 pm

Thanks! I added support for it to the addon.
Support LuxCoreRender project with salts and bounties

User avatar
B.Y.O.B.
Developer
Posts: 1112
Joined: Mon Dec 04, 2017 10:08 pm
Location: Germany
Contact:

Re: UV Mapping Rotation

Post by B.Y.O.B. » Tue Feb 20, 2018 8:01 pm

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
Support LuxCoreRender project with salts and bounties

Luximage
Posts: 26
Joined: Sun Jan 14, 2018 8:01 pm

Re: UV Mapping Rotation

Post by Luximage » Wed Feb 21, 2018 10:22 am

Nice result B.Y.O.B., it seems you broke the repetition of the texture.

Post Reply