Projection

There are two ways to make projections in Imagexd. The first way is classic raytracing (render). In this method, rays are traced backwards by a camera and objects are detected. The second way works the other in reverse (projection). It emits the rays from the objects and these are projected onto a surface.


PLY-File    

OBJ-File (UV-Map)


Projection

▸ ImageXd

mesh.load "Scapula.obj"

image.32bit
image.use cylinder
image.new 4711 1500

image.use plane
image.new 2000 2000

image.32bit
image.use uv
image.load "uv.png"

// Tube
image.use uv
mesh.projection.uv.back true
mesh.projection.uv.fill.holes 3 2
cylinder := mesh.projection.uv.tube <0,80,0> <0,-160,0> <-100,0,0> <0,0,100>
image.use cylinder
image.save "cylinder.png"

// Plane
image.use uv
mesh.projection.uv.fill.holes 3 2
plane := mesh.projection.uv <-1,80,80> <0,-160,0> <0,0,-160> // front
//plane := mesh.projection.uv <80,80,1> <0,-160,0> <-160,0,0> // side
//plane := mesh.projection.uv <80,80,-1> <0,-160,0> <-160,0,0> // side
//plane := mesh.projection.uv <1,80,80> <0,-160,0> <0,0,-160> // back
image.use plane
image.save "plane.png"

▸ More details

mesh.projection.uv.back false // false (default) ignore negative depth values (background / reverse side)
mesh.projection.uv.fill.holes 1 2 // interations: 1 (default) neighbors: 2 (default) // neighbors sides 1..4 or corners 1..4
new := mesh.projection.uv.orientation <1600,900> // draw mesh uv orientation into image
new := mesh.projection.uv <-20,-11,-11> <0,22,0> <0,0,22> // (basepoint, up, rigth) draw mesh uv into image
new := mesh.projection.uv.tube <0,11,0> <0,-22,0> <-11,0,0> <0,0,11> // (basepoint, height, r1, r2) draw mesh uv into image                                                                                      


Render (takes a lot of time)

▸ ImageXd

thread.max := 4

size := <2827, 900>

mesh.use new
mesh.add.camera.tube size
mesh.save "tube.obj"
mesh.scale <100,100,200>
mesh.rotate <0,0,1.5707>
//mesh.normal.flip

mesh.use old
mesh.load "Scapula.ply"
//mesh.set.pivot.center
//mesh.center

new := mesh.render.color
mesh.use new
mesh.save "projection.ply"

image.rgba
image.clean
mesh.projection.color size
image.save "projection.png"

size := <1000, 1000>

mesh.use new
mesh.clean // clean from tube
mesh.add.camera size
mesh.save "plane.obj"
mesh.scale <200,200,200>
mesh.rotate <0,1.5707,0>
mesh.translate <50,0,0>
mesh.normal.flip

mesh.use old
new := mesh.render.color
mesh.use new
mesh.save "projection_plane.ply"

image.rgba
image.clean
mesh.projection.color size
image.save "projection_plane.png"

▸ More details

mesh.add.camera <1600,900>
mesh.add.camera.focus <1600,900> <0,0,1>
mesh.add.camera.tube <1600,900>
mesh.add.camera.tube.focus <1600,900> <0,0,0>
new := mesh.render // projection of colors and depths on new mesh (camera) colors and normals
new := mesh.render 100 // projection of colors and depths with limit ray length 100
new := mesh.render.color // projection of colors on new colors
new := mesh.render.depth // projection of depths on new normals
mesh.projection.color <1600,900> // draw mesh color into image (see camera)