变换整个 Cocos2d 层以模拟 X 射线外观
我正在使用 Cocos2d 构建 iPad 应用程序。
我想将整个图层(及其所有子精灵)转换为看起来有点像 X 射线的东西。也就是说,黑白图像,白色有点发光。
我希望你们中的一个图形人员有一个或两个想法。 :-)
I am building an iPad app with Cocos2d.
I would like to transform an entire layer (and all its child sprites) to something that appears a little bit x-ray-ish. That is, a black and white image, with the white glowing a bit.
I hope one of you graphics guys has an idea or two. :-)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
以下是我如何实现一个动态解决方案,该解决方案只是有点 X 射线(我认为它实际上更接近图像的反转)。我无法预处理图像,因为我必须根据游戏层的当前状态创建奇怪的图像。
这一切都是使用 Cocos2d 完成的:
我为我的场景创建了两个图层。一层是主要游戏层,另一层是效果层。主游戏层是 CCLayer 的子类。效果图层是 CCColorLayer 的子类。
效果层的 z 顺序高于主游戏层,即效果层位于游戏层之上。
然后,我使用两种不同的混合模式将外观从正常更改为 X 射线。
小代码
Here is how I implemented a dynamic solution that is only a bit x-rayish (I think it is actually more closer to the the inverse of the image). I could not pre-process images, because I had to create the weird image from the current state of the game layer.
This was all done using Cocos2d:
I created two layers for my scene. One layer is the main game layer, the other layer is an effect layer. The main game layer is subclassed from CCLayer. The effect layer is subclassed from CCColorLayer.
The effect layer is at a higher z-order than the main game layer, that is, the effect layer is above the game layer.
I then used two different blending modes to change the appearance from normal to x-rayish.
Code-let
在考虑 RGB 图像 A 时,我想到了这一点。
(我已经使用它进行了测试) ImageJ 它可以是一种方式,即使是一种糟糕的方式,也决不会显示出骨骼效应)
(*)您还可以在卷积中使用微分矩阵(例如 Sobel 的) 由于我不是图形设计师,我最好发布
我所做的示例,以节省您的时间:
(似乎缩略图不可“点击”)
这些是单一链接:
This comes to my mind while considering an RGB Image A.
(I've tested it with ImageJ and it can be a way, even if a poor one, in no way it will show a skeletal effect)
(*) You could also use a differential matrix (like Sobel's) in a convolution filter
Since I'm not a graphic designer I'd better post the example I worked on to make you save time:
(Seems like the thumbnails are not 'clickable')
These are the singular links: