• Stars
    star
    126
  • Rank 284,543 (Top 6 %)
  • Language
    C#
  • License
    MIT License
  • Created almost 9 years ago
  • Updated almost 9 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A port of the PixelSpriteGenerator to C# for use with the Unity3D game engine

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.

More Repositories

1

kube-chaos

A chaos engineering style game where you seek out and destroy Kubernetes pods, twinstick shmup style.
C#
279
star
2

ec2-spot-termination-simulator

A very simple web API endpoint that returns a 200 from the endpoint that the EC2 metadata service on Amazon EC2 instances usually serves spot termination times on.
JavaScript
20
star
3

Unity3D.CharacterCreator

A character creator project utilising DynamoDB for character configuration storage.
C#
12
star
4

Hobbyistcoder.Editor.Utilities

Useful editor extensions and utilities for Unity 3D
C#
6
star
5

aws-docker-web-with-traefik

A super cheap docker web host in AWS, using Traefik for reverse proxying, and EFS storage for persistence.
TypeScript
5
star
6

fstojson-rust

Traverses a target filesystem directory & outputs the collected hierarchy to JSON
Rust
4
star
7

terraform-aws-msk

A Terraform module to provision an Amazon MSK (Amazon Managed Streaming for Apache Kafka) cluster
HCL
4
star
8

packer-windows-server-ami-with-s3download

Packer example to build a custom AWS AMI Windows Server image, download files from S3 securely, and run tests with Pester
PowerShell
3
star
9

traversefs-nim

A filesystem traversal tool written in Nim
Nim
2
star
10

terraform-eks-with-weave

A basic example Kubernetes Cluster (EKS) with Weave CNI replacing the standard AWS CNI plugin.
HCL
2
star
11

cloudwatch-lambda-to-splunk-hec

A Lambda service that ingests CloudWatch logs (via triggered event inputs from CloudWatch Log Groups), base64 decodes, decompresses, and then forwards them over to a Splunk HEC for ingestion there.
JavaScript
2
star
12

aws-cdk-step-function-saga-pattern

Saga pattern with AWS Step Functions, Lambda and aws-cdk
TypeScript
2
star
13

fstojson-nim

A simple CLI tool to traverse a target directory & output the collected hierarchy to JSON
Nim
1
star
14

remember-to-stand

A simple system tray and toast notification app to remind you to stand up and sit down. Made with Rust.
Rust
1
star
15

waypoint-docker-armhf

Docker image build for Hashicorp Waypoint on armhf. Raspberry Pi etc...
Dockerfile
1
star
16

CocoJson

Demonstrates fetching of JSON data and use of this data to create a browsable menu of iOS games/apps in application
Objective-C
1
star