leht Posted October 26, 2018 Share Posted October 26, 2018 Hello, Could you tell me how to use the blend equation other than GL_FUNC_ADD and GL_FUNC_SUBTRACT? For example I want to use the GL_MIN and GL_MAX. I've read about the Material.alphaMode property but cannot find the suitable option for my case. Quote Link to comment Share on other sites More sharing options...
kcoley Posted October 26, 2018 Share Posted October 26, 2018 Hello @leht, is this doc useful?: https://doc.babylonjs.com/how_to/how_to_use_blend_modes Quote Link to comment Share on other sites More sharing options...
leht Posted October 29, 2018 Author Share Posted October 29, 2018 @kcoley It only tells about blend mode but doesn't tell about blend equation. I need a way to change blend equation from GL_FUNC_ADD to GL_MAX / GL_MIN. https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/glBlendEquation.xhtml Quote Link to comment Share on other sites More sharing options...
leht Posted October 29, 2018 Author Share Posted October 29, 2018 I find the function setAlphaEquationParameters(rgb: number, alpha: number) in class Engine but it isn't called anywhere. Could you call it in the setAlphaMode function in some way? Quote Link to comment Share on other sites More sharing options...
kcoley Posted October 29, 2018 Share Posted October 29, 2018 @leht gotcha, you can probably call setAlphaEquationParameters with an onBindObservable call on the material: let mat = new BABYLON.StandardMaterial("standard", scene); mat.onBindObservable = function() { engine.setAlphaEquationParameters(...); // pass parameters here } Spankied 1 Quote Link to comment Share on other sites More sharing options...
leht Posted October 30, 2018 Author Share Posted October 30, 2018 Thank you very much! It works. A bit correcting: we should call engine._alphaState.setAlphaEquationParameters(...) Do you think we need some clearer way to customize blend mode (blend equation, blend func parameters)? I think Material.alphaMode is easy to use but not enough. And do the trick like above seems quite ugly ... Quote Link to comment Share on other sites More sharing options...
Guest Posted October 30, 2018 Share Posted October 30, 2018 We could probably add more options here: https://github.com/BabylonJS/Babylon.js/blob/master/src/Engine/babylon.engine.ts#L3936 Feel free to do a PR to add more modes! I will merge it Quote Link to comment Share on other sites More sharing options...
leht Posted October 31, 2018 Author Share Posted October 31, 2018 Thanks @Deltakosh, Of course I can do a PR for some more options, but I think there will be not many people here need them, since those options are only for some special needs. (I'm working in the MIP / MinIP feature of a DICOM viewer medical application, not a video game.) Recently I worked with Three JS & they have a customBlending mode with separated methods for customizing blend equation & blend function parameters (https://threejs.org/docs/#api/en/constants/CustomBlendingEquations). Do you think we need a similar way for easier customization? Quote Link to comment Share on other sites More sharing options...
Guest Posted October 31, 2018 Share Posted October 31, 2018 yes definitely something we need Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.