So, I have a situation that texture on the top row of the cube (shaded in blue) is stretched when I move up those four vertices (blue circled ones). Note that the bottom row of the cube is not stretched because its vertices are not affected and keep its UVs.
This is a demo project: https://playcanvas.com/editor/scene/1147037
and the screenshot (you can press the up and down arrow to move that vertices:
What I want to do is preserve UVs on the top row so that it will be tiling correctly while moving vertices like this:
Any idea? Thank you!
I think you could change the uv of that four vertices according to the stretched offset to achieve what you want.
You can find the project here:
OMG! This is amazing! Thank you soooooo much.
Now the cube got a little more complicated like the following (note that the yellow shaded area is added with a 90 degree rotated UV map). I am still moving up those top vertices and observe all faces are preserving UVs.
But, as you see, the front face of the cube is being stretched. How do I fix this? Even I don’t know if this can be fixed. Anyway here is the project:
Would you help one more time please?
@cgopia94 Yeah,this situtation is a little complicated, you must calculate the uv offset of each vertice:
@FBplus Thank you so much again. learned a lot and really appreciated for your time and advices!
I understand this is a really old thread and probably the reason the project you shared isn’t available anymore. But, would it be possible for you to share this project again? I was looking for a solution to this problem and this would really help me a lot.
@Tanay_Dimri Hi, Tanay_Dimri,Sorry for my late late reply.I am afraid I can’t share the project agin since I‘ve already deleted it,and I am currently working on some urgent projects
anyway, have you find the solution?
Thanks for your response. I got it to work in the scene shared in this thread with some changes. But couldn’t get to work in another scene I am working on.
Here is a sample scene I prepared for you to play around with if you get time.
- “tableTop” is the entity being scaled.
- scripts > Scaling > rescaleTableTop.js is the one responsible for handling calculations.
- The input for Length and Width come from the slider in the UI.
Any help with this would be appreciated