discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

lithophane sphere with image

GM
Gábor Magyar
Sun, Mar 24, 2024 8:25 AM

Hi!

I would like to design a lithophane sphere with several graphic elements on it.
I have not yet found a solution in Openscad that would support drawing
images onto a spherical surface.

Which library can be used to solve this?
Either by using one image once, or by using one image several times
(rotated by 120 degrees), or by using several images at 120 degrees or
randomly placed.

A tutorial on solving such a task would also be good.

Thanks!

--
Üdvözlettel,
Magyar Gábor

Hi! I would like to design a lithophane sphere with several graphic elements on it. I have not yet found a solution in Openscad that would support drawing images onto a spherical surface. Which library can be used to solve this? Either by using one image once, or by using one image several times (rotated by 120 degrees), or by using several images at 120 degrees or randomly placed. A tutorial on solving such a task would also be good. Thanks! -- Üdvözlettel, Magyar Gábor
DP
David Phillip Oster
Sun, Mar 24, 2024 3:27 PM

there is this recent video on texturing arbitrary objects, but using
Blender, not OpenSCAD: https://www.youtube.com/watch?v=MezOnZN1x18

On Sun, Mar 24, 2024 at 1:26 AM Gábor Magyar via Discuss <
discuss@lists.openscad.org> wrote:

Hi!

I would like to design a lithophane sphere with several graphic elements
on it.
I have not yet found a solution in Openscad that would support drawing
images onto a spherical surface.

Which library can be used to solve this?
Either by using one image once, or by using one image several times
(rotated by 120 degrees), or by using several images at 120 degrees or
randomly placed.

A tutorial on solving such a task would also be good.

Thanks!

--
Üdvözlettel,
Magyar Gábor


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

there is this recent video on texturing arbitrary objects, but using Blender, not OpenSCAD: https://www.youtube.com/watch?v=MezOnZN1x18 On Sun, Mar 24, 2024 at 1:26 AM Gábor Magyar via Discuss < discuss@lists.openscad.org> wrote: > Hi! > > > I would like to design a lithophane sphere with several graphic elements > on it. > I have not yet found a solution in Openscad that would support drawing > images onto a spherical surface. > > Which library can be used to solve this? > Either by using one image once, or by using one image several times > (rotated by 120 degrees), or by using several images at 120 degrees or > randomly placed. > > A tutorial on solving such a task would also be good. > > Thanks! > > > -- > Üdvözlettel, > Magyar Gábor > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
RW
Raymond West
Sun, Mar 24, 2024 8:33 PM

Working the other way round, people who make maps would be interested in
a solution. If  your idea  is to create something like a lamp shade,
then an icosidodecahedron is quite a nice shape.  You'll get 12 flat
surfaces to play with. I put some code on thingiverse 
https://www.thingiverse.com/thing:6377113,  but there were problems with
how thingiverse handled included stl files on there - it didn't, so it
didn't work too good back then, but the scad code may be of some help.
Use your lithophane/s instead of the rose5.stl.

Best wishes,

Ray

On 24/03/2024 08:25, Gábor Magyar via Discuss wrote:

Hi!

I would like to design a lithophane sphere with several graphic elements on it.
I have not yet found a solution in Openscad that would support drawing
images onto a spherical surface.

Which library can be used to solve this?
Either by using one image once, or by using one image several times
(rotated by 120 degrees), or by using several images at 120 degrees or
randomly placed.

A tutorial on solving such a task would also be good.

Thanks!

Working the other way round, people who make maps would be interested in a solution. If  your idea  is to create something like a lamp shade, then an icosidodecahedron is quite a nice shape.  You'll get 12 flat surfaces to play with. I put some code on thingiverse  https://www.thingiverse.com/thing:6377113,  but there were problems with how thingiverse handled included stl files on there - it didn't, so it didn't work too good back then, but the scad code may be of some help. Use your lithophane/s instead of the rose5.stl. Best wishes, Ray On 24/03/2024 08:25, Gábor Magyar via Discuss wrote: > Hi! > > > I would like to design a lithophane sphere with several graphic elements on it. > I have not yet found a solution in Openscad that would support drawing > images onto a spherical surface. > > Which library can be used to solve this? > Either by using one image once, or by using one image several times > (rotated by 120 degrees), or by using several images at 120 degrees or > randomly placed. > > A tutorial on solving such a task would also be good. > > Thanks! > >
MP
Marcus Poller
Sun, Mar 24, 2024 11:16 PM

