KeyShot Forum

Technical discussions => Textures => Topic started by: smalldogstudio on April 20, 2020, 08:21:31 AM

Title: UV Unwrap / Chart Position / Texture Scaling - Questions!
Post by: smalldogstudio on April 20, 2020, 08:21:31 AM
Hello fellow keyshooters (to steal Esben's term . . .)

Sorry this is a long post, rather in-depth. I'm trying to understand more about UV unwrap works - it's a feature I have been wishing for, for a long time, having been working mostly in Solidworks in the past and not being able to UV unwrap at all - I was super excited to try it in v9.

So, I have been working with this metal Rectangular form container, modelled in Fusion 360 and then exported via STEP into Keyshot. I have carefully measured the true length of each segment of the body - back face, corner, side etc to work out the true length of the label that would wrap around the body. So the true dimensions of the label are 319.76mm (wide) x 179.50mm (high). The modelled part is 116 (Wide X) x 179.5 (High Y) x 59 (Deep Z). Scene units are mm.

I made artwork in illustrator to those dimensions, with different coloured panels showing each segment as above, and guide arrows to show edges.
I realised that the imported object has bad tessellation – so used the re-tessellate function – triangles are better aligned/arranged afterwards.
Then used the UV unwrap function – used the Quick Unwrap. When on to the Position Charts stage it defaults to the size of the object in the X direction (116mm) with scale of 1 and Rotation 0deg.

I changed this to specify the size of 179.5mm (texture map size in Y direction), Scale 1 and Rotation -90deg to align the map correctly. This means that the texture scale in X does not wrap all the way around the object in the X direction. Apply the mapping and go back to realtime view.
QUESTION 1: Is there a best practice or suggested approach as to which direction you should choose for the chart positioning? Does is always default to X size of the current object?

So, trying to actually map the texture onto the surface now – scale 1 places the texture on the surface, wrapping around, but position and scale are not as desired, appears to indicate that scale 1 in U = the scale size specified in the chart positioning. This placement seems arbitrary to me – would like to understand why this is happening?.
Experiment with scale and offsets, so realised that horizontal scaling of 1.78 makes map fit around wrap in X direction, with Vertical Scaling of 1 = 179.5mm, plus Shift U of 0.39 makes it positioned centrally (close enough)

QUESTION 2: I understand that U scale is 1.78 X the texture V Height, as set in Chart Positioning (179.5 x 1.78 = 319.5) but why would the Shift U be 0.39??? This seems arbitrary again to me – there must be a logical reason surely – can anyone suggest why this is so?
This is important to me as I am often required to map graphics / print onto objects in a controlled, exact fashion – so understanding how this is behaving will really help. Happy to share the scene if anyone wants to play around with it.

There are a few areas of manipulation of objects and textures that I would like to be able to do numerically . . . just feels a bit wrong to just eyeball it . . .
Thoughts / criticism welcome – perhaps I doing something stupid :-[? (it wouldn't be the first time!)

Best wishes, hope you stay safe and well in these crazy times  :)

David
(Small Dog Studio)



Title: Re: UV Unwrap / Chart Position / Texture Scaling - Questions!
Post by: INNEO_MWo on April 20, 2020, 11:29:23 AM
Sorry - but I have no answer to your topic. I had the same questions in KS9 beta period.


Attached you'll find your example redesigned with creo parametric. I used the length of the shape (319,956 mm) as base size in the UV unwrap tool.
So I can use U scale of 1. But I have to scale down the V direction ( 1/630 px X 354 px = 0,5619 ) and I have no clue why I have to shift V direction to -.22.


Perhaps this topic would bring some light in this issue?!


Cheers
Marco
Title: Re: UV Unwrap / Chart Position / Texture Scaling - Questions!
Post by: puyopuyo on April 21, 2020, 03:07:11 AM
I´ve attached a screenshot of the Maya Uv Editor. On the left in the area with the red outline you can see a flattened view of the UVs with two charts in KS terms. Normally this image would be exported and then be used for texture creation in Photoshop. But as far as I know there is no way to display the Uvs like that and in the Beta I was told that the UVs in Keyshot are not normalized to fit in that 0 to 1 space but live in an infinite space. So I guess for now eyeballing the position is the right way...

Adding a flattened view of the charts for this kind of application is also my biggest wish for the uv editor in KS. :)
Title: Re: UV Unwrap / Chart Position / Texture Scaling - Questions!
Post by: smalldogstudio on April 21, 2020, 03:10:33 AM
Thanks Marco -

That's a relief, at least it's not just me!

I should have included the model file, I'll do that below in case anyone else wishes to experiment.

best wishes D
Title: Re: UV Unwrap / Chart Position / Texture Scaling - Questions!
Post by: smalldogstudio on April 21, 2020, 03:12:22 AM
Quote from: puyopuyo on April 21, 2020, 03:07:11 AM
I´ve attached a screenshot of the Maya Uv Editor. On the left in the area with the red outline you can see a flattened view of the UVs with two charts in KS terms. Normally this image would be exported and then be used for texture creation in Photoshop. But as far as I know there is no way to display the Uvs like that and in the Beta I was told that the UVs in Keyshot are not normalized to fit in that 0 to 1 space but live in an infinite space. So I guess for now eyeballing the position is the right way...

Adding a flattened view of the charts for this kind of application is also my biggest wish for the uv editor in KS. :)

Hi - oh me too that would be much better, the ability to export that as an image file so that custom textures can be created to match the chart layout and then re-applied would be great for sure

Thanks for your input, really useful

bw

David
Title: Re: UV Unwrap / Chart Position / Texture Scaling - Questions!
Post by: puyopuyo on April 21, 2020, 03:37:56 AM
It also works great the other way in Maya. You can display the texture under the flattened UVs and then take the Charts and move, scale and rotate them like you would with any selection to match an existing texture. This is also possible in Keyshot but you have to do this without knowing where the texture is in 2d space. I imagine this would be especially difficult if you have no concept in mind what the charts represent.
Title: Re: UV Unwrap / Chart Position / Texture Scaling - Questions!
Post by: INNEO_MWo on April 22, 2020, 09:45:20 AM
finally made it! The texture has to as a square to scale it 1 by 1.
Title: Re: UV Unwrap / Chart Position / Texture Scaling - Questions!
Post by: mafrieger on April 22, 2020, 02:29:18 PM
you worked through this topic...

would someone mind putting the ideas to make live easy in this field directly to whishlist https://forum.keyshot.com/index.php?board=8.0 ?
should be worth it :-)
Title: Re: UV Unwrap / Chart Position / Texture Scaling - Questions!
Post by: puyopuyo on April 23, 2020, 04:12:46 AM
Quote from: mafrieger on April 22, 2020, 02:29:18 PM
you worked through this topic...

would someone mind putting the ideas to make live easy in this field directly to whishlist https://forum.keyshot.com/index.php?board=8.0 ?
should be worth it :-)

I´ve told the developers of the KS UV tool directly about that during the beta and it should definitely be on their radar. They were very understanding and I´ve understood that it´s a matter of priorities and might come in the future.

But I can make a request thread on the Wishlist board. What should go in there?

For me :
-Flattened view of the Uv Space/charts with the ability to export a snapshot of the UVs for texture creation
-more options to tweak the UVs after unwrapping so we don´t have to start over from the beginning everytime the Uvs are not unwrapped perfectly
Title: Re: UV Unwrap / Chart Position / Texture Scaling - Questions!
Post by: smalldogstudio on April 23, 2020, 07:30:11 AM
Thanks Marco - great stuff

could you explain how you did it - if you have time? E.g. scale of the chart, which directions did you pick for seams and/or direction guides?

puyopuyo > I agree on both counts, sensible ideas that would make this more user friendly and useful.

best wishes

David
Title: Re: UV Unwrap / Chart Position / Texture Scaling - Questions!
Post by: INNEO_MWo on April 23, 2020, 10:36:34 AM
sure - just follow the screenshots (the example files are in the post above)

1) the set of the polygons after the import doesn't allow (in this case) the vertices for UV unwrapping
2) re-tesselation: "Maximum edge length" of 25% brings enough vertices to select the midpoints (choose an "Angular Tolerance" to your liking)
3) the Seam goes straight through the middle of the front, because you build the texture this way.
    a close loop for the chart isn't necessary and it works if the direction is set on the top, the center or the bottom edge
4) "Base UV size" of 319,956 mm is the length of the flatten surface or the loop of the top-/bottom boundary
    a "Rotate" of +90° works well in this case - the indicator is the description of the pattern (preview)


Hope that helps

Cheers
Marco
Title: Re: UV Unwrap / Chart Position / Texture Scaling - Questions!
Post by: smalldogstudio on April 27, 2020, 07:47:52 AM
Hello Marco

Sorry I was swamped with work last week so didn't get a chance to test this until now - I couldn't replicate your results, still getting issues with the final UV size being wrong, until I opened your texture map, then I finally understood - so you made the canvas size of the texture image bigger to match the width - so 319.79 x 319.79, the rest being transparent background, then save as a PNG.

Then it worked! - it was driving me crazy, this is a workaround i suppose but at least it gets the desired result. Thought I would post this as others may not have realised what you did.

thanks again

David