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.


Messages - couger

Pages: [1]
1
Support / Re: 2D Sprites with Normals and shadows
« on: January 29, 2014, 02:00:48 pm »
No the unity bump diffuse doesn't work, fills the sprite with the texture, both unity and 2dtk sprites

There must be a way to make this work, the shader I posted above is almost working except for the normal map not quite being applied properly. I don't have an understanding of shaders so not sure what needs changing

Given that unity sprites don't support normals it might be a good feature for 2dtk to support them natively, I know you had mentioned this before as not a priority but seems to be quite a few people trying to do this now



2
Support / Re: 2D Sprites with Normals and shadows
« on: January 29, 2014, 01:00:08 pm »
Not sure what you mean, not really a shader guy, do you mean change the shader to solid, if so not sure how, sorry

3
Support / Re: 2D Sprites with Normals and shadows
« on: January 29, 2014, 12:18:37 pm »
I am using the normal camera, works great on a quad just not a unity sprite or a 2dtk sprite

I have got it almost working on a 2dtk sprite using this shader

Code: [Select]
Shader "Sprites/Bumped Diffuse with Shadows"
{
Properties
{
[PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {}
_BumpMap ("Normalmap", 2D) = "bump" {}
_Color ("Tint", Color) = (1,1,1,1)
[MaterialToggle] PixelSnap ("Pixel snap", Float) = 0
_Cutoff ("Alpha Cutoff", Range (0,1)) = 0.5

}

SubShader
{
Tags
{
"Queue"="Transparent"
"IgnoreProjector"="True"
"RenderType"="TransparentCutOut"
"PreviewType"="Plane"
"CanUseSpriteAtlas"="True"

}
LOD 300


Cull Off
Lighting On
ZWrite Off
Fog { Mode Off }


CGPROGRAM
#pragma surface surf Lambert alpha vertex:vert addshadow alphatest:_Cutoff
#pragma multi_compile DUMMY PIXELSNAP_ON

sampler2D _MainTex;
sampler2D _BumpMap;
fixed4 _Color;

struct Input
{
float2 uv_MainTex;
float2 uv_BumpMap;
fixed4 color;
};

void vert (inout appdata_full v, out Input o)
{
#if defined(PIXELSNAP_ON) && !defined(SHADER_API_FLASH)
v.vertex = UnityPixelSnap (v.vertex);
#endif
v.normal = float3(0,0,-1);
v.tangent =  float4(1, 0, 0, 1);

UNITY_INITIALIZE_OUTPUT(Input, o);
o.color = _Color;
}

void surf (Input IN, inout SurfaceOutput o)
{
fixed4 c = tex2D(_MainTex, IN.uv_MainTex) * IN.color;
o.Albedo = c.rgb;
o.Alpha = c.a;
o.Normal = UnpackNormal(tex2D(_BumpMap, IN.uv_BumpMap));
}
ENDCG
}

Fallback "Transparent/Cutout/Diffuse"
}

But the normal map map doesn't seem quite correct when compared to the quad. Not a shader guy so not sure what to change. Also when using the above with deferred lighting the sprite appears almost unlit

Not sure how to post a pic but Ive attached 2 images, the skeleton on the right is the quad in both, the deferred on is how it looks with deferred lighing


4
Support / Re: 2D Sprites with Normals and shadows
« on: January 29, 2014, 11:40:11 am »
Hi

Does this shader work with deferred lighting? I've tried it and I just get a black sprite. I'm also trying to get a sprite to work the same as a quad with a texture and a transparent cutout bumped with shadow.

Is there a shader for 2dtk that does the same thing?


5
Support / Tilemap and sprite draw order problem
« on: January 01, 2014, 04:01:32 pm »
Hi,

I'm having some issues with the draw order of sprites and a tile map. I have 3 layers on my tile map, what I want is the player to sit on layer 2, between layer 1 and 3 so my main character appears to walk behind some of the tiles. I have created 3 layers all with different z values and the tile map appears correctly. My problem is the player is either behind all the tiles or in front of all the tiles, doesn't matter what layer or z value the player is on this never changes. I cant find any combination where the player sits between tile layers.

Is the above even possible, if so how do I do this

Thanks

Pages: [1]