Giter VIP home page Giter VIP logo

Comments (7)

benikabocha avatar benikabocha commented on July 29, 2024

これは以下のような、レンダーテクスチャとアルファブレンドの問題だと思います。
https://qiita.com/luckin/items/43a8a98a88a3ba20e92b

解決方法は以下のようになります。

  1. Render Target(Render Texture) を (0.0, 0.0, 0.0 1.0) でクリアする
  2. Render Texture 描画時の Blend State を以下のように設定する
SrcBlend = D3D11_BLEND_SRC_ALPHA
DestBlend = D3D11_BLEND_INV_SRC_ALPHA
BlendOp = D3D11_BLEND_OP_ADD
SrcBlendAlpha = D3D11_BLEND_ZERO
DestBlendAlpha = D3D11_BLEND_INV_SRC_ALPHA
BlendOpAlpha  = D3D11_BLEND_OP_ADD
  1. Render Texture をデスクトップへ描画する際の Blend State を以下のように設定する
SrcBlend = D3D11_BLEND_ONE
DestBlend = D3D11_BLEND_INV_SRC_ALPHA
BlendOp = D3D11_BLEND_OP_ADD
SrcBlendAlpha = D3D11_BLEND_ONE
DestBlendAlpha = D3D11_BLEND_INV_SRC_ALPHA
BlendOpAlpha = D3D11_BLEND_OP_ADD

from saba.

WLiangJun avatar WLiangJun commented on July 29, 2024

アドバイスありがとうございます。あなたが提案したのはdx11のそのバージョンで、私はあなたが言った通りに変更しても元の問題です(上で述べた2つの問題と違い、上の問題はglfw sampleとsaba_viewerの存在する小さな問題です)。dx11とglfwの2つのsampleを試したんですが、枠と背景色を抜いてアルファブレンドするとおかしいです。これはdx11の問題です:
003
あなたにたくさんの質問をして申し訳ありませんが、本当に解決したいです。

from saba.

benikabocha avatar benikabocha commented on July 29, 2024

glfw の GLFW_TRANSPARENT_FRAMEBUFFER を使用しているみたいですね。

以下のように描画すればうまくいくかもしれません。

  1. FBO Texture へモデルを描画する
    SrcBlend = SrcAlpha
    DestBlend = InvSrcAlpha
    SrcBlendAlpha = Zero
    DestBlendAlpha = InvSrcAlpha
  2. 画面に、1で描画した Texture を描画する
    Blend を OFF に設定し、シェーダーで、
    Color = SrcColor / (1.0 - SrcAlpha)
    Alpha = (1.0 - SrcAlpha)
    として描画する。

今度、自分でも試してみます。

from saba.

WLiangJun avatar WLiangJun commented on July 29, 2024

ありがとうございます。確かにglfwのGLFW_TRANSPARENT_FRAMEBUFFERです。貴重なご提案ありがとうございます。何とかして、この問題を解決できるように頑張ります。私はコンピュータ関連の専門ではないので、この問題は私にとって難しい。時間とエネルギーがあれば試してみても、無理をする必要はありません。でも、後期の更新を楽しみにしています。

from saba.

benikabocha avatar benikabocha commented on July 29, 2024

@WLiangJun
glfw のサンプルに透明ウィンドウのオプションを追加しました。
888549e
simple_mmd_viewer_glfw -option -model -vmd

from saba.

WLiangJun avatar WLiangJun commented on July 29, 2024

ありがとうございます。ちょっと試してみましたが、あなたの助けで、ついにその二つの問題を解決しました。お忙しい中、わざわざcodeを修正していただきありがとうございます。

from saba.

benikabocha avatar benikabocha commented on July 29, 2024

解決できたとのことでよかったです。

from saba.

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.