Coder Social home page Coder Social logo

hyperalch / defblend Goto Github PK

View Code? Open in Web Editor NEW

This project forked from subsoap/defblend

0.0 0.0 0.0 45 KB

Blend solid colors with your sprites in Defold using various blending modes

License: Creative Commons Zero v1.0 Universal

Lua 0.45% GLSL 99.55%

defblend's Introduction

DefBlend

Blend solid colors with your sprites in Defold using various blending modes. Useful for special effects! Can be used on render targets too.

(Blending with textures is possible to add too but not in this version.)

Installation

You can use DefBlend in your own project by adding this project as a Defold library dependency. Open your game.project file and in the dependencies field under project add:

https://github.com/subsoap/defblend/archive/master.zip

You can also manually add shader materials individually to your project.

Usage

Add a blending material to your sprite either normal or pixel version. Then in a script change the color and alpha of that blending mode. You could create new materials with a mixture of different blending methods if you want multiple effects.

These blending modes should generally match how they work in programs such as Photoshop. If you apply a solid color layer with clipping to a sprite you can test various effects more quickly in image editing programs.

Setting custom properties to materials breaks batching of rendering. If you want a little more performance and always use the same values for an effect you can make a copy of a blend material, set the properties within it to whatever values you need. Then use that version of the material instead of changing the stock DefBlend materials with setting their properties for each.

Blending Modes:

  • Normal

  • Darken
  • Multiply
  • Color Burn
  • Linear Burn

  • Lighten
  • Screen
  • Color Dodge
  • Linear Dodge (Add)

  • Overlay
  • Soft Light
  • Hard Light
  • Vivid Light
  • Linear Light
  • Pin Light
  • Hard Mix

  • Difference
  • Exclusion
  • Subtract
  • Divide

  • Average
  • Glow
  • Negation
  • Phoenix
  • Reflect

Not Supported (yet?):

  • Dissolve (cross fade)
  • Darker Color
  • Lighter Color
  • Hue
  • Saturation
  • Color
  • Luminosity

TODO helper functions

defblend's People

Contributors

subsoap avatar hyperalch avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.