# How to create new map shapes for default PShapes Sphere box etc

**URL:** <https://discourse.processing.org/t/how-to-create-new-map-shapes-for-default-pshapes-sphere-box-etc/27386>\
**Category:** Beginners\
**Created:** [January 26, 2021, 1:21pm UTC](https://discourse.processing.org/t/how-to-create-new-map-shapes-for-default-pshapes-sphere-box-etc/27386 "2021-01-26T13:21:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![kp443](https://avatars.discourse-cdn.com/v4/letter/k/d9b06d/32.png) [@kp443](https://discourse.processing.org/u/kp443)\
**Post date:** [January 26, 2021, 1:21pm UTC](https://discourse.processing.org/t/how-to-create-new-map-shapes-for-default-pshapes-sphere-box-etc/27386/1 "2021-01-26T13:21:00Z")

</div>

Tryna create planar mapping xy for a sphere. How to change the default mapping? Some tutorial link?

---

<div class="post-metadata">

**Author:** ![WeinSim](https://avatars.discourse-cdn.com/v4/letter/w/db5fbb/32.png) [@WeinSim](https://discourse.processing.org/u/WeinSim)\
**Post date:** [January 27, 2021, 2:11pm UTC](https://discourse.processing.org/t/how-to-create-new-map-shapes-for-default-pshapes-sphere-box-etc/27386/2 "2021-01-27T14:11:18Z")

</div>

I’ve never heard of any default mapping in Processing, but if you want to convert from 3d coordinates to UV coordinates, here’s how you do it:

```auto
float [] xyzToUV(PVector p, PVector center, float r) { //p: point in 3d space, center: center of the sphere, r: radius of the sphere
  float [] ret = new int [2]; //u and v coordinates, u = [0, 2[, v = [0, 1[
  p.sub(center).div(r); //transforming the point as if it was on a sphere with radius 1 centered at the origin
  ret[0] = atan2(p.z, p.x)/PI+2)%2;
  ret[1] = asin(p.y)/PI+0.5;
  return ret;
}

```

I hope this helps you  
Best, Simon
