UV Mapping Rotation

Use this forum for general user support and related questions.
Forum rules
Please upload a testscene that allows developers to reproduce the problem, and attach some images.
User avatar
B.Y.O.B.
Developer
Developer
Posts: 4146
Joined: Mon Dec 04, 2017 10:08 pm
Location: Germany
Contact:

UV Mapping Rotation

Post 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?
User avatar
Dade
Developer
Developer
Posts: 5672
Joined: Mon Dec 04, 2017 8:36 pm
Location: Italy

Re: UV Mapping Rotation

Post 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 ?
Support LuxCoreRender project with salts and bounties
User avatar
Dade
Developer
Developer
Posts: 5672
Joined: Mon Dec 04, 2017 8:36 pm
Location: Italy

Re: UV Mapping Rotation

Post 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 ?
Support LuxCoreRender project with salts and bounties
User avatar
B.Y.O.B.
Developer
Developer
Posts: 4146
Joined: Mon Dec 04, 2017 10:08 pm
Location: Germany
Contact:

Re: UV Mapping Rotation

Post 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.
User avatar
B.Y.O.B.
Developer
Developer
Posts: 4146
Joined: Mon Dec 04, 2017 10:08 pm
Location: Germany
Contact:

Re: UV Mapping Rotation

Post 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?
Attachments
hide_tiling.png
User avatar
Dade
Developer
Developer
Posts: 5672
Joined: Mon Dec 04, 2017 8:36 pm
Location: Italy

Re: UV Mapping Rotation

Post by Dade »

I'm looking into this problem.
Support LuxCoreRender project with salts and bounties
User avatar
Dade
Developer
Developer
Posts: 5672
Joined: Mon Dec 04, 2017 8:36 pm
Location: Italy

Re: UV Mapping Rotation

Post 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).
Support LuxCoreRender project with salts and bounties
User avatar
B.Y.O.B.
Developer
Developer
Posts: 4146
Joined: Mon Dec 04, 2017 10:08 pm
Location: Germany
Contact:

Re: UV Mapping Rotation

Post by B.Y.O.B. »

Thanks! I added support for it to the addon.
User avatar
B.Y.O.B.
Developer
Developer
Posts: 4146
Joined: Mon Dec 04, 2017 10:08 pm
Location: Germany
Contact:

Re: UV Mapping Rotation

Post 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
Luximage
Posts: 165
Joined: Sun Jan 14, 2018 8:01 pm

Re: UV Mapping Rotation

Post by Luximage »

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