vtk.js: display particular cells with alpha/transparency/opacity

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

vtk.js: display particular cells with alpha/transparency/opacity

Raimonds Vilums
Hi,

Is it possible to display cells with custom opacity for each cell?

Till now, I managed
1) set opacity to the actor (e.g., actor.getProperty().setOpacity(0.5))
2) color cells with solid colors, e.g:
  • vtk file contains CELL_DATA array of floats with 3 components for every color
  • mapper.setColorModeToDirectScalars();
  • mapper.setScalarModeToUseCellFieldData();
  • mapper.setColorByArrayName('my_cell_data');
But I could not find a way to set alpha/opacity/transparency for particular cells.
Is it possible?

Regards,
Raimonds
 

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
https://public.kitware.com/mailman/listinfo/vtkusers
Reply | Threaded
Open this post in threaded view
|

Re: vtk.js: display particular cells with alpha/transparency/opacity

David E DeMarle via vtkusers
You should be able to have an array with 4 components (RGBA)

On Thu, Dec 13, 2018 at 9:01 AM Raimonds Vilums <[hidden email]> wrote:
Hi,

Is it possible to display cells with custom opacity for each cell?

Till now, I managed
1) set opacity to the actor (e.g., actor.getProperty().setOpacity(0.5))
2) color cells with solid colors, e.g:
  • vtk file contains CELL_DATA array of floats with 3 components for every color
  • mapper.setColorModeToDirectScalars();
  • mapper.setScalarModeToUseCellFieldData();
  • mapper.setColorByArrayName('my_cell_data');
But I could not find a way to set alpha/opacity/transparency for particular cells.
Is it possible?

Regards,
Raimonds
 
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
https://public.kitware.com/mailman/listinfo/vtkusers

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
https://public.kitware.com/mailman/listinfo/vtkusers
Reply | Threaded
Open this post in threaded view
|

Re: vtk.js: display particular cells with alpha/transparency/opacity

Raimonds Vilums
I tried and got

index.js:441 Uncaught (in promise) TypeError: Cannot add property 3, object is not extensible
    at Object.publicAPI.rGBAToRGBA (index.js:441)
    at Object.publicAPI.convertToRGBA (index.js:487)
    at Object.publicAPI.mapScalars (index.js:238)
    at Object.publicAPI.mapScalars (index.js:272)



On Thu, Dec 13, 2018 at 6:10 PM Sebastien Jourdain <[hidden email]> wrote:
You should be able to have an array with 4 components (RGBA)

On Thu, Dec 13, 2018 at 9:01 AM Raimonds Vilums <[hidden email]> wrote:
Hi,

Is it possible to display cells with custom opacity for each cell?

Till now, I managed
1) set opacity to the actor (e.g., actor.getProperty().setOpacity(0.5))
2) color cells with solid colors, e.g:
  • vtk file contains CELL_DATA array of floats with 3 components for every color
  • mapper.setColorModeToDirectScalars();
  • mapper.setScalarModeToUseCellFieldData();
  • mapper.setColorByArrayName('my_cell_data');
But I could not find a way to set alpha/opacity/transparency for particular cells.
Is it possible?

Regards,
Raimonds
 
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
https://public.kitware.com/mailman/listinfo/vtkusers

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
https://public.kitware.com/mailman/listinfo/vtkusers
Reply | Threaded
Open this post in threaded view
|

Re: vtk.js: display particular cells with alpha/transparency/opacity

David E DeMarle via vtkusers
Can you do a codepen and share it so I can see what you are doing exactly?

On Thu, Dec 13, 2018 at 9:26 AM Raimonds Vilums <[hidden email]> wrote:
I tried and got

index.js:441 Uncaught (in promise) TypeError: Cannot add property 3, object is not extensible
    at Object.publicAPI.rGBAToRGBA (index.js:441)
    at Object.publicAPI.convertToRGBA (index.js:487)
    at Object.publicAPI.mapScalars (index.js:238)
    at Object.publicAPI.mapScalars (index.js:272)



On Thu, Dec 13, 2018 at 6:10 PM Sebastien Jourdain <[hidden email]> wrote:
You should be able to have an array with 4 components (RGBA)

On Thu, Dec 13, 2018 at 9:01 AM Raimonds Vilums <[hidden email]> wrote:
Hi,

Is it possible to display cells with custom opacity for each cell?

Till now, I managed
1) set opacity to the actor (e.g., actor.getProperty().setOpacity(0.5))
2) color cells with solid colors, e.g:
  • vtk file contains CELL_DATA array of floats with 3 components for every color
  • mapper.setColorModeToDirectScalars();
  • mapper.setScalarModeToUseCellFieldData();
  • mapper.setColorByArrayName('my_cell_data');
But I could not find a way to set alpha/opacity/transparency for particular cells.
Is it possible?

Regards,
Raimonds
 
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
https://public.kitware.com/mailman/listinfo/vtkusers

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
https://public.kitware.com/mailman/listinfo/vtkusers
Reply | Threaded
Open this post in threaded view
|

Re: vtk.js: display particular cells with alpha/transparency/opacity

Raimonds Vilums

After load, you can see colored cells without transparency (3-component array).

For loading 4-component array, change array name on line 187
from mapper.setColorByArrayName('rgbData');
to mapper.setColorByArrayName('rgbaData');
which does not work.

Raimonds


On Thu, Dec 13, 2018 at 6:59 PM Sebastien Jourdain <[hidden email]> wrote:
Can you do a codepen and share it so I can see what you are doing exactly?

On Thu, Dec 13, 2018 at 9:26 AM Raimonds Vilums <[hidden email]> wrote:
I tried and got

index.js:441 Uncaught (in promise) TypeError: Cannot add property 3, object is not extensible
    at Object.publicAPI.rGBAToRGBA (index.js:441)
    at Object.publicAPI.convertToRGBA (index.js:487)
    at Object.publicAPI.mapScalars (index.js:238)
    at Object.publicAPI.mapScalars (index.js:272)



On Thu, Dec 13, 2018 at 6:10 PM Sebastien Jourdain <[hidden email]> wrote:
You should be able to have an array with 4 components (RGBA)

On Thu, Dec 13, 2018 at 9:01 AM Raimonds Vilums <[hidden email]> wrote:
Hi,

Is it possible to display cells with custom opacity for each cell?

Till now, I managed
1) set opacity to the actor (e.g., actor.getProperty().setOpacity(0.5))
2) color cells with solid colors, e.g:
  • vtk file contains CELL_DATA array of floats with 3 components for every color
  • mapper.setColorModeToDirectScalars();
  • mapper.setScalarModeToUseCellFieldData();
  • mapper.setColorByArrayName('my_cell_data');
But I could not find a way to set alpha/opacity/transparency for particular cells.
Is it possible?

Regards,
Raimonds
 
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
https://public.kitware.com/mailman/listinfo/vtkusers

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
https://public.kitware.com/mailman/listinfo/vtkusers
Reply | Threaded
Open this post in threaded view
|

Re: vtk.js: display particular cells with alpha/transparency/opacity

David E DeMarle via vtkusers
Thanks for doing this. Indeed I see the issue and reported a bug here:


On Fri, Dec 14, 2018 at 3:22 AM Raimonds Vilums <[hidden email]> wrote:

After load, you can see colored cells without transparency (3-component array).

For loading 4-component array, change array name on line 187
from mapper.setColorByArrayName('rgbData');
to mapper.setColorByArrayName('rgbaData');
which does not work.

Raimonds


On Thu, Dec 13, 2018 at 6:59 PM Sebastien Jourdain <[hidden email]> wrote:
Can you do a codepen and share it so I can see what you are doing exactly?

On Thu, Dec 13, 2018 at 9:26 AM Raimonds Vilums <[hidden email]> wrote:
I tried and got

index.js:441 Uncaught (in promise) TypeError: Cannot add property 3, object is not extensible
    at Object.publicAPI.rGBAToRGBA (index.js:441)
    at Object.publicAPI.convertToRGBA (index.js:487)
    at Object.publicAPI.mapScalars (index.js:238)
    at Object.publicAPI.mapScalars (index.js:272)



On Thu, Dec 13, 2018 at 6:10 PM Sebastien Jourdain <[hidden email]> wrote:
You should be able to have an array with 4 components (RGBA)

On Thu, Dec 13, 2018 at 9:01 AM Raimonds Vilums <[hidden email]> wrote:
Hi,

Is it possible to display cells with custom opacity for each cell?

Till now, I managed
1) set opacity to the actor (e.g., actor.getProperty().setOpacity(0.5))
2) color cells with solid colors, e.g:
  • vtk file contains CELL_DATA array of floats with 3 components for every color
  • mapper.setColorModeToDirectScalars();
  • mapper.setScalarModeToUseCellFieldData();
  • mapper.setColorByArrayName('my_cell_data');
But I could not find a way to set alpha/opacity/transparency for particular cells.
Is it possible?

Regards,
Raimonds
 
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
https://public.kitware.com/mailman/listinfo/vtkusers

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
https://public.kitware.com/mailman/listinfo/vtkusers