Kitware / vtk-js

Visualization Toolkit for the Web
https://kitware.github.io/vtk-js/
BSD 3-Clause "New" or "Revised" License
1.24k stars 380 forks source link

Source to mapper? #2013

Closed zbouslikhin closed 3 years ago

zbouslikhin commented 3 years ago

Hello,

Need

I'm currently visualizing a bunch of XYZ points. However, I'd like to also visualize these points as flat circles. There exists the circleSource filter to create a single circle - I'd like to have as many as the number of points (stored in a single polydata) I have to visualize as circles I was wondering if there's any way to say, pass in an array full of xyz data or a polydata to a source or filter element and then map them into a single mapper? Or whether there's any other trick to have ~1million flat circles displayed?

Feature

Map filter or source into a single mapper

finetjul commented 3 years ago

You might want to consider the GlypMapper. See an example here.

zbouslikhin commented 3 years ago

Oh great! @finetjul Thanks for the info.

Looks like I didn't fully get how glyph3Dmapper works. Here is how I'm doing it right based on that example:

const flatActor = vtkActor.newInstance()
const flatMapper = vtkGlyph3DMapper.newInstance()
const circleSource = vtkCircleSource.newInstance({ radius: 10, resolution: 100 });
flatMapper.setInputData(myPolydata, 0) //myPolydata holds the xyz positions as well as the scalars
flatMapper.setInputConnection(circleSource.getOutputPort(), 1);
flatActor .setMapper(flatMapper)
renderer.addActor(flatActor)

However, it doesn't return circles as expected.

finetjul commented 3 years ago

it doesn't return circles as expected.

Can you give more description of what's going on ? Maybe they are not oriented correctly. Have you tried with a sphere instead of a circle ?

zbouslikhin commented 3 years ago

Works all fine now. It had something to do with profiles. importing the following solved it import 'vtk.js/Sources/Rendering/Profiles/All'; However, there's another problem with vtkGlpyh3DMapper. It's exactly the same as #1921

finetjul commented 3 years ago

I'm closing this issue and discussion should be followed on #1921