简体   繁体   English

如何在opengl中创建玻璃效果?

[英]How do I create a Glass effect in opengl?

I want to create an Effect in opengl that works a bit like windows aero but in a 3D environment to make frosted glass more realistic. 我想在opengl中创建一个效果类似于Windows Aero的效果,但是要在3D环境中使磨砂玻璃更加逼真。 But even after hours of searching I couldn't find a solution. 但是即使经过数小时的搜索,我仍然找不到解决方案。

I'd recommend starting by blurring your glass (Here I'm assuming your glass texture is an RGBA texture, ie, its partially translucent) by using a Gaussian Filter . 我建议您先使用高斯滤镜来模糊您的玻璃(此处假设您的玻璃纹理是RGBA纹理,即它的部分半透明)。 This would have to be done in a shader as you want whatever is behind the glass to be blurred as well. 您必须在着色器中完成此操作,因为您还希望玻璃后面的任何东西也要模糊。 Then blend a white color with the resulting texture. 然后将白色与生成的纹理混合。 To make it look better, have the white color be "strongest" at the edges of the texture and get progressively weaker towards the middle. 为了使其看起来更好,使白色在纹理的边缘“最强”,并逐渐向中间变弱。 Linear Interpolation would help with this. 线性插值将对此有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM