在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:Shogan/PixelSpriteGenerator-Unity开源软件地址:https://github.com/Shogan/PixelSpriteGenerator-Unity开源编程语言:C# 100.0%开源软件介绍:PixelSpriteGenerator-UnityA 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. ExamplesSpace ship sprites coloredSpace ship sprites low saturationSpace ship sprites many color variationsDragon sprites coloredTree sprites coloredShrub sprites coloredRobot sprites B&WAlgorithm informationThe 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. The algorithm is explained in more detail on Dave Bollinger's website. Usage in Unity3DTo use Pixel Sprite Generator for Unity, you should first of all add the three main scripts/classes to your Unity project:
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. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论