Giter Site home page Giter Site logo

esprogram / inkpainter Goto Github PK

View Code? Open in Web Editor NEW
1.2K 47.0 169.0 141.58 MB

Texture-Paint on Unity.

Home Page: https://esprogram.github.io/InkPainterDocument/

License: MIT License

C# 76.21% ShaderLab 17.19% HLSL 6.59%
texture-paint unity shader paint csharp shaderlab c-sharp

inkpainter's People

Contributors

esprogram avatar mob-shigehiro avatar shigehiro-don avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

inkpainter's Issues

Adding InkCanvas component at runtime

Dear amazing inkPainter developper,

I would like to congratulate you on your amazing asset. For my project, I'm importing house at runtime and I wanted to use you asset to paint the walls of the imported 3D model. Unfortunately adding the inkCanvas component with AddComponent<> does not work at runtime because of the custom editor (paintSet object was null). So i added in the "Awake" function the following method base on your code :

private void CreateRuntimeProperty()
{
            Renderer renderer;
            Material[] materials;
            List<bool> `foldOut;`
            var instance = this;
            instance.paintSet = new List<PaintSet>();

            renderer = instance.GetComponent<Renderer>();
            materials = renderer.sharedMaterials;
            foldOut = new List<bool>();

            if (instance.paintSet.Count < materials.Length)
            {
                for (int i = instance.paintSet.Count; i < materials.Length; ++i)
                    instance.paintSet.Add(new PaintSet
                    {
                        mainTextureName = "_MainTex",
                        normalTextureName = "_BumpMap",
                        heightTextureName = "_ParallaxMap",
                        useMainPaint = true,
                        useNormalPaint = false,
                        useHeightPaint = false,
                    });
                foldOut.Clear();
            }

            if (instance.paintSet.Count > materials.Length)
            {
                instance.paintSet.RemoveRange(materials.Length, instance.paintSet.Count - materials.Length);
                foldOut.Clear();
            }

            if (foldOut.Count < instance.paintSet.Count)
                for (int i = foldOut.Count; i < instance.paintSet.Count; ++i)
                    foldOut.Add(true);
}

StackOverflowException when painting on any non-Unity object using WorldPoint or Nearest Surface Point on MousePainter

This seems to be because WorldPoint defaults to PaintNearestTriangleSurface() which then triggers an endless loop. To reproduce this, go to blender, use any basic object such as a sphere, and attempt to paint it. About halfway down the sphere, Unity will freeze for about a minute, multiple "Could not get point on surface" messages will appear, and then finally a StackOverflowException. I've also tested this on imported models on the asset store with similar results.

Fill status

Hi,

Thanks for this wonderful asset. I'm trying to create a scenario where a texture needs to be painted over to complete a level. Is there a way to determine how much of the texture is painted? For example, I'm looking for something like a percentage that indicates if a texture has been 40% covered by paint.

Thanks.

Ink Painter Texturing Error when using ProBuilder

When I use ProBuilder to create objects and add the canvas script to them it messes up the UV layout and only pushes it all down to one square of the texture in the corner. I think it something to due with the UV wrapping that ProBuilder generates and what textures Ink Painter requires. It has something to with the tiling of the UV wrap

i can not run it coreactly

log error is
Material doesn't have a texture property '5f4d61696e546578' UnityEngine.Material:GetTexture(Int32) Es.InkPainter.InkCanvas:SetTexture() (at Assets/InkPainter/Script/Core/InkCanvas.cs:283) Es.InkPainter.InkCanvas:Awake() (at Assets/InkPainter/Script/Core/InkCanvas.cs:199)

my unity version is 5.5.2f1

A display defect occurs in the material created with the old version

Overview

If you use InkCanvas for materials created with older versions, it will be strange to display. (UV shift?)
Make a new material and fix it by setting the same shader and properties.
Changing shaders and properties of old materials will not fix it.
As it is on the image, the copy itself to the RenderTexture is successful.
Incidentally, it does not occur when painting to MainTexture is not done.

old_material_issue

modify ease of dripping over already painted areas

Hi, I noticed ease of dripping is different when painting over clean areas and already painted areas (color flows further over paint). Yet I haven't been able to find the factor which makes it different, how can I modify inkpainter so that ease of dripping is the same no matter where I paint?

What I want to do is to make color spread to be the same as ink dripping, I have been playing around with HeightDrip.shader, PaintHeight.shader and InkPainterFoundation.cginc, but I haven't been able to get such results, every factor in shiftZ seems to end up affecting both dripping and color spread, I haven't found which one affects only color spread.

Thanks.

Make dripping compatible with Flow Maps

Right now the Heightdrip shader uses a vector2 (float2) to specify the flow direction for the dripping effect, would be really useful if we could specify a flow map to control the direction.

maybe related to #25 ?

Select material to paint

Overview

Added a function to select material to paint.
Currently, I paint all materials registered in InkCanvas.

License

Can you select a license and add it to the project please, because due to license missing it is unclear how people can use the project.

Add undo and redo function, please.

Hi. I thank you because your assets are very useful for me to work on the project. but, i need one very important functionality, that is undo and redo. can you give me a hint? maybe we can discuss together. thanks.

NormalMap is initialized to black solid color with HeightFluid

Overview

If HeightFluid and InkCanvas have different NormalMapPaint settings, no normal map is set for material, and HeightFluid generates RenderTexture for NormalMap, it becomes black image and it becomes gloomy shading.

Countermeasure

When doing NormalMapFluid with HeightFluid, if the normal map is specified for the material, you can leave it as it is now.
If you do not specify a normal map and want to do NormalMapFluid, you need to fill in the RenderTexture with the default normal rgb (128, 128, 255) for RenderTexture after generating it. It can filled with SingleColorFill. When treating it as a DXT 5 mn format when calculating Normal Map in Shader, define Pack Normal function in C # (defined in Shader) and apply it to rgb (128, 128, 255) and initialize with that color.

2D support

Is it possible to add support for painting 2d sprites?

Multiple Height Fluids

Is it possible to paint an object with different height fluids?
I've recognized once the last painted color is different than the current one, fluid process stops. Is it possible to keep fluid process when a different color is applied? I want to apply 3 distinct and certain colors to the object and all of them to be fluid.

Thx.

Modifying the alpha of brush at runtime causes abnormal paint behavior

bug

When changing the brush's alpha at runtime causes only the last or the latest painted brush to simulate fluidic effects (see screenshot) (Modifying scale works fine)

(Note: How can I change the width and height in scale separately?)
(Note2: Changing the alpha in HeightFluid changes the alpha of all the painted brushes ☹️ )

This is how I change alpha in the Update() function

//vars
public InkCanvas inkCanvas; //set in inspector
private static readonly System.Random random = new System.Random();
float dampedAlpha;

//functions
private void Update()
{
	if(Input.GetMouseButton(0))
	{
		var ray = Camera.main.ScreenPointToRay(Input.mousePosition);
		RaycastHit hitInfo;
		if(Physics.Raycast(ray, out hitInfo))
		{
                    dampedAlpha = Mathf.SmoothDamp(dampedAlpha, (float)RandomNumberBetween(0f,1f), ref vel, Time.fixedDeltaTime);
                    Brush tempBrush = brush; 
                    tempBrush.Color = new Color(brush.Color.r,brush.Color.g,brush.Color.b,dampedAlpha); 
                    inkCanvas.Paint(tempBrush, hitInfo);
                  }
          }
}

private static double RandomNumberBetween(double minValue, double maxValue)
{
    var next = random.NextDouble();
    return minValue + (next * (maxValue - minValue));
}

Steps to Reproduce:

  1. Attach "InkCanvas" Component to plane.
  2. Attach "HeightFluid" script to the plane.
  3. Uncheck "Performance Optimize" in HeightFluid script
  4. Change Properties of brush to:
Color Blend Type = Alpha Only
Normal Blend Type = Add
Height Blend Type = Use Brush
  1. Create a custom script, modify the alpha values in Update() and paint.

Question regarding reading of colour

Hey!

I love your ink painter asset and have converted it a little to work in our top down shooter, and it works fine but we need it so that players and enemies can read which colour is below them to activate certain effects on them i.e. speed boost etc. Was wondering if you had any advice or knowledge on how to do this?? I've tried GetPixel but doesn't seem to work because the mainTexture of the ground is changed to something that i don't know what it is. Looking through your scripts gave me the idea for GetVector but im not entirely sure how that would work.

Solution for Inkpainter with repeated texture.

Dear InkPainter programmer,

Painting texture only works when the uvs are not repeating on the texture. Otherwise, we get the following behaviour as shown in the .gif (your sample cube vs unity cube). Is there a solution for this problem ? Can we modify the uv through script so that we do not have a repetition ?

Thank you again for your response,

animated gif-downsized_large

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.