1
$\begingroup$

noob here wanting to "melt" a radially symmetrical mesh (SVG at the moment) onto a 3D scan of my head (STL at the moment) to eventually make a 3d printed scalp-conforming hat/cap (so projecting onto a convex spherish surface) in such a way that there is no distortion in distances from the center of the image (in other words the reverse of an equi-distant azimuthal projection (aka EDAP) of a sphere onto a plane https://en.wikipedia.org/wiki/Azimuthal_equidistant_projection

Feel free to sacrilegiously suggest plugin X of program Y (any major OS) that is not blender, as I am just starting.

Responding to comments: Yes this is projecting a flat surface image on something sphere like. Pretend for the moment that the latter is a globe. At first I thought something like UV Project modifier would work, if the flat image were transformed first in a fisheye lens kind of way. But lets say the image is projected from above the north pole of the globe. As the projected image gets close to the equator it gets more and more distorted and any errors will be magnified and be noticeable (especially in a shape that is not quite a sphere like a head). Also the shape might in some cases keep wrapping to points south of the equator which the projection can't reach. A better metaphor than projection, especially for an imperfect sphere, might be shrink wrapping or melting (or blow molding if it was on the inside). The radial distances of points in the image to the center point on both the original planar image and on the spheroid, need to match up fairly well or this particular image will look unpleasantly distorted. The fact that the other polar dimension is distorted (compressed if you think about it) will not be particularly unpleasant.

For an example of doing what I want see the wikipedia page above and think bout going in the opposite direction from flat map to globe. Anyway my local hackerspace buddies thought blender had the best chance of working, and I had played with it a little in the past and so here I am.

$\endgroup$
3
  • $\begingroup$ it's not very clear what you are asking. Could you post some screenshots of what you are trying to achieve? Are you trying to use said SVG file as a texture over your scalp mesh? You might have to convert the SVG into an image and unwrap your mesh $\endgroup$ Jul 20, 2016 at 18:02
  • $\begingroup$ @DuarteFarrajotaRamos, I think the idea is to project a flat surface on a sphere. The vertices of the flat surface coords have to be translated into a sphere coordinate. The angle is depending on the distance from the center (-90 to 90), in each X, Y direction. And the radius is constant as we want to project on a sphere. The only point is a head is not spherical... $\endgroup$
    – lemon
    Jul 20, 2016 at 18:05
  • $\begingroup$ Look into the UV Project modifier blender.stackexchange.com/questions/57420/… $\endgroup$ Jul 20, 2016 at 19:09

1 Answer 1

1
$\begingroup$

A solution based on Python (image and svg found here) :

enter image description here

The script :

import bpy
import bmesh
from math import *
from mathutils import Vector

#Reposition the mesh vertices calculating a 'reverse of equidistant azimuthal projection'
def reverseOfEquidistantAzimuthalProjection( model, propFactor = 1 ):

    rad90 = radians(90.0) #A way to have pi / 2

    modelData = model.data

    #Calculates vertices boundings (relative to vertices coordinates, because of the case of a not centered mesh)
    minX = min( [v.co[0] for v in modelData.vertices] )
    maxX = max( [v.co[0] for v in modelData.vertices] )
    minY = min( [v.co[1] for v in modelData.vertices] )
    maxY = max( [v.co[1] for v in modelData.vertices] )

    #Center in X and Y, we consider here a flat mesh in Z
    centerX = (minX + maxX) / 2.0
    centerY = (minY + maxY) / 2.0
    center = Vector( [centerX, centerY, 0] )

    #Radius of the projection
    baseRadius = (maxX - centerX)

    for v in modelData.vertices:
        pos = Vector( v.co )

        #Position relative to center        
        posXY = pos.xy - center.xy

        #Proportionality of the vertex relative to the radius
    #Between 0 and 100% where 0 corresponds to north pole and 100 to south
        prop = posXY.length / baseRadius

        #Conversion to -90 (south) / +90 (north) (in rads)
        angle = rad90 - (prop * pi) 

        #Relocation in X and Y : cos(angle) gives the radius of the cut
        posXY.normalize()
        posXY = posXY * baseRadius * cos(angle) * propFactor

        #Set the vertices new coordinates
        v.co[0] = center.x + posXY.x
        v.co[1] = center.y + posXY.y
        #In Z : keeps the eventual Z value and place the point relatively to that
        v.co[2] = v.co[2] + sin( angle ) * baseRadius * propFactor


model = bpy.context.object

reverseOfEquidistantAzimuthalProjection( model )

The first experiment is based on a circle extruded and cut : enter image description here

I have also try to use the svg symbol of the United Nations. Some difficulties :

  • The curves are in a lot of parts (you may have to select them all, convert to mesh and join them)
  • Edges are made 'as they come', so applying the script gives some unwanted results (some edges may have to be removed manually)

enter image description here

$\endgroup$
3
  • $\begingroup$ thank you for generously creating that code! To add some keywords that might allow others to find your work: my goal is related to the polar mode mapping or polar mapping in uvmapper and a few other uv unwrapping tools, and to stereographic projection as in Fig 5 in alice.loria.fr/publications/papers/2007/SigCourseParam/… $\endgroup$
    – user56273
    Jul 21, 2016 at 19:27
  • $\begingroup$ @user56273, so finally this answer is not your goal ? Do you have a concrete example of a svg which fits the chapter 5 in the document ? $\endgroup$
    – lemon
    Jul 22, 2016 at 5:16
  • $\begingroup$ Your answer will suit my needs (thank you). But for others who might prefer to go the unwrapping route (and don't mind the expensive software), I added the above comment, and with more related keywords someone who is thinking about all the possibilities is more likely to find your useful code. I am a noob to both blender and contributing to stackexchange, but I hope this page helps others. $\endgroup$
    – user56273
    Jul 22, 2016 at 15:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .