Read PLY and texture

Hello,

I have a ply file and the realated texture in a separate JPG file. How can I render the 3D window the model with the colors?

var filename = Path.Combine(basePath, "lower.ply");
var filenameTexture = Path.Combine(basePath, "lower.jpg");

var textureFile = vtkImageReader2.New();
textureFile.SetFileName(filenameTexture);
textureFile.Update();

var atext = vtkTexture.New();
atext.SetInputConnection(textureFile.GetOutputPort());
atext.InterpolateOn();

var reader = new vtkPLYReader();
reader.SetFileName(filename);
reader.Update();

var mapper = vtkPolyDataMapper.New();
mapper.SetInputConnection(reader.GetOutputPort());
mapper.ScalarVisibilityOn();
mapper.Update();

var actor = vtkActor.New();
actor.SetMapper(mapper);
actor.SetTexture(atext);

Renderer.AddActor(actor);

@LucasGandel

Thank you.

Hello,

I believe your code is missing a vtkRenderWindow. Please, take a look at these examples: https://www.programcreek.com/python/example/9480/vtk.vtkRenderWindow

take care,

Paulo