How to correct texture mapping on arbitrary quadrilaterals ?
Hello ! I'd like to apply a texture on an arbitrary 4 vertices mesh to get this kind of result:
instead of:
I found some interesting posts on the forum providing a Shader that seems to work well with trapezoids but not that good with other arbitrary quadrilaterals. ( Right there -> https://forum.unity3d.com/threads/correcting-affine-texture-mapping-for-trapezoids.151283/ )
Here are the results using this shader script.
I'm not sure if it's actually possible to edit the code to reduce this distortion. I also found this article talking about an openGL solution but not being familiar with these concepts nor with Shader programming, I have no clue how to connect the dots.
I would appreciate any thoughts, recommendations on a way to do this (preferably using shaders or gpu calculation, to be as time-efficiently as possible).
Thanks a lot !
Answer by Piranha771 · Aug 28, 2018 at 02:01 PM
If you found this question by Google, this link leads to the solution:
http://www.reedbeta.com/blog/quadrilateral-interpolation-part-1/
Your answer
![](https://koobas.hobune.stream/wayback/20220612095714im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Change mesh texture when a line renderer has formed a loop on it 0 Answers
Help with a custom "painting" shader 1 Answer
Issues when using Unity's new PBR Dissolve Shader 0 Answers
Help Please,Help Pease 0 Answers
Custom Surface shader don't work with fresnel reflection and normal map at the same time 0 Answers