Giter Site home page Giter Site logo

WebXR AR - Opacity Blending about engine HOT 2 OPEN

Maksims avatar Maksims commented on May 24, 2024
WebXR AR - Opacity Blending

from engine.

Comments (2)

slimbuck avatar slimbuck commented on May 24, 2024 1

Just to add, material blend modes currently set alpha blend state to match color blend state. NORMAL blend state is:

this._blendState.setAlphaBlend(BLENDEQUATION_ADD, BLENDMODE_SRC_ALPHA, BLENDMODE_ONE_MINUS_SRC_ALPHA);

See here.

from engine.

slimbuck avatar slimbuck commented on May 24, 2024

Yeah this is a general rendering issue (not specific to GS) when generating any render target that will be blended with premulitplied alpha. The problem is material's "normal" blending type must be changed to accommodate premultiplied alpha render target.

You could change all the alpha blended materials in your scene, but this is hugely cumbersome. Ideally the engine would natively support a Premultiplied Render Target mode or similar and handle it internally.

I've solved problem this in the past by monkey-patching Material.blendType setter to modify the resulting alpha blend:

this._blendState.setAlphaBlend(BLENDEQUATION_ADD, BLENDMODE_ONE, BLENDMODE_ONE_MINUS_SRC_ALPHA);

Not a great solution.

I wonder whether we could change the NORMAL blend type to output premultiplied alpha values like above. The current NORMAL blend type doesn't generate a useful alpha channel anyway and I don't think developers will be depending on it.

cc @mvaligursky

from engine.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.