1
$\begingroup$

I have an UV (f.e. projected from view) and an image, and I want to rip the image and destructure UV to pack texture more effitiently. Can I somehow auto-generate a new image and UV that uses 100% of texture space (removing unused parts)? Or is it unnesessary since I export mesh into glTF? (don't know how exactly texture is stored in that format tho)

upd:

enter image description here

that's my uv, and i wondering how can i easily remove "unused pixels" from my texture, f.e. auto-stretch uv (and pixels below) into 256x256 rect. i want to use maximum area of texture, but don't want to modify uv mannualy.

$\endgroup$
2
  • $\begingroup$ I'm not sure to understand correctly what you want to do here. Maybe you could elaborate more, and add some screenshots or even your blend file? $\endgroup$ – L0Lock Jul 8 '20 at 14:04
  • $\begingroup$ @L0Lock updated $\endgroup$ – Случайная Котя Jul 8 '20 at 15:10
0
$\begingroup$

I'm not sure you will gain something keeping your current UV, you will have a hard time getting accurate and precise texel density & texture details on your mesh. Using orthographic projections like that is not that effective, at least not on organic shapes and not with some help from other projections and other techniques.

I'd suggest you use your current technique only as a way to quickly build a final texture that correctly wrap around your mesh with no waste.

A simple way to do that is simply to bake your current projected-from-front texture into another texture that's based on a more correct UV map.

Assuming you start with such a scenario, with your mesh, unwraped by projection, with a simple material like a sole emission shader with your texture plugged in:

starting point

Head to the Properties editor > Object Data tab > UV Maps panel > click the + icon to create a new UV map and give it a nice name.

new UV

With that new UV map selected, make you new unwrap to your needs. Using auto UVs unwrap methods or manual unwrap, or both, ... as you wish.

new uv map

In the shader editor, add a UV Map node and a new Image Texture node. Plug the UV Map output in your new Image Texture node, ans select your new UV map in the UV Map node. That's what will enable your new texture to use that specific UV Map instead of the default one. Then use the Image Texture node's New button to create the new texture in which we will bake.

enter image description here

Make sure you keep that image texture node selected, and only that one. That's how the baking will know in which texture to bake.

In the render settings, set the render engine to cycles. Then in the Bake panel, if you plugged your color texture in an emission shader as I did, set the bake type to Emit. Otherwise, you would probably need to set it to Diffuse and check only the Color influence. Also play with the margin value, the baking will overflow your uv islands a little to avoid empty pixel parts, but if you est it too big it will overflow on other islands.

baking settings

Hit the Bake button, it will bake your first UV map's result into your second uv map. Once done, you will have your new texture that uses your UV space as you want:

result

Then you can replace the texture in your shader.

Be aware that when you have multiple UV maps on a mesh, only the one with the camera icon can be used in your shaders without manually specifying it via a UV Map node. So if you don't want this, check the camera icon on the new UV Map to set it as default, or even delete the other UV Maps if you don't need them.

$\endgroup$
1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.