有可能在iPhone上做一个漂亮的布隆过滤器吗?
我正在开发一款带有简单矢量图形的 iPhone 游戏,如果屏幕上的对象发光(即在渲染中应用了布隆过滤器),它看起来会特别漂亮。
我对后处理技术相当陌生,我正在阅读的大多数教程都使用 GPU 上的着色器。 我只是想知道这在 iPhone 硬件上是否可行,或者是否全部都必须在软件中完成(在这种情况下,我认为实时使用会太慢)。
I'm working on an iPhone game with simple vector graphics and though it would look extra nice if the objects on screen glowed (i.e. had a bloom filter applied to the render).
I'm fairly new to post-processing techniques and most of the tutorials I'm reading utilize shaders on the GPU. I'm just wondering if this is possible on the iPhone hardware, or if it would all have to be done in software (in which case I assume it would be far too slow to use real time).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
即使在 es1 设备上这也是绝对可能的。
1) 渲染到纹理照明的几何体,该几何体应在黑色背景上呈现为纯白色。 例如,如果相机在房间里看着窗户,并且您希望窗户绽放 - 仅将窗户渲染为纯白色,不渲染纹理。
2) 创建该纹理的多个副本,每个副本缩小到先前大小的一半
3) 使用加法混合将所有这些纹理拉伸到渲染场景顶部的全屏,调整每一层的 alpha 直到获得质量本质
上,步骤 2 和步骤 3 所做的是使用本机纹理过滤在硬件中模拟高斯模糊。
所以你所拥有的是你的光源几何形状为黑底白字,高斯模糊,然后添加到你的场景中 - 瞧,假绽放:)
This is definitely possible on even es1 devices.
1) Render to texture lit geometry that should bloom as pure white on a black background. For example if the camera is in a room looking at a window and you want the window to bloom - render only the window, without textures, as pure white.
2) Create several copies of this texture each one scaled down to half of the previous size
3) Render all these textures stretched to full screen over the top of your rendered scene using additive blending, adjust the alpha of each layer til you get the quality you're looking for
Essentially what steps 2 and 3 are doing is emulating a gaussian blur in hardware using the native texture filtering.
So what you have is your light source geometry as white on black, gaussian blurred and then added to your scene - voila fake bloom :)
由于 iPhone 根本不支持着色器,我认为布隆过滤器很难实现。 一些多通道技巧可能会根据场景产生令人信服的模仿,但可能太慢。
此外,游戏“edge”似乎在暂停屏幕上使用了绽放效果,但它是静态的,因此可能是在软件中实现的。
Since the iPhone doesn't support shaders at all, I think a bloom filter would be very difficult to implement. Some multipass trickery could result in a convincing imitation depending on the scene, but might be too slow.
Also, the game "edge" appears to use a bloom effect on the pause screen, but it's static so it's probably implemented in software.
您可以随时拍摄屏幕截图并将其稍微模糊喜欢这篇文章,然后使用添加剂混合,可能有用吗?
You could always take a screenshot and blur it a little like on this post and then just use additive blending, might work?