Skip to content

wingcd/upainter-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

1. Introduction

Get on:
Sales on Unity Assets Store
Experience right now on:
Online Demo

This is a texture paint toolset,you can use in Unity RawImage/Sprite/Mesh Texture/Unity Edtior UI/other UI system;


Raw Image

Draw on mesh

Draw in editor

Features

  • Paint in runtime
  • Paint in editor mode
  • Paint in GPU
  • Solid brush
  • Texture brush
  • Graphic brush
  • Composite brush
  • Fill Tool
  • Pixel Mode
  • More blend type
  • Post effect
  • Undo/Redo

2. Quick Start

Use Samples

  • Import uPainter package into your project
  • After compiled, click menu "uPainter/AddSamples" to add samples scenes to Build Setting, ensure you can run the samples correctly
  • Open demo scene "uPainter/Samples/Samples.unity"
  • Click one sample
  • Draw on canvas
  • Editor sample just click menu "uPainter/EditorDemo"

How to use

  • Create a new scene
  • Add a Empty Object in Canvas, and stretch to fit size

Create Empty GameObject
  • Add PaintRawImage to this

Add PaintRawImage component
  • Create a solid brush:in assets window, click right mouse button, select in path "Create/uPainter/SolidBrush"
  • Modify brush's attributes

Create solid brush
  • Assign the solid brush to RawImagePaintCanvs's "Brush" property
  • Draw on canvas

Assign brush & Draw

3. Details Introduce

Solid brush

Paint solid color to texture


Solid brush

Brush Color: color of brush
Size: size of brush,value Range(0,1)


Brush Size

Point Distance Interval: the minimum distance of last two points
Self Overlay: whether or not overlay self in on paint life circle


Self Overlay

Blend Mode: blend type with layer texture

  • Normal: Default mode
  • Restore: Easer use this mode
  • Replace: Scratch card use this mode
  • Darken
  • Mutipy
  • ColorBurn
  • LinearDark
  • Lighten
  • ColorScreen
  • ColorDodge
  • LinearDodge
  • Overlay
  • HardLight
  • SoftLight
  • VividLight
  • PinLight
  • LinearLight
  • HardMix
  • Difference
  • Exclusion
  • Subtract
  • Add

Some blend modes

Pixel Mode: If true, the input uv will be modify clamp to pixel cell, the layer filter mode must be point, then can get perfect effect, and you need set a correct layer and brush size


Pixel mode

Softness: softness of brush,useful highlight effect, value Range(0,1),default is 0


Softness

Noise Rate: mask brush with noise, can use this property to simulation uneven effect,such as crayon pen, only value bigger than 0 can be effective,value Range(0,1)
Noise Size: set the noise size, only noise rate bigger than 0 can be effective,value Range(0,1)


Noise

Paint Mode: Brush paint mode, has Dash/Line mode


Paint Mode

Cap Style: Brush cap styles, has Flat/Round mode


Cap Style

Line Joint Style: The corner style just effect in line paint mode, has Round/Flat/Sharp mode


Line Joint Style

Texture brush

Paint texture to target texture


Texture brush

Brush Texture: The brush texture
Rotate Angle: Anticlockwise angle in degree of brush texture


Rotate 30 degree

Rotate Fllow Direction: When in dash mode, the texture will rotate by the direction between two points
Tilling: Repeat count of texture, when enable global uv,the tilling means global repeat count,Range(0,1)


Tilling sample

Offset: Offset of texture uv,Range(0,1)


Offset sample

Enable Gloable UV: Use global texture uv,effected by brush size,can use to mosaic effect


Enable gloabl uv

Enable Gloable Reapeat Count: If true, will ignore brush size, only effected by tilling value


Global reapeat

Global reapeat & set tilling

Global reapeat & set offset

Graphic/Line brush

Use GL mode to draw lines,can paint lines to texture


Texture brush

Line Count: The count of lines


Line count is 4

Composite brush

This is a brush group effect brush,can overlay many brush effect in one paint


Composite brush

Brushes: Composite's sub brushes, overlay order by array index


Composite brush

Post effect

When paint done, post effect will process the texture, add effect to the result,the effect can be multiple in brush, inner effect has:

  • Blur Brush Post

  • Outline Brush Post


Post effect

Drawer


Drawer Painter interaction proxy, will handle touch input, we use drawer to create more texture painter, like raw image drawer, other ui system drawer and mesh drawer(need mesh collider)

Replace Brush: When canvas is empty, this property will set to canvas brush
Show Preview: If true, will show cursor on texture
Simulate Pressure: If true, will simulate the pressure, distance between two points is more larger ,the size will more small;
There has interface to extend, you owen simulate method, even use real touch sensor data;


Simulate pressure

Brush Pressure Strength: The strength of pressure, the value is more larger, the line will more thinner, value range(0,1)
Corner Smooth: Corner smooth strength, value range(0,0.5) (In older device you can set this value to ZERO)
Use Shader Smooth: If true, use shader bezier curve, or calucate in cpu, Graphic/Line Brush do not support shader smooth
Curve Interpolation: Only when do not use shader smooth mode, will decide how many segments number of the bezier curve, the value is larger, the line will more smooth, and need more caculation,value range(0,5)

Undo/Redo

PainterOperation is a undo/redo system, default max undo/redo step is 10, you can extend this system to save command result to disk,so you can use limitless undo/redo operate;
Sample undo/redo code:

PainterOperation.Instance.Undo()
PainterOperation.Instance.Redo()

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages