为什么当相机移动纹理闪烁? [英] Why do textures flicker when camera moves?

查看:231
本文介绍了为什么当相机移动纹理闪烁?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我实现了一个与播放器一起移动的顶视图摄像机,使用 camera.position.lerp 只有一点慢。问题是纹理是闪烁(闪烁)一点,因为我已经缩放我的纹理。如果我使用正常尺寸的纹理,闪烁停止。有没有人有任何想法如何移动相机缩放(或纹理缩放 - 相同的东西),而不使纹理闪烁(或闪烁)?我使用线性过滤和加载每个资产从图集。我在多个论坛上看到这个问题,但没有答案。我想要加载更高分辨率的纹理,并在代码中调整它们的大小,这就是为什么我要问这个问题。

解决方案

你的精灵在阿特拉斯的边界。 i.stack.imgur.com/tXFdj.pngalt =在TexturePacker中拉伸>



大多数纹理包装器支持该功能,Libgdx将从 atlas 档案。



这样您就可以使用所需的筛选器。


I implemented a top view camera which moves with the player, only a bit slower using camera.position.lerp. The problem is that the textures are flashing (flickering) a little because i have scaled my textures. If I use normal size of textures the flickering stops. Does anyone have any ideas on how to move the camera with zoom (or textures scaled - same thing) without getting the textures to flicker (or flash)? I use linear filtering and load every asset from an atlas. I saw this problem on multiple forums, but no answer. I wanted to load higher resolution textures and resize them in code, that's why I am asking this question.

解决方案

You need to extrude the borders of your sprites in the atlas. The Extrude option tends to be close to the Padding ones.

Most texture packers support that feature and Libgdx will pick that information up from the atlas file straight away.

This way you get to use the filter you want.

这篇关于为什么当相机移动纹理闪烁?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