有没有我可以窃取或查看的复合头像脚本?
在我即将开展的一个项目中,需要生成头像。生成过程将是用户可以选择不同的头部、发型、服装等的过程之一。有些物品一开始也是不可用的,必须赚取或购买。
我已经对如何做到这一点有了一个很好的想法,但由于这是一个不平凡的代码量,所以很高兴看到代码的工作示例。理想情况下,我可以只获取一个脚本并将其集成到我的页面中,但仅收集其他人的想法也很好。
我将使用 PHP,但也欢迎使用其他语言的示例。
添加:澄清一下,我并不是指随机头像生成器(或基于某些哈希值生成头像的生成器)。随机头像生成器与我的意图略有不同。在随机头像生成器中,程序员兼美工对于什么去哪里有更大的发言权。他可以仔细挑选那些不会互相冲突的棋子,也可以丢弃那些给他带来麻烦的棋子。
就我而言,头像生成器更像是这个。用户可以选择使用哪个头、使用哪种发型、使用哪件衣服等。那里有更多的作品,艺术家每隔一段时间就会添加新的作品。测试各个部分如何组合或不组合在一起要困难得多。有时需要更高级的混合(就像帽子的一部分在头发前面,一部分在头发后面)。 ETC。
In a project I'll be working on soon there will be a need to generate avatars. The generation process will be one of those where the user can select different heads, hairstyles, clothing, etc. Some items will also be unavailable at first and will have to be earned or purchased.
I already have a fair idea on how to do this, but since it is a nontrivial amount of code, it would be nice to see working examples of code. Ideally I could just take a script and integrate into my page, but just gathering ideas from other people would be good too.
I'll be working with PHP, but examples in other languages are welcome too.
Added: To clarify, I don't mean a random avatar generator (or one that generates an avatar based on some hash value). A random avatar generator is subtly different from what I have intented. In a random avatar generator the programmer-artist has a much greater say of what goes where. He can carefully pick out pieces that will not conflict with each other, and he can discard those that give him trouble.
In my case the avatar generator is more like this. The user chooses which head to use, which hairstyle to apply, which piece of clothing to use, etc. There are way more pieces there, with artists adding new ones every once in a while. It's much harder to test how pieces will or won't fit together. Sometimes more advanced blending is required (like a hat would have a part of it in front of hair, and part of it behind the hair). Etc.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
[编辑:对更新问题的修订答案]
我认为这主要是相应地设计零件的问题。您有一些基本形状(男性、女性、高/小等),您有设计用于完美匹配和对齐的样式集(例如头发)。就工作量而言,通过算法解决这个问题可能是一个糟糕的选择,并且对于非动画人物来说可能没有必要。
然而,也许您需要一些额外的 Alpha 通道/透明蒙版或用于组合头部、头发和帽子的东西。
除此之外,这些部分必须像 Monster ID 一样逐层组合。
[EDIT: Revised answer to updated question]
I think that it's primarily a matter of designing the parts accordingly. You have some basic forms (male, female, tall / small, etc.) for which you have stylesets (e.g. hair) designed to match and align perfectly. Solving this algorithmically instead is probably a bad choice in terms of workload and probably not necessary for non-animated figures.
However, maybe you'll need some additional alpha-channel/transparency masks or something for combining head, hair and hat.
Other than that, these parts would have to be combined layer for layer like Monster ID.
infernowebmedia.com
他们出售廉价且功能齐全的网站代码来制作您自己的头像网站。
infernowebmedia.com
They sell a cheap and fully functional website code to make your own avatar site.