A computer implement method of designing a refractive or reflective surface, comprising: providing a refractive or reflective object having a refractive or reflective surface with an initial geometry; discretizing the refractive or reflective surface with a mesh, the mesh representing incident illumination on the refractive or reflective surface of the refractive or reflective object, where each position x S of a vertex of the mesh comprises an incoming direction and an intensity value of a light ray; generating a Voronoi diagram of a set S of sites of the mesh on the refractive or reflective surface; discretizing a target surface with a mesh, wherein the positions of the vertices of the mesh and the ray directions are initialized from the refractive or reflective surface and the incident illumination; tracing rays from a light source through the refractive or reflective surface at the positions x S of the vertices of the mesh onto the receiver to obtain a piecewise linear representation of a source irradiance E S on the receiver, wherein each site of a set S of sites on the receiver approximately represents the same amount of flux Φ i; determining a target position x R on the receiver for each light ray that leaves the refractive or reflective surface of the refractive or reflective object such that the overall irradiance distribution on the receiver closely matches a target irradiance E T, and determining how each Voronoi cell C i of the Voronoi diagram on the refractive or reflective sur-face needs to be deformed and moved such that its flux Φ i is distributed to match the target distribution E T, the determining including: (i) determining normals on the refractive or reflective surface for each vertex of the mesh using Snell's law from the target positions x R on the receiver for each light ray; (ii) moving the vertices to best match the target surface normals while respecting the flux densities Φ i; iterating (i) and (ii); and integrating the normals on the refractive or reflective surface to obtain the optimized target surface. providing a refractive or reflective object having a refractive or reflective surface with an initial geometry; discretizing the refractive or reflective surface with a mesh, the mesh representing incident illumination on the refractive or reflective surface of the refractive or reflective object, where each position x S of a vertex of the mesh comprises an incoming direction and an intensity value of a light ray; generating a Voronoi diagram of a set S of sites of the mesh on the refractive or reflective surface; discretizing a target surface with a mesh, wherein the positions of the vertices of the mesh and the ray directions are initialized from the refractive or reflective surface and the incident illumination; tracing rays from a light source through the refractive or reflective surface at the positions x S of the vertices of the mesh onto the receiver to obtain a piecewise linear representation of a source irradiance E S on the receiver, wherein each site of a set S of sites on the receiver approximately represents the same amount of flux Φ i; determining a target position x R on the receiver for each light ray that leaves the refractive or reflective surface of the refractive or reflective object such that the overall irradiance distribution on the receiver closely matches a target irradiance E T, and determining how each Voronoi cell C i of the Voronoi diagram on the refractive or reflective sur-face needs to be deformed and moved such that its flux Φ i is distributed to match the target distribution E T, the determining including: (i) determining normals on the refractive or reflective surface for each vertex of the mesh using Snell's law from the target positions x R on the receiver for each light ray; (ii) moving the vertices to best match the target surface normals while respecting the flux densities Φ i; iterating (i) and (ii); and integrating the normals on the refractive or reflective surface to obtain the optimized target surface.