BlitzMax - 生成 2D 霓虹灯发光线效果到 png 文件
我希望在 BlitzMax 中创建发光线效果,类似于星球大战光剑或激光束。不必是实时的,而只是 TImage 对象,然后可能保存为 PNG 以便以后在动画中使用。我很高兴使用 3D 功能,但它将用于 2D 游戏。
由于它将在黑色/太空背景上,我的策略是绘制一系列具有颜色和高透明度的白色模糊线,然后最终中心线不那么模糊并且更加白色。我要画的其实是贝塞尔曲线。绘制曲线很容易,但我无法使用上面的技术来创建良好的激光/霓虹灯效果,因为它看起来非常分段。因此,我认为最好在渲染良好的部分(即 1 像素贝塞尔曲线)上使用模糊效果/着色器。
我一直遇到的问题是:
- 将着色器仅应用于屏幕上绘制线条的特定区域。如果有一种方法可以在纹理上绘制线条,然后模糊该纹理并保存 png,那就太好了。一定有办法做到这一点,但我还没有让正确的元素一起工作。任何熟悉这些东西的人的帮助将不胜感激。
- 仅使用 2D 调用可能是有利的,更易于理解和重用。
- 如果知道如何保存保留透明度/alpha 内容的 PNG,那就太好了。
ps 我已经审阅了这篇文章(以及其他文章),让示例正常工作,甚至开发了我自己的 5x5 着色器。但是,它是 3D 和场景范围的东西,似乎不能很好地转换为 2D 或只是某个区域。 http://www.blitzbasic.com/Community/posts.php?topic=85263
I'm looking to create a glowing line effect in BlitzMax, something like a Star Wars lightsaber or laserbeam. Doesn't have to be realtime, but just to TImage objects and then maybe saved to PNG for later use in animation. I'm happy to use 3D features, but it will be for use in a 2D game.
Since it will be on black/space background, my strategy is to draw a series of white blurred lines with color and high transparency, then eventually central lines less blurred and more white. What I want to draw is actually bezier curved lines. Drawing curved lines is easy enough, but I can't use the technique above to create a good laser/neon effect because it comes out looking very segmented. So, I think it may be better to use a blur effect/shader on what does render well, which is a 1-pixel bezier curve.
The problems I've been having are:
- Applying a shader to just a certain area of the screen where lines are drawn. If there's a way to do draw lines to a texture and then blur that texture and save the png, that would be great to hear about. There's got to be a way to do this, but I just haven't gotten the right elements working together yet. Any help from someone familiar with this stuff would be greatly appreciated.
- Using just 2D calls could be advantageous, simpler to understand and re-use.
- It would be very nice to know how to save a PNG that preserves the transparency/alpha stuff.
p.s. I've reviewed this post (and others), have the samples working, and even developed my own 5x5 shader. But, it's 3D and a scene-wide thing that doesn't seem to convert to 2D or just a certain area very well.
http://www.blitzbasic.com/Community/posts.php?topic=85263
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,我不了解 BlitzMax,所以我无法详细介绍实现过程,但可以给您一些指导:
Ok, well I don't know about BlitzMax, so I can't go into much detail regarding implementation, but to give you some pointers: