Cut uv texture points from sphere mesh

Hello guys

i have sphere with texture applied on it and what i want is to define 4 points (square shape) on that sphere then cut/get those group of points from the texture and applied it in another mesh like plane
i tried a lot but i didn’t got the result that i am looking for until now

hi can you show us any texture example

For sure,
here’s an example i have sphere that have materail of texture
and i have 4 points (cubes) on sphere as square shape what i want i to cut this texture data between those points and Get or applied this part of texture on another mesh

PlayGround Ex

hi. you can place second camera in front of virtual plane placed between cubes(you need place plane you dont need this cubes. only 4 points for plane) and render to texture. you need calculate cam parameters for second camera from this plane size and set camera settings before render to texture

1 Like

thanks for your answer
can u make example to explain it more

for what purposes you need this texture in final product?

i need user to define 4 points on texture to cut , then apply this texture data in another mesh (plane)

Wingnut goofing around with GUI 2d worldMap ImageControl mapped onto sphere, and using a simple orange-border GUI 2d rectangle as a “range”. The orange “range” IS draggable with mouse but not working well (drag it far-distance to get it working at all).

Just thinking. Early tests. Trying to fig how to “harvest” a section of “big map”… to be cropped/applied onto a plane (or be UV “offsetted” to map onto a plane). BJS has quite a few texture “adjusters” for scaling, repeating wrapping, and offsetting… textures… making them map-onto nearly anything.

In other words, you aren’t really “cropping-out” a new texture from a “piece” of the worldMap. Instead… you apply the worldMap texture to the plane… but then use MANY texture scalers and offsetters to stretch the worldmap to fit onto the plane… in a way that it LOOKS LIKE user “cropped-out” a “clip”.

But they didn’t. :slight_smile: Precise “where’s the corners of the range box” conversion… into Texture uOffset, vOffset, uScale, vScale, etc etc… will be super-important. Range-box-corner-to-Texture-upon-plane-positioning… function. :slight_smile: What a name. :slight_smile:

1 Like

thanks wingnut for your answer and playground
was i am thinking for is the get some of uv data (that will be in range plan mesh) of sphere and apply this uv data on any other mesh

I added an on-screen ‘@Givo Chromebook Consolette’ to the GUI 2d “wrap”. Drag the orange rectangle box (if you can get it moving AT ALL). You can see it used to monitor diff in line 75. (console.out)

Lots of vertical “line space” between each outputted line … on the gui2d “consolette”. Pretty badly coded… and probably a waste of time, since f12 console works fine, too (except for student Chromebook coders with disabled JS consoles).

Really, the consolette needs to be placed on a nice flat rectangle or on a full-screen gui2d. adt #2.

Anyway, I am preparing to see what the hell is wrong with my rect mover/dragger. It’s jerky… gets stuck. badly-offsetted pointer, etc. Dragging/dropping the orange border rect… is not working smooth at all. Not only that, but using GUI2d to do this “select a clip of texture”… is maybe the wrong approach or destined to fail… dunno. Help/advice welcome… always.

Wingy feeling-around in the dark… aimless… clueless… dragging around GUI controls with a mouse… using .top and .left values well into the negatives and expecting “drag-wrap” around a sphere? Geez, if something COULD explode… I have certainly invited it with open arms. heh.

On another course, our MeshBuilder.CreateSphere has lots of power… easily making slices of spheres and other semi-sphere configs. Dragging a “piece of sphere”… across/around a “world globe”… maintaining “eccentricity” as the drag happens… THAT could be done, too… maybe… semi-transparent slice. Still, this doesn’t really address the issue of letting users select corners. But it does open option for letting them “size” the semi-sphere. Then say goodbye to gui2d and hello to something else. :slight_smile:

“Dragging items around the world!” International drag! Gotta love it. The digital version of trucks, planes, trains, and ships. :slight_smile:

What’s that you say? Oh. Yeah, weather jet-streams, too. They also do international dragging. :wink:

1 Like

Hey kv… do you think we can get a good renderTargetTexture… when the 2nd camera is shooting a texture on a curved surface? I love the idea of using 2nd camera/field-of-view… and renderTargetTexture… to gather a “clip” of “the big texture”, but I think it will appear “spherified” when RTT is applied to a plane.

IF we could “de-spherify” the view from 2nd camera… in a way that nulls the spherification (heh) that the world globe-curvature causes… that might work. What’s the opposite of a fish-eye lens? :slight_smile: Simply called “concave”, perhaps? hmm. :slight_smile:

We need a “Ginsu Texture Knife”, me thinx.

1 Like

even on a sphere the uv coords are 0-1. So I am kinda confused as to whats really being asked?

If you are just trying to draw a texture on a texture at a certain point, why don’t you do a dynamic texture, and just draw your ‘plane’ texture on the spheres texture then use that on your spheres material?

1 Like

can u show me an example how to take dynamic texture of sphere texture depending on points on that sphere like any somewhere on sphere @Pryme8

i think in this case, which described the topic starter best solution - convert spherical texture to skybox type of texture and use skybox.
this is to solve the problem of unfolding spherical coordinates on plane?

Karim sorry but we just users and cannot do work for you/ we only can take you
approximate direction of thought. if you cannot do it yourself you can ask help in this sectioin Service offers and requests - Babylon.js or waiting maybe someone will have nothing to do and they can helps you.

you can do some deformation magic on the imageData if you need to do like polygons and not squares, but it would get really complex if you do anything other then simple skews and stuff.


i wasn’t asking u for creating full project !!
i was ask for demo that explain sample or proof of concept of how this it could be done and this community made for this for sharing idea and help each others
anyway thanks for your replay
have a good day

1 Like

the other solution is …


  1. make red map texture on the wall we need to change
  2. make shader with 2 enviroment map
  3. clculate wall new uv
  4. map the texture with new uv
    5 mix them by color map

this uv calculation just work for wall if you need floor or any other situation see this

1 Like

dear @kvasss
totaly i agree with you but for my self i like make what we don’t have before in babylon-js
so if anyone cant find the best solution in here we don’t have limitation for make question or do solutions when we see the general problem the main developer of babylonjs collect all solution and make the tools in git for that