Generating and saving a mesh

115 views
Skip to first unread message

Masa Stanisavljevic

unread,
Aug 22, 2020, 7:40:28 PM8/22/20
to scalismo-faces
I want to generate a mesh from the Basel Face Model and save it in a .ply file, so that I can use another rendering engine to render a face image based on the mesh. Can this be done with the code available in this repo? If so, how would one go about this? Thank you in advance!

Bernhard Egger

unread,
Aug 22, 2020, 7:58:21 PM8/22/20
to Masa Stanisavljevic, scalismo-faces
Sure - in few lines of code:
import java.io.File

import scalismo.faces.io.{MeshIO, MoMoIO}
import scalismo.utils.Random

object RenderMesh extends App {
scalismo.initialize()
val seed = 1986L
implicit val rnd = Random(seed)

val model = MoMoIO.read(new File("/path/to/baselFaceModel.h5")).get
val instance = model.sample()
MeshIO.write(instance, new File("/out/path/mesh.ply"))
}
If you are not interested in lots of model instances you might also just use our model-viewer GUI?
Its a simple java executable and you can write out a ply-file

readme is here:

Best
Bernhard

--
0 1 0
0 0 1
1 1 1


On Sat, Aug 22, 2020 at 7:40 PM Masa Stanisavljevic <masa.stan...@gmail.com> wrote:
I want to generate a mesh from the Basel Face Model and save it in a .ply file, so that I can use another rendering engine to render a face image based on the mesh. Can this be done with the code available in this repo? If so, how would one go about this? Thank you in advance!

--
You received this message because you are subscribed to the Google Groups "scalismo-faces" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scalismo-face...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/scalismo-faces/3fd1470c-f376-44a1-8f52-5d45f0362141n%40googlegroups.com.

Masa Stanisavljevic

unread,
Aug 23, 2020, 2:39:01 PM8/23/20
to scalismo-faces
Hi, 
Thank you for your prompt response. I used the model-viewer GUI to generate a few meshes. However, the .ply documents do not contain information about the colors of the faces. How can I save those as well? 
Thank you

Bernhard Egger

unread,
Aug 23, 2020, 3:02:05 PM8/23/20
to Masa Stanisavljevic, scalismo-faces
They should?
It writes vertex colored meshes and you can visualize them using meshlab

Reply all
Reply to author
Forward
0 new messages