Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add UV Multiset (tiles) #584

Merged
merged 7 commits into from
Oct 27, 2024
Merged

Conversation

Micheus
Copy link
Collaborator

@Micheus Micheus commented Sep 19, 2024

This branch add the option to work with multiples UV tiles in the AutoUV Editor window that is something useful when having complex meshes and when we need to use different texture densities for the object.

The Create Texture option will act over the selected tile and we choose the tile by holding the ALT key while clicking on the desired tile that contains any UV islands.

The Alignment, Scale Max and similar commands applied to the islands should be respecting the tile in which it is placed.

It's possible to disable the _Texture Set _mode by toggling this option off. In case we come back to activate it the materials may be reused. (that is a way to restart the texture set mode in case we decide to change the tile's arrangement).

The workflow should be like this:

  • unwrap the mesh;
  • arrange them on the tiles (remember we will have five columns by five rows available);
  • when the amount of tiles are set, without any selection, toggle the "Texture Set Mode" by checking it on the menu option. A new submenu will be shown in which we should to choose the naming standard to be used;

There are three standards/patterns for UV Tiling, as far as I found and I included the Wings3D default suffix too (ref. Autodesk Maya doc).

Regards to the UDIM naming, although the tiles IDs are computed for the standard 10 columns, I'm going to show a grid for 5x5 tiles which seems more comfortable and easy to use in Wings3D.

AutoUV-Textureset-naming
AutoUV-Textureset

NOTE: Added the option to work with multiples UV tiles in the AutoUV Editor window.

@dgud
Copy link
Owner

dgud commented Oct 8, 2024

Can you remove amf plugin code here, that is already merged to master?

Hmm we need a copy of the toolbar in the autouv window why isn't that there?
Now I missed how to select a tile, until I read the instructions in the PR.

It would be nice if the tiles where centered. Now they are (I'm guessing) starting at (0.0) in opengl space,
either add a translation matrix when drawing or change the layout around (0,0).

Otherwise I like it.

@Micheus
Copy link
Collaborator Author

Micheus commented Oct 8, 2024

Can you remove amf plugin code here, that is already merged to master?

Sure. I didn't noticed I started it from another branch than master.

Hmm we need a copy of the toolbar in the autouv window why isn't that there?
Now I missed how to select a tile, until I read the instructions in the PR.

Maybe use an Information line on screen as made for Tweak/Sculpt tools?
The Information about that is shown on the Information line in main screen, but I also thought it's not so intuitive - beside, many users - unfortunately - don't pay attention to it.

It would be nice if the tiles where centered. Now they are (I'm guessing) starting at (0.0) in opengl space,
either add a translation matrix when drawing or change the layout around (0,0).

Yes, I tried to keep it simple by just handle different coordinates and avoiding to change the original code too much.
Also, what would be the advantage of that approach?

@Micheus Micheus force-pushed the mv/autouv-add-uv-multiset branch from 795190e to 6438dae Compare October 8, 2024 16:25
@dgud
Copy link
Owner

dgud commented Oct 9, 2024

Yes, I tried to keep it simple by just handle different coordinates and avoiding to change the original code too much.
Also, what would be the advantage of that approach?

It looks bad when only a quarter (upper right) of the window is used in default mode or when reseting camera, when using tiled mode.

@Micheus
Copy link
Collaborator Author

Micheus commented Oct 9, 2024

It looks bad when only a quarter (upper right) of the window is used in default mode or when reseting camera, when using tiled mode.

Resetting camera [R] doesn't work in AutoUV - it's applied to the main Geometry window instead (which can be annoying if we hit [R]).
When I want to reset or center the islands I use the frame/aim shortcut: [SHIFT+A] or [A].
It has been this way ever - checked in 1.5.4. Should we enable that?

I think, if we just remap camera reset to frame existing islands (or tile owning them) it will look good enough to work.

@dgud
Copy link
Owner

dgud commented Oct 9, 2024

[A] without anything selected was what I used (was built in my finger memory).

But yes reset camera [R] would be good if it worked.

You should be able set a different viewing matrix right, this is just drawing code that need to set up the view matrix correctly.

@dgud
Copy link
Owner

dgud commented Oct 12, 2024

Hmm, now ALT-[L] doesn't set the active tile, or at least doesn't redraw that.

plugins_src/autouv/auv_texture.erl Show resolved Hide resolved
plugins_src/autouv/auv_texture.erl Outdated Show resolved Hide resolved
plugins_src/autouv/wpc_autouv.erl Outdated Show resolved Hide resolved
plugins_src/autouv/wpc_autouv.erl Outdated Show resolved Hide resolved
plugins_src/autouv/wpc_autouv.erl Outdated Show resolved Hide resolved
plugins_src/autouv/wpc_autouv.erl Outdated Show resolved Hide resolved
plugins_src/autouv/wpc_autouv.erl Show resolved Hide resolved
if (TxSetMode) ->
Bin = << <<V:?F32,(?TILE_ROWS*1.0):?F32, V:?F32,0.0:?F32, (?TILE_ROWS*1.0):?F32,V:?F32, 0.0:?F32,V:?F32>>
|| V <- lists:seq(0,?TILE_ROWS) >>;
true ->
Bin = << <<V:?F32,20.0:?F32, V:?F32,-20.0:?F32, 20.0:?F32,V:?F32, -20.0:?F32,V:?F32>>
|| V <- lists:seq(-20,20) >>
end,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indentation

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dan, what is wrong with this indentation?
In the source I've been using spaces (no tab) and it looks OK for me even in the git viewer:
image

@dgud
Copy link
Owner

dgud commented Oct 12, 2024

Remapping Uvmapping- [R] click- from geom window creates a confused state of texture state or not.

@Micheus
Copy link
Collaborator Author

Micheus commented Oct 14, 2024

Hmm, now ALT-[L] doesn't set the active tile, or at least doesn't redraw that.

I used the same approach as for Tweak menu which the information line shows -> [Alt]+R: Tweak Menu
So, then I wrote -> [ALT]+L, I've meant ALT key plus Left mouse button.

@dgud
Copy link
Owner

dgud commented Oct 14, 2024

Yes I understand that, it doesn't work anymore for me after your last commit.

@Micheus
Copy link
Collaborator Author

Micheus commented Oct 14, 2024

Yes I understand that, it doesn't work anymore for me after your last commit.

Perhaps you are attempting to activate a tile without a mesh (island) on it. Could that be the issue?

@dgud
Copy link
Owner

dgud commented Oct 14, 2024

The darkblue border was always on tile 1 or (0,0}.

@dgud
Copy link
Owner

dgud commented Oct 14, 2024

Hmm today it works..

@dgud
Copy link
Owner

dgud commented Oct 14, 2024

No idea why it didn't work yesterday, or what I did..

@Micheus Micheus force-pushed the mv/autouv-add-uv-multiset branch 2 times, most recently from a262e3a to b7adc92 Compare October 15, 2024 21:51
  The option is available in Body selection mode by toggling the
  "Texture Set Mode" which will ask for the standard naming to be used (Wings3D,
  Zbrush, Mudbox or Mari). After that the editor layout will switch to a set of
  25 tiles (5x5).
  The "Create Texture" option will be active over the selected tile which can
  be selected by holding the ALT key while clicking on the desired tile.
  The align operations were adjusted to act over the islands on their tiles.
…amount;

- Supressed an extra call to wings_wm:this() in create_uv_state/5;
- The textureset mode needs to be stored by window otherwise we get wrong
  background drawing for a second AutoUV window with a single texture;
- Added option to handle the Reset camera command;
- Forced the camera to start in reset position when AutoUV window is displayed
  allowing us to see the entire texture or textureset;
@dgud
Copy link
Owner

dgud commented Oct 16, 2024

I pushed some indentation fixes.

But I also got this when testing an old model that was already textured.

I get this when switching to texture_set mode:

[{e3d_vec,average,[[]],[{file,"e3d_vec.erl"},{line,233}]},
{wpc_autouv,'-build_texture_set/4-fun-1-',4,
[{file,"wpc_autouv.erl"},{line,339}]},
{lists,foldl,3,[{file,"lists.erl"},{line,2146}]},
{wpc_autouv,build_texture_set,4,[{file,"wpc_autouv.erl"},{line,337}]},
{wpc_autouv,handle_command_1,2,[{file,"wpc_autouv.erl"},{line,1346}]},
{wpc_autouv,handle_command,2,[{file,"wpc_autouv.erl"},{line,1153}]},
{wings_wm,handle_event,3,[{file,"wings_wm.erl"},{line,1037}]},
{wings_wm,send_event,2,[{file,"wings_wm.erl"},{line,1004}]},
{wings_wm,do_dispatch,2,[{file,"wings_wm.erl"},{line,900}]},
{wings_wm,dispatch_event,1,[{file,"wings_wm.erl"},{line,809}]},
{wings_wm,get_and_dispatch,0,[{file,"wings_wm.erl"},{line,692}]},
{wings,init_part2,4,[{file,[...]},{line,...}]},
{proc_lib,init_p_do_apply,3,[{file,...},{...}]}]

@Micheus
Copy link
Collaborator Author

Micheus commented Oct 17, 2024

But I also got this when testing an old model that was already textured.

How old is that? I used UV mapped models from 2016 and 2019 and it was all OK.
Can you share it?

@dgud dgud merged commit f595350 into dgud:master Oct 27, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants