iTwin / itwinjs-core

Monorepo for iTwin.js Library
https://www.itwinjs.org
MIT License
599 stars 210 forks source link

Support transparent thematic gradient settings #6241

Closed markschlosseratbentley closed 9 months ago

markschlosseratbentley commented 9 months ago

Discussed in https://github.com/iTwin/itwinjs-core/discussions/6212

ThematicGradientSettings is used both for thematic display (colorizing based on implicit properties like elevation or normal) and scientific visualization (colorizing based on auxiliary polyface scalar data). In both cases, the alpha channel of the gradient's color keys is ignored - the transparency is determined by the surface color's alpha channel alone.

Proposal: add a transparencyMode to ThematicGradientSettings of enum type with two initial options:

The latter will behave the same as material alpha does, and address the request. In future we may find a need for additional transparency modes.

We will have to handle the case in which between the surface alpha and the gradient colors we have a mix of opaque and translucent colors. That will require drawing in both passes and discarding in one based on the alpha computed in the shader. We do the same thing for textures that contain a mix of fully-opaque and semi-transparent pixels, keying off of the HasTexture surface bit flag.

pmconne commented 9 months ago

@markschlosseratbentley I modified your issue description with a proposed solution.