Improve quality of transparency effect

I am porting over a project on a different framework, with the desired effect looking like this:

http://s14.directupload.net/file/d/3079/bk3wr54e_jpg.htm

It’s just a 32x32 px picture with transparencies travling along a column model, creating a warp travel effect for a Sci Fi game.

Using the same assets in Unity I get:

http://s7.directupload.net/file/d/3079/eajtydfj_jpg.htm

The clouds, i.e. less transparent pixels, are blended together it seems. You can see some movement or let’s say color chance over time using a UV coordinate setoff via:

void Update () {
		float dt = Time.deltaTime;
		
		float doffset = offspeed * Time.time;
		renderer.material.mainTextureOffset = new Vector2(doffset,0); }

The shader I use is:

Shader "EVShaders/UnlitTranspDiff" {
Properties {
	_Color ("Main Color", Color) = (1,1,1,1)
	_MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
}

SubShader {
	Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent"}
	LOD 200
	Blend SrcAlpha OneMinusSrcAlpha // SrcAlpha OneMinusSrcAlpha
	Cull Off Lighting On ZWrite Off Fog { Color (0,0,0,0) }

CGPROGRAM
#pragma surface surf Lambert alpha

sampler2D _MainTex;
fixed4 _Color;

struct Input {
	float2 uv_MainTex;
};

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

Fallback "Transparent/VertexLit"
}

I assume that the transparency blend mode in the shader is the problem. But absolutely not being a shader dude and not planning on becoming one I just tried various combinations for the Blend variables and didn’t get any visible change - besides a pink solid color every now and then.

I vaguely remember having a similar look on early iterations using the other framework, an then doing something like TransparencyMode.MDUAL, .MBINARY or whatever and then it worked.

So I guess my questions is how to achieve my desired target look in Unity?

Thanks

I imagine you want additive blending rather than standard alpha blending.

The blend modes are documented here; Unity - Manual: ShaderLab command: Blend

So you’d want to replace your line
Blend SrcAlpha OneMinusSrcAlpha // SrcAlpha OneMinusSrcAlpha
with
Blend One One

I’m always impressed to see the intelligent answers in this forum when I don’t even understand the question. (I don’t even know where to look at in the screen shots!)

I’m guessing that based purely on the fact the first image (desired) is brighter than the second one (actual) :stuck_out_tongue:

Hm no that’s not it. I tried all the elements in that list (“Below are the most common blend types”) in the past, but no visible change. Maybe with One One it get’s a little brighter, but other than that I still don’t get the cloudy structure I’m looking for, just a blue mist. I do see some differentiation however, I assume from moving the UV coords.

I share Martin’s confusion over the difference between your two images. There are quite a few subtle differences, and it’s not clear what you’re after.

You can see the desired effect in motion here. It’s a texture moving towards the player via UV coordinates manipulation. I can’t film Unity right now, since I don’t have the software installed right now. But it looks like my second screenshot. You can’t differentiate clouds moving, it’s just a blue mist getting darker and brighter. At first I thought the UV movement was too fast, but decreasing it didn’t help.

The texture itself seems to be correctly recognized by Unity: screenshot in the Inspector. It’s a 32x32 px PNG.