• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Shogan/PixelSpriteGenerator-Unity: A port of the PixelSpriteGenerator to C# for ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

Shogan/PixelSpriteGenerator-Unity

开源软件地址:

https://github.com/Shogan/PixelSpriteGenerator-Unity

开源编程语言:

C# 100.0%

开源软件介绍:

PixelSpriteGenerator-Unity

A port of the Pixel Sprite Generator to C# for use with the Unity3D game engine.

Ported from the JavaScript / HTML version done by zfedoran https://github.com/zfedoran/pixel-sprite-generator to work with Unity3D.

Examples

Space ship sprites colored

alt text

Space ship sprites low saturation

alt text

Space ship sprites many color variations

alt text

Dragon sprites colored

alt text

Tree sprites colored

alt text

Shrub sprites colored

alt text

Robot sprites B&W

alt text

Algorithm information

The sprites are generated by using a two dimensional mask. The values in the mask are then randomized and mirrored. The resulting template is rendered to a canvas element.

alt text

The algorithm is explained in more detail on Dave Bollinger's website.

alt text

Usage in Unity3D

To use Pixel Sprite Generator for Unity, you should first of all add the three main scripts/classes to your Unity project:

  • PsgSprite.cs
  • PsgMask.cs
  • PsgOptions.cs

Once these are added, to generate a sprite you need to define a template. The template is an integer array. Take a look at the template examples in the included PixeSpriteGeneratorDemo.cs for some ideas. Create an instance of the PsgMask class and pass in your template int[] and also pass in parameters to indicate your template size dimensions (x, y) as well as whether or not it is mirrored on the X or Y axes.

Next, create an instance of PsgOptions and define the options you would like to use. For example, colored or not, saturation, edge brightness etc... These options effect the look of your generated sprites.

Finally, create a new PsgSprite instance and pass in the mask and options (PsgMask and PsgOptions instances you created before).

The constructor of PsgSprite instance will do everything for you, and afterwards you can access the PsgSprite texture property to get a handle on the Texture2D that is created of the sprite. Use point mode filtering for the texture and set the wrap mode to Clamp for best results and usage as the texture for a Sprite.




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
GP101/GameEngineDesign: 게임엔진 제작의 원리 pdf book发布时间:2022-06-08
下一篇:
faeris/faeris: 3d game engine发布时间:2022-06-08
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap