菜鸟教程小白 发表于 2022-12-11 20:26:09

ios - 当笔画在 Metal 中相互交叉时混合


                                            <p><p>我绘制以固定间隔重叠的小方 block ,这样感觉就像在绘图应用程序中的纹理刷。 </p>

<p>目前我使用管道描述符</p>

<pre><code>pipelineDescriptor.colorAttachments.rgbBlendOperation = .add
pipelineDescriptor.colorAttachments.alphaBlendOperation = .add
pipelineDescriptor.colorAttachments.sourceRGBBlendFactor = .sourceAlpha
pipelineDescriptor.colorAttachments.sourceAlphaBlendFactor = .one
pipelineDescriptor.colorAttachments.destinationRGBBlendFactor = .oneMinusSourceAlpha
pipelineDescriptor.colorAttachments.destinationAlphaBlendFactor = .oneMinusSourceAlpha
</code></pre>

<p>我的目标是当两个笔画相互交叉时,我想在 OpenGL 中添加一种类似于混合模式的白色</p>

<p>我附上了一张我目前得到的照片。</p>

<p> <a href="/image/13F5B.jpg" rel="noreferrer noopener nofollow"><img src="/image/13F5B.jpg" alt="enter image description here"/></a> </p>

<p>当斯托克斯交叉时,它应该显示为白色。</p>

<p>建议一种实现方式</p></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>您似乎没有在 MTLRenderPipelineColorAttachmentDescriptor 上设置 blendingEnabled 属性。此外,请确保您使用的是 sRGB 纹理,以便采样器知道如何在混合时将 8 位值解码为线性光。</p></p>
                                   
                                                <p style="font-size: 20px;">关于ios - 当笔画在 Metal 中相互交叉时混合,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/51701272/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/51701272/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: ios - 当笔画在 Metal 中相互交叉时混合