Yellow-Dog-Man / Resonite-Issues

Issue repository for Resonite.
https://resonite.com
123 stars 2 forks source link

Add an option to offset the UVs of Static Meshes #2458

Open kitlith opened 2 weeks ago

kitlith commented 2 weeks ago

Is your feature request related to a problem? Please describe.

A user is looking to build a system that allows you to create a bunch of different colored objects, then optimize them down into a single mesh and material. This is largely already possible -- the glue tool has a mesh merging mode, and materials on those meshes are deduplicated when merging. This means that if you have a bunch of meshes that all use the same material orb, you can end up with a single mesh with a single material.

The last thing that's missing for a system like this is a way to move the UVs of each individual mesh, so that that all the objects can be non-overlapping in UV space.

Describe the solution you'd like

There appears to already be a button to scale the UVs of a static mesh. Add a similar button for offsetting UVs. (should ensure that these capabilities are accessible from protoflux, I haven't actually checked if the existing UV scaling is usable from protoflux.)

Alternatively, (does this belong in a separate feature request?) add a new kind of proceedural mesh that allows you to adjust the UV offsets/scale of any existing mesh, allowing you to do "non-destructive" modifications. (I did notice some proceedural meshes that appeared to "wrap" other meshes, but I didn't notice a UV offset option among those.)

Describe alternatives you've considered

Additional Context

This is one of two feature requests inspired by the same usecase and conversation on Discord. The other is an issue that hasn't been created yet.

Requesters

kitlith (Discord/Resonite) dustysprinkles (Discord)

BlueCyro commented 1 week ago

One of the items on my personal to-do is adding UV scale/offset to all procedural meshes. I've already got a little bit done on it, so I'll take this one.

We likely aren't going to add a wrapper just to do UV offsets. The base procedural meshes should all have a unified featureset in the first place.

JackTheFoxOtter commented 1 week ago

Specifically for arbitrary static meshes, once we have the ability to manipulate vertex data in-game directly, you could make tools to modify UV data in any arbitrary way - for example to create the tiling you're after if I understand this issue correctly. So if you haven't already I suggest giving #1233 an upvote.

For the specific use-case of coloring you could also use the vertex colors with that access without any UV manipulation, provided all colors are just tints for the same texture, and the shader you're using actually uses them.

I do think the ability to offset UVs through an operator on the StaticMesh component would still be useful, just wanted to provide another alternative.

kitlith commented 1 week ago

@BlueCyro It's worth noting that I consider this feature (modification of static meshes) separate from(/orthogonal to) making proceedural meshes more consistently having uv scale and offset -- that was the second feature request that I hadn't gotten around to making yet. The wrapper I was seeing less as "for wrapping proceedural meshes" but as "for wrapping primarily static meshes, while letting you tweak scale/offset on the fly before you bake it".

I'll cross the wrapper out, though.

@JackTheFoxOtter I can't check this right now -- do we have the ability to modify the vertex colors of an object in-game? I don't really consider that a full solution, as it precludes the use of variable metallic or emission values (for example), but for the inspiring usecase this might work.

Dusty-Sprinkles commented 1 week ago

@JackTheFoxOtter I can't check this right now -- do we have the ability to modify the vertex colors of an object in-game? I don't really consider that a full solution, as it precludes the use of variable metallic or emission values (for example), but for the inspiring usecase this might work.

I was planning on having the option to use metallics, emissives maybe, but also vertex colors wouldn't work because of the letter beads either

Also wrapper meshes exist already from what I've seen, though modifying the uv of those would probably be harder than modifying the procedural meshes directly and then baking them together assuming the modifications survive baking

(I tested it with a curved plane mesh and it seems to survive baking, so for my specific use case it looks like more meshes having a UV offset slot should be enough)