google / filament

Filament is a real-time physically based rendering engine for Android, iOS, Windows, Linux, macOS, and WebGL2
https://google.github.io/filament/
Apache License 2.0
17.75k stars 1.88k forks source link

Blending Mode Configuration #7646

Open wddl opened 7 months ago

wddl commented 7 months ago

Is your feature request related to a problem? Please describe. The blending mode of custom material I need is specified as follows: mRasterState.blendFunctionSrcRGB = BlendFunction::ONE_MINUS_DST_ALPHA; mRasterState.blendFunctionSrcAlpha = BlendFunction::ONE_MINUS_DST_ALPHA; mRasterState.blendFunctionDstRGB = BlendFunction::ONE; mRasterState.blendFunctionDstAlpha = BlendFunction::ONE; However, the engine's default blending mode does not have this option. The default settings are: mRasterState.blendFunctionSrcRGB = BlendFunction::ONE; mRasterState.blendFunctionSrcAlpha = BlendFunction::ONE; mRasterState.blendFunctionDstRGB = BlendFunction::ONE_MINUS_SRC_ALPHA; mRasterState.blendFunctionDstAlpha = BlendFunction::ONE_MINUS_SRC_ALPHA; mRasterState.depthWrite = false; When I modify the source code to use the required mode, the image displays as a black screen and does not render correctly. Could you please advise on how to proceed?

Describe the solution you'd like can support the blend mode set to mRasterState.blendFunctionSrcRGB = BlendFunction::ONE_MINUS_DST_ALPHA; mRasterState.blendFunctionSrcAlpha = BlendFunction::ONE_MINUS_DST_ALPHA; mRasterState.blendFunctionDstRGB = BlendFunction::ONE; mRasterState.blendFunctionDstAlpha = BlendFunction::ONE;

Describe alternatives you've considered How to modify the source code to support the above blending mode?

OS and backend

romainguy commented 7 months ago

What are you trying to achieve?

wddl commented 7 months ago

@romainguy I am trying rendering point cloud with 'Gaussian splatting' method. The blending mode for this algorithm is gl.blendFuncSeparate( gl.ONE_MINUS_DST_ALPHA, gl.ONE, gl.ONE_MINUS_DST_ALPHA, gl.ONE, );, but the engine does not have this option."