Hello guys i was searching for getting texture point on mesh
what i have found is using raycast
i used PICKINGINFO.getTextureCoordinates() to get uv point and it worked fine but on plane only
here’s an example : Babylon.js Playground
in this example i can update uv texture data on another plane
I tried to do the same but with using sphere not plane i got wrong results because i couldn’t get the correct uv data from sphere using the same function PICKINGINFO.getTextureCoordinates()
also i tried another formula to convert my hitpoint of sphere to uv point
ref : UV mapping - Wikipedia
Can i ask what makes you say it doesn’t work on anything other than plane?
I haven’t used this function for a long time, but i remember it did work correctly on other meshes
yes sure it’s very good
honestly i didn’t try to use normal sphere before and apply this method on it
all this time i was trying to create sphere using PhotoDome
like this
var Sphere = new BABYLON.PhotoDome( “sphere”,“URL”, {resolution:50,size: 70 }, scene)
and i was getting wrong uv points actually i think it was Upside down
anyway after i use normal sphere i can now cut any square shape on sphere using me cubes
but Unfortunately i found area on sphere it get wrong result of uv points
Example:
normal area should be like this
strange one (wrong)
as the image explains it gives me wrong texture square !!
and the part of the sphere the texture is taken from depends on the orientation of the boxes, ie it can come from the larger part of the sphere not the part that looks like it is enclosed by the boxes.
When crossing the lines between two edges, babylon needs to decide from which side to take the rest. Try imagining a triangle on a plane, with one point at the top of the plane. Now move this point to the bottom - the triangle changes completely - two points stay the same, but the surface it covers has no intersection with the surface the older triangle had.
Perhaps by adding more uv points. Than you calculate if the connection between two boxes crosses the split and add that one as an additional uv point.
Unfortunately I haven’t worked with uv’s that much, so this is just an idea based on my limited knowlage.