Hello Guest

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - quangtu89

Pages: [1]
1
Support / Question about depthmask and grayscale
« on: February 11, 2015, 04:56:25 am »
This is my grayscale shader

Code: [Select]
Shader "Sprites/GrayScale"
{
    Properties
    {
        [PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {}
        _Color ("Tint", Color) = (1,1,1,1)
        [MaterialToggle] PixelSnap ("Pixel snap", Float) = 0
        _EffectAmount ("Effect Amount", Range (0, 1)) = 1.0
    }
 
    SubShader
    {
        Tags
        {
            "Queue"="Transparent"
            "IgnoreProjector"="True"
            "RenderType"="Transparent"
            "PreviewType"="Plane"
            "CanUseSpriteAtlas"="True"
        }
 
        Cull Off
        Lighting Off
        ZWrite Off
        Fog { Mode Off }
        Blend SrcAlpha OneMinusSrcAlpha
 
        Pass
        {
        CGPROGRAM
            #pragma vertex vert
            #pragma fragment frag
            #pragma multi_compile DUMMY PIXELSNAP_ON
            #include "UnityCG.cginc"
           
            struct appdata_t
            {
                float4 vertex   : POSITION;
                float4 color    : COLOR;
                float2 texcoord : TEXCOORD0;
            };
 
            struct v2f
            {
                float4 vertex   : SV_POSITION;
                fixed4 color    : COLOR;
                half2 texcoord  : TEXCOORD0;
            };
           
            fixed4 _Color;
 
            v2f vert(appdata_t IN)
            {
                v2f OUT;
                OUT.vertex = mul(UNITY_MATRIX_MVP, IN.vertex);
                OUT.texcoord = IN.texcoord;
                OUT.color = IN.color * _Color;
                #ifdef PIXELSNAP_ON
                OUT.vertex = UnityPixelSnap (OUT.vertex);
                #endif
 
                return OUT;
            }
 
            sampler2D _MainTex;
            uniform float _EffectAmount;
 
            fixed4 frag(v2f IN) : COLOR
            {
                half4 texcol = tex2D (_MainTex, IN.texcoord);             
                texcol.rgb = lerp(texcol.rgb, dot(texcol.rgb, float3(0.3, 0.59, 0.11)), _EffectAmount);
                texcol = texcol * IN.color;
                return texcol;
            }
        ENDCG
        }
    }
    Fallback "Sprites/Default"
}


When i use this shader , depthmask of toolkit 2d don't effect to sprites use this grayscale shader ...

2
Support / How to change a sprite to grayscale in a atlas runtime ?
« on: February 02, 2015, 05:54:21 pm »
I want change only a sprite in atlas to grayscale but dont affect to other sprites in this atlas . How to do this ?

3
Support / Change color a part of tk2dtextmesh ?
« on: December 18, 2014, 11:04:40 am »
Can change color for a part of text of tk2dtextmesh ? Can anyone help you .
Like this : " this is sample "

4
Support / Change sprite collider size
« on: October 30, 2013, 01:49:37 am »
I have problems with collider size of sprite, when i change sprite dimensions, the collider size cannot change. How can i resize the box collider with the new dimensions .Thanks in advance.

5
Support / Sprite basic translate is not smooth
« on: September 27, 2013, 04:55:37 pm »
My script
Code: [Select]
void FixedUpdate()
{
       this.transform.Translate(new Vector3(speed * Time.deltaTime, 0f, 0f));
}

i attach it to a square sprite . But it translate not smooth.
I tried use Premultiplied Alpha and PremulVertexColor shader .
I tried Vsync Count is Don't sync or Every vBlank and Application.targetFrameRate equal 60 or 30 .
But problem is not solved .
Can you help me ?

6
Support / tk2dcamera smooth drag
« on: August 23, 2013, 09:37:13 am »
My script attach to tk2dcamera to drag camera axis x

Code: [Select]

public override void TouchDownOut (Vector2 position)
{
dragOrigin = new Vector3 (position.x, position.y, 0);
dragOrigin = camera.ScreenToWorldPoint(dragOrigin);
originTime = Time.time;
if(!isMove)
{
isMove = true;
}
}

public override void TouchMoveOut (Vector2 position)
{
Vector3 currentPos = new Vector3 (position.x, position.y, 0);
currentPos = camera.ScreenToWorldPoint(currentPos);
if(isMove)
{
if (Vector3.Distance(dragOrigin,currentPos) > 10f)
{
float amtToMove = 20f * Time.deltaTime;

LGController.state = LGController.State.Animation;
movePos = dragOrigin - currentPos;
movePos = new Vector3(movePos.x * amtToMove,movePos.y,movePos.z);
Vector3 newPos = transform.position + movePos;
newPos.y = this.transform.position.y;

transform.position = newPos;
}
}
}
public override void TouchUpOut (Vector2 position)
{
        if(isMove)
        {
            isMove = false;
        }
}

But it not smooth . Anyone help me ?

7
Support / i want tk2dUIItem release dont fire event OnClick
« on: August 22, 2013, 02:46:41 am »
My scene can drag to change scene .
I want to when i touch down a button after i move finger to drag scene, button will release but don't fire event OnClick

My code :

Code: [Select]
[AddComponentMenu("Lunge Mine/UI/UIWithDragScene")]
public class UIWithDragScene : tk2dUIBaseItemControl {

void Update()
{
if(uiItem.IsPressed)
{
if(LGController.state == LGController.State.Animation)
{
uiItem.Release();
}
}
}
}

How can i release a uiitem but don't fire event OnClick

8
Support / Deptmask with gameObject texture and content position
« on: August 12, 2013, 03:47:47 am »
I have problem with my scrollable area , when i change the position of content to move up and scale height in run time, the content position cannot change so everything has move up cannot seen .Another problem is i can use mask to hide the texture of normal gameobject .Can you help me . Thanks in advance  :)

9
Support / question about depthmask
« on: August 09, 2013, 11:02:31 am »
I use depthmask obj of toolkit 2d . But its shape is rectangle. I want use it with other shape like circle . How to do it . Thanks

Pages: [1]