Hi Gabor,

Gábor Magyar via Discuss wrote:

Hi!

I would like to design a lithophane sphere with several graphic elements on it.
I have not yet found a solution in Openscad that would support drawing
images onto a spherical surface.

Long story short, you can't; Catographers have been thinking for hundreds of years how to draw a spherical earth onto a flat surface. See

https://en.wikipedia.org/wiki/List_of_map_projections

to get an idea of the pain and tradeoffs.

That being said, you managed to geek snipe me. [1]
I once projected a flat image onto a cylindrical surface. Cylinder and sphere are not that different from another, if

  • your image is very wide on the x-axis and very narrow on the y-axis
  • your sphere will remain without a picture on the poles
  • you are willing to accept errors in the projection by squeezing image elements that are close to your spheres poles

There may be special circumstances where your projection can be done. Do you have a sample SVG?

Cheers,
Marcus

[1] https://xkcd.com/356/

Hi Gabor, Gábor Magyar via Discuss wrote: > Hi! > > > I would like to design a lithophane sphere with several graphic elements on it. > I have not yet found a solution in Openscad that would support drawing > images onto a spherical surface. Long story short, you can't; Catographers have been thinking for hundreds of years how to draw a spherical earth onto a flat surface. See https://en.wikipedia.org/wiki/List_of_map_projections to get an idea of the pain and tradeoffs. That being said, you managed to geek snipe me. [1] I once projected a flat image onto a cylindrical surface. Cylinder and sphere are not that different from another, if * your image is very wide on the x-axis and very narrow on the y-axis * your sphere will remain without a picture on the poles * you are willing to accept errors in the projection by squeezing image elements that are close to your spheres poles There may be special circumstances where your projection can be done. Do you have a sample SVG? Cheers, Marcus [1] https://xkcd.com/356/
JB
Jordan Brown
Sun, Mar 24, 2024 11:29 PM

Raw OpenSCAD won't help you design onto a sphere.

There might be a library somewhere, but I don't immediately find
something in BOSL2.

What you would have to do is to write something that creates a sphere as
a polyhedron, and then modify it to adjust the radius as desired for
each point.

You could look at how BOSL2 generates spheres for some ideas.  (I
haven't looked, so I don't know how hard it is to understand.)  The
relevant functions are documented starting at
https://github.com/BelfrySCAD/BOSL2/wiki/shapes3d.scad#functionmodule-sphere
.

Remember that a flat image will never map properly onto a sphere; there
is always distortion or lost pieces.

Raw OpenSCAD won't help you design onto a sphere. There might be a library somewhere, but I don't immediately find something in BOSL2. What you would have to do is to write something that creates a sphere as a polyhedron, and then modify it to adjust the radius as desired for each point. You could look at how BOSL2 generates spheres for some ideas.  (I haven't looked, so I don't know how hard it is to understand.)  The relevant functions are documented starting at https://github.com/BelfrySCAD/BOSL2/wiki/shapes3d.scad#functionmodule-sphere . Remember that a flat image will never map properly onto a sphere; there is always distortion or lost pieces.
FH
Father Horton
Sun, Mar 24, 2024 11:52 PM

Import the image using surface() within a module (because you’re going to
be using it repeatedly). Using intersection(), chop the surface into small
pieces (size and shape TBD), then rotate and translate into position.

I tried this once on a cylinder, and it didn’t work well. But I guess it
might if you try harder than I did.

You are much better off going to 3Drocks. OpenSCAD really isn’t the tool
for this.

On Sun, Mar 24, 2024 at 6:29 PM Jordan Brown via Discuss <
discuss@lists.openscad.org> wrote:

Raw OpenSCAD won't help you design onto a sphere.

There might be a library somewhere, but I don't immediately find something
in BOSL2.

What you would have to do is to write something that creates a sphere as a
polyhedron, and then modify it to adjust the radius as desired for each
point.

You could look at how BOSL2 generates spheres for some ideas.  (I haven't
looked, so I don't know how hard it is to understand.)  The relevant
functions are documented starting at
https://github.com/BelfrySCAD/BOSL2/wiki/shapes3d.scad#functionmodule-sphere
.

Remember that a flat image will never map properly onto a sphere; there is
always distortion or lost pieces.


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

Import the image using surface() within a module (because you’re going to be using it repeatedly). Using intersection(), chop the surface into small pieces (size and shape TBD), then rotate and translate into position. I tried this once on a cylinder, and it didn’t work well. But I guess it might if you try harder than I did. You are much better off going to 3Drocks. OpenSCAD really isn’t the tool for this. On Sun, Mar 24, 2024 at 6:29 PM Jordan Brown via Discuss < discuss@lists.openscad.org> wrote: > Raw OpenSCAD won't help you design onto a sphere. > > There might be a library somewhere, but I don't immediately find something > in BOSL2. > > What you would have to do is to write something that creates a sphere as a > polyhedron, and then modify it to adjust the radius as desired for each > point. > > You could look at how BOSL2 generates spheres for some ideas. (I haven't > looked, so I don't know how hard it is to understand.) The relevant > functions are documented starting at > https://github.com/BelfrySCAD/BOSL2/wiki/shapes3d.scad#functionmodule-sphere > . > > > Remember that a flat image will never map properly onto a sphere; there is > always distortion or lost pieces. > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
NH
nop head
Mon, Mar 25, 2024 12:08 AM

I have a module that maps a 2D child onto a cylinder here:
https://github.com/nophead/NopSCADlib/tree/master?tab=readme-ov-file#pcb_utils

I could do with something that works on a sphere to label disc ceramic
capacitors but it isn't trivial.

On Sun, 24 Mar 2024 at 23:53, Father Horton via Discuss <
discuss@lists.openscad.org> wrote:

Import the image using surface() within a module (because you’re going to
be using it repeatedly). Using intersection(), chop the surface into small
pieces (size and shape TBD), then rotate and translate into position.

I tried this once on a cylinder, and it didn’t work well. But I guess it
might if you try harder than I did.

You are much better off going to 3Drocks. OpenSCAD really isn’t the tool
for this.

On Sun, Mar 24, 2024 at 6:29 PM Jordan Brown via Discuss <
discuss@lists.openscad.org> wrote:

Raw OpenSCAD won't help you design onto a sphere.

There might be a library somewhere, but I don't immediately find
something in BOSL2.

What you would have to do is to write something that creates a sphere as
a polyhedron, and then modify it to adjust the radius as desired for each
point.

You could look at how BOSL2 generates spheres for some ideas.  (I haven't
looked, so I don't know how hard it is to understand.)  The relevant
functions are documented starting at
https://github.com/BelfrySCAD/BOSL2/wiki/shapes3d.scad#functionmodule-sphere
.

Remember that a flat image will never map properly onto a sphere; there
is always distortion or lost pieces.


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

I have a module that maps a 2D child onto a cylinder here: https://github.com/nophead/NopSCADlib/tree/master?tab=readme-ov-file#pcb_utils I could do with something that works on a sphere to label disc ceramic capacitors but it isn't trivial. On Sun, 24 Mar 2024 at 23:53, Father Horton via Discuss < discuss@lists.openscad.org> wrote: > Import the image using surface() within a module (because you’re going to > be using it repeatedly). Using intersection(), chop the surface into small > pieces (size and shape TBD), then rotate and translate into position. > > I tried this once on a cylinder, and it didn’t work well. But I guess it > might if you try harder than I did. > > You are much better off going to 3Drocks. OpenSCAD really isn’t the tool > for this. > > On Sun, Mar 24, 2024 at 6:29 PM Jordan Brown via Discuss < > discuss@lists.openscad.org> wrote: > >> Raw OpenSCAD won't help you design onto a sphere. >> >> There might be a library somewhere, but I don't immediately find >> something in BOSL2. >> >> What you would have to do is to write something that creates a sphere as >> a polyhedron, and then modify it to adjust the radius as desired for each >> point. >> >> You could look at how BOSL2 generates spheres for some ideas. (I haven't >> looked, so I don't know how hard it is to understand.) The relevant >> functions are documented starting at >> https://github.com/BelfrySCAD/BOSL2/wiki/shapes3d.scad#functionmodule-sphere >> . >> >> >> Remember that a flat image will never map properly onto a sphere; there >> is always distortion or lost pieces. >> >> _______________________________________________ >> OpenSCAD mailing list >> To unsubscribe send an email to discuss-leave@lists.openscad.org >> > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
JB
Jordan Brown
Mon, Mar 25, 2024 1:14 AM

On 3/24/2024 4:29 PM, Jordan Brown via Discuss wrote:

What you would have to do is to write something that creates a sphere
as a polyhedron, and then modify it to adjust the radius as desired
for each point.

Here's a simplistic example.  This uses Equirectangular projection,
which is easy but is distorted everywhere, and especially near the
poles. It just maps latitude and longitude lines onto rows and columns
of the array.

... but somehow you have to get your image data into an OpenSCAD array.

// Map a polar coordinate [rho, theta, phi] onto Cartesian [x,y,z]
function toRect3(p) = [
p[0] * cos(p[1]) * sin(p[2]),
p[0] * sin(p[1]) * sin(p[2]),
p[0] * cos(p[2])
];

// Map array a onto a sphere of radius r, using equirectangular projection.
// https://en.wikipedia.org/wiki/Equirectangular_projection
//
// a is an array of offsets from the radius, so negative a[i][j] pulls the
// sphere in and positive a[i][j] pushes it out.
//
// Note:  north and south poles are always at the nominal radius.
//
// Note:  at low resolutions, triangulation artifacts are very obvious.
// The problem is that when you divide this square
//        0 1
//        1 0
// into two triangles, you have to decide whether it represents a ridge
// running northeast / southwest or a valley running northwest / southeast.
// This scheme splits on the NE/SW line, so makes it a ridge.  10/01, on the other
// hand, will be a valley.
module sphereImage(r, a) {
nLat = len(a);
nLon = len(a[0]);
latStep = 180/nLat;
lonStep = 360/nLon;
latStart = -90 + latStep/2;
lonStart = -180;
points = [
for (i = [0:nLat-1])
let(lat = latStart + ilatStep)
for (j = [0:nLon-1])
let(lon = lonStart + j * lonStep)
toRect3([ r + a[i][j], lon, 90-lat ]),
[0, 0, r],
[0, 0, -r]
];
northPole = nLat
nLon;
southPole = northPole + 1;
faces=[
for (j=[0:nLon-1])
[ southPole, j, (j+1)%nLon],
for (j=[0:nLon-1])
[ northPole, (nLat-1)nLon + (j+1)%nLon, (nLat-1)nLon + j ],
for(i=[0:nLat-2], j=[0:nLon-1])
[i
nLon+j, (i+1)nLon + (j+1)%nLon, inLon + (j+1)%nLon],
for(i=[0:nLat-2], j=[0:nLon-1])
[i
nLon+j, (i+1)*nLon + j, (i+1)*nLon + (j+1)%nLon]
];
polyhedron(points=points, faces=faces);
}

// Here are a few examples...

// A simple sphere
//image = [ for (i=[0:20]) [ for (j=[0:40]) 0 ]];

// Randomly tweak each point
//image = [for(i=[0:20]) [ for(j=[0:40]) rands(-1,1,1)[0] ]];

// A sine wave based pattern
//image = [ for (i=[0:20]) [ for (j=[0:40]) sin(j72) + sin(i72) ]];

// An explicit pattern
image = [
[ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, ],
[ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, ],
[ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, ],
[ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, ],
[ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, ],
[ 0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0, ],
[ 0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0, ],
[ 0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0, ],
[ 0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0, ],
[ 0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0, ],
[ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, ],
[ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, ],
[ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, ],
[ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, ],
[ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, ],
];

sphereImage(r=10, a=image);

On 3/24/2024 4:29 PM, Jordan Brown via Discuss wrote: > What you would have to do is to write something that creates a sphere > as a polyhedron, and then modify it to adjust the radius as desired > for each point. Here's a simplistic example.  This uses Equirectangular projection, which is easy but is distorted everywhere, and especially near the poles. It just maps latitude and longitude lines onto rows and columns of the array. ... but somehow you have to get your image data into an OpenSCAD array. // Map a polar coordinate [rho, theta, phi] onto Cartesian [x,y,z] function toRect3(p) = [ p[0] * cos(p[1]) * sin(p[2]), p[0] * sin(p[1]) * sin(p[2]), p[0] * cos(p[2]) ]; // Map array a onto a sphere of radius r, using equirectangular projection. // https://en.wikipedia.org/wiki/Equirectangular_projection // // a is an array of offsets from the radius, so negative a[i][j] pulls the // sphere in and positive a[i][j] pushes it out. // // Note: north and south poles are always at the nominal radius. // // Note: at low resolutions, triangulation artifacts are very obvious. // The problem is that when you divide this square // 0 1 // 1 0 // into two triangles, you have to decide whether it represents a ridge // running northeast / southwest or a valley running northwest / southeast. // This scheme splits on the NE/SW line, so makes it a ridge. 10/01, on the other // hand, will be a valley. module sphereImage(r, a) { nLat = len(a); nLon = len(a[0]); latStep = 180/nLat; lonStep = 360/nLon; latStart = -90 + latStep/2; lonStart = -180; points = [ for (i = [0:nLat-1]) let(lat = latStart + i*latStep) for (j = [0:nLon-1]) let(lon = lonStart + j * lonStep) toRect3([ r + a[i][j], lon, 90-lat ]), [0, 0, r], [0, 0, -r] ]; northPole = nLat*nLon; southPole = northPole + 1; faces=[ for (j=[0:nLon-1]) [ southPole, j, (j+1)%nLon], for (j=[0:nLon-1]) [ northPole, (nLat-1)*nLon + (j+1)%nLon, (nLat-1)*nLon + j ], for(i=[0:nLat-2], j=[0:nLon-1]) [i*nLon+j, (i+1)*nLon + (j+1)%nLon, i*nLon + (j+1)%nLon], for(i=[0:nLat-2], j=[0:nLon-1]) [i*nLon+j, (i+1)*nLon + j, (i+1)*nLon + (j+1)%nLon] ]; polyhedron(points=points, faces=faces); } // Here are a few examples... // A simple sphere //image = [ for (i=[0:20]) [ for (j=[0:40]) 0 ]]; // Randomly tweak each point //image = [for(i=[0:20]) [ for(j=[0:40]) rands(-1,1,1)[0] ]]; // A sine wave based pattern //image = [ for (i=[0:20]) [ for (j=[0:40]) sin(j*72) + sin(i*72) ]]; // An explicit pattern image = [ [ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, ], [ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, ], [ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, ], [ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, ], [ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, ], [ 0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0, ], [ 0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0, ], [ 0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0, ], [ 0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0, ], [ 0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0, ], [ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, ], [ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, ], [ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, ], [ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, ], [ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, ], ]; sphereImage(r=10, a=image);
JB
Jordan Brown
Mon, Mar 25, 2024 2:12 AM

Really, there are two distinct questions:

  • How do you generate the sphere?
  • How do you map pixels in the image onto the sphere?

Arguably best is to separate those two, generating the sphere using
whatever algorithm you like, and then for each vertex mapping that
vertex onto the image to determine its value.

The "lines of latitude and longitude" scheme that I used for generating
the sphere is simple, but geodesic schemes
https://en.wikipedia.org/wiki/Geodesic_polyhedron generate prettier
spheres.

Once you have a way to generate the sphere, for each point (here,
probably each vertex) you would map from its spherical-coordinate
position to an appropriate point on the image - probably interpolating
between the four closest pixels.  I have found that the simple technique
for this is called UV mapping https://en.wikipedia.org/wiki/UV_mapping.

For mapping texture you probably want to consider faces, but for mapping
altitude (as here) you probably want to consider vertexes.

Note that separating the two this way allows you to separate the
resolution of the sphere from the resolution of the image.

Really, there are two distinct questions: * How do you generate the sphere? * How do you map pixels in the image onto the sphere? Arguably best is to separate those two, generating the sphere using whatever algorithm you like, and then for each vertex mapping that vertex onto the image to determine its value. The "lines of latitude and longitude" scheme that I used for generating the sphere is simple, but geodesic schemes <https://en.wikipedia.org/wiki/Geodesic_polyhedron> generate prettier spheres. Once you have a way to generate the sphere, for each point (here, probably each vertex) you would map from its spherical-coordinate position to an appropriate point on the image - probably interpolating between the four closest pixels.  I have found that the simple technique for this is called UV mapping <https://en.wikipedia.org/wiki/UV_mapping>. For mapping texture you probably want to consider faces, but for mapping altitude (as here) you probably want to consider vertexes. Note that separating the two this way allows you to separate the resolution of the sphere from the resolution of the image.
FH
Father Horton
Mon, Mar 25, 2024 2:49 AM

OpenSCAD is really the wrong tool for this.

https://3dp.rocks/lithophane/?fref=gc
https://www.lithophanemaker.com/

I've generated a lithophane with one of these and then merged it into an
OpenSCAD project. Just don't expect it to be fast.

On Sun, Mar 24, 2024 at 9:12 PM Jordan Brown via Discuss <
discuss@lists.openscad.org> wrote:

Really, there are two distinct questions:

- How do you generate the sphere?
- How do you map pixels in the image onto the sphere?

Arguably best is to separate those two, generating the sphere using
whatever algorithm you like, and then for each vertex mapping that vertex
onto the image to determine its value.

The "lines of latitude and longitude" scheme that I used for generating
the sphere is simple, but geodesic schemes
https://en.wikipedia.org/wiki/Geodesic_polyhedron generate prettier
spheres.

Once you have a way to generate the sphere, for each point (here, probably
each vertex) you would map from its spherical-coordinate position to an
appropriate point on the image - probably interpolating between the four
closest pixels.  I have found that the simple technique for this is called UV
mapping https://en.wikipedia.org/wiki/UV_mapping.

For mapping texture you probably want to consider faces, but for mapping
altitude (as here) you probably want to consider vertexes.

Note that separating the two this way allows you to separate the
resolution of the sphere from the resolution of the image.


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

OpenSCAD is really the wrong tool for this. https://3dp.rocks/lithophane/?fref=gc https://www.lithophanemaker.com/ I've generated a lithophane with one of these and then merged it into an OpenSCAD project. Just don't expect it to be fast. On Sun, Mar 24, 2024 at 9:12 PM Jordan Brown via Discuss < discuss@lists.openscad.org> wrote: > Really, there are two distinct questions: > > - How do you generate the sphere? > - How do you map pixels in the image onto the sphere? > > Arguably best is to separate those two, generating the sphere using > whatever algorithm you like, and then for each vertex mapping that vertex > onto the image to determine its value. > > The "lines of latitude and longitude" scheme that I used for generating > the sphere is simple, but geodesic schemes > <https://en.wikipedia.org/wiki/Geodesic_polyhedron> generate prettier > spheres. > > Once you have a way to generate the sphere, for each point (here, probably > each vertex) you would map from its spherical-coordinate position to an > appropriate point on the image - probably interpolating between the four > closest pixels. I have found that the simple technique for this is called UV > mapping <https://en.wikipedia.org/wiki/UV_mapping>. > > For mapping texture you probably want to consider faces, but for mapping > altitude (as here) you probably want to consider vertexes. > > > Note that separating the two this way allows you to separate the > resolution of the sphere from the resolution of the image. > > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >