I have an image that is rendered as a vtkImageActor in a 3D scene. The image data [0-255] is inside a know geometry and surounded by 0 value pixels. As you’d imaging when being rendered, the image is rendered as a rectangle (WxH). Id like to only render the image pixels that are inside the geometry rather the entire rectangular image. How do I go about it? I tried a couple of approches (albeit quick and dirty) and didnt have much luck.
Are you grabbing the image from the render? If so, you could set the background to be green, for instance, and set all of the completely green pixels to transparent. The “right way” to do this will depend on how you are rendering the scene.
Is your image a billboard that always faces the user? vtkLogoWidget, vtkLogoRepresentation might help.
Is it some flat surface that needs to have the image on it? You might be able to set the image as a texture on the surface.
@rexthor my image comes in from a buffer via vtkImageImport, so the data/texture is pre-render. It is also not a billboard and has a 3D pose that needs to be rendered in a 3D scene. I will retry the texture mapping method as you and @dgobbi suggested and report back. This was also my intuition but I didnt have too much success in the limited attempts I made. I might have follow up questions.