将矩形图像数据打包成方形纹理

编程入门 行业动态 更新时间:2024-10-22 20:33:54
本文介绍了将矩形图像数据打包成方形纹理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有N个2D图像数据,它们是矩形的,我想尽可能有效地将它们打包成2个纹理的单个幂。

I have N items of 2D image data that will be rectangular and I want to pack them into a single power of 2 texture as efficiently as possible.

一个简单的非常有效和天真地实现一个算法来打包这些rects很容易鞭打,但我相信人们已经提出算法来尽可能地节省空间。我发现了与光照贴图类似的各种参考,它与我正在寻找的相似,但是光照贴图的算法往往会考虑非矩形图像,这实际上使事情变得比我需要的更复杂。

A simple non-efficient and naive implementation of an algorithm to pack these rects would be easy to whip up, but I'm sure people have come up with algorithms to do this as space efficiently as possible. I've found various references to lightmap packing which is similar to what I'm looking for, but the algorithms for lightmapping tend to take non-rectangular images into account which actually complicates things more than I need them to be.

有人有提示吗?算法或纸质作者的名字我应该google吗?

Does anyone have hints? Names of algorithms or paper authors I should google?

谢谢。

推荐答案

我需要做你描述的事情。

I've needed to do this very thing you describe.

这是我使用的Python代码,它是Python Cookbook中的一个食谱:

This is the Python code I used, it's a recipe in the Python Cookbook:

食谱442299:将不同尺寸的多张图像打包成一张图像

更多推荐

将矩形图像数据打包成方形纹理

本文发布于:2023-07-14 22:00:28,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1107276.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:成方   矩形   纹理   图像   数据

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!