简体   繁体   English

从纹理图集进行渲染时,我的纹理正在相互渗透

[英]My textures are bleeding into one another when rendering from a texture atlas

I am using an texture map, by which I mean a composite of several texture images. 我使用的是纹理贴图,是指几个纹理图像的合成。 See here: 看这里:

imageMap

When I use part of this image map as a texture, however, I get some 'bleed' from the parts immediately to either side of it. 但是,当我将该图像贴图的一部分用作纹理时,我会立即从这些部分的任一侧获得一些“出血”。 See here: 看这里:

在此处输入图片说明

You can (just!) see that the red and yellow images on either side are appearing. 您可以(只是!)看到两侧都出现了红色和黄色的图像。

I am guessing that this is caused by re-sampling, which effectively blurs the texture map. 我猜这是由重新采样引起的,它实际上使纹理贴图模糊。 When a specific part of the blurred texture map is then used, the result is this bleeding effect. 当使用模糊纹理贴图的特定部分时,结果就是这种渗色效果。

Is there any way to avoid this, aside from simply not using image maps at all? 除了根本不使用图像映射之外,还有什么方法可以避免这种情况?


Update 更新资料

There are two triangles being used for the shape, as you would expect. 正如您所期望的,有两个三角形用于该形状。 The texture coordinates I am using are (if I recall correctly): 我使用的纹理坐标是(如果我没记错的话):

[0.50, 0.75]
[0.75, 0.75]
[0.75, 1.00]

[0.75, 1.00]
[0.50, 1.00]
[0.50, 0.75]

These pick out the image one to the left of the top left of the image map. 这些挑选出图像图左上角左一的图像。

I should answer my own question for the benefit of others who might come here. 我应该回答自己的问题,以使其他可能来这里的人受益。 In fact, the answer is effectively given here: 实际上,答案在这里是有效的:

https://gamedev.stackexchange.com/questions/46963/how-to-avoid-texture-bleeding-in-a-texture-atlas?newreg=0dbdf79fa0214a718ac7cd38488c56df https://gamedev.stackexchange.com/questions/46963/how-to-avoid-texture-bleeding-in-a-texture-atlas?newreg=0dbdf79fa0214a718ac7cd38488c56df

Basically, texture coordinates must be centred on the middle of texels, not the edges and, importantly, mipmapping must be turned off. 基本上,纹理坐标必须位于纹理像素的中心,而不是边缘的中心,而且重要的是,必须禁用mipmapping。

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

相关问题 使用 drawImage 从 Tile Sheet、Sprite Sheet 或 Texture Atlas 绘制多个图像时,如何防止纹理出血? - How Can I Prevent Texture Bleeding When Using drawImage To Draw Multiple Images From A Tile Sheet, Sprite Sheet, Or Texture Atlas? 从一个纹理文件获取单独的纹理 - Get Separate Textures from One Texture File 当他们不应该出现时,我的div正在流血 - My divs are bleeding when they shouldn't be 如何使用Javascript从纹理图集获取图像? - How to get images from a texture atlas with Javascript? 在 Phaser 3 中使用 tilemap 时如何阻止我的 tile 流血? - How do I stop my tiles from bleeding when using a tilemap in Phaser 3? Three.js 没有从我的星球构造函数 function 渲染我的纹理 - Three.js is not rendering my textures from my planet constructor function 如何在 mongo atlas 中将数据库从一个 mongodb 帐户(1 gmail id)转移到另一个帐户? - How to transfer database from one mongodb account(1 gmail id) to another, in mongo atlas? 渲染为FBO纹理时,纹理坐标略有偏离 - Texture Coordinates are slightly off when rendering to FBO texture 将一个组件渲染到另一个组件 - Rendering one component into another 当我尝试将 Object 从 api 添加到我的 mongodb atlas db NODE.JS 时,我变得不确定 - I get undefined when i try to add an Object from an api to my mongodb atlas db NODE JS
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM