Monday, August 15, 2011

Blending Problems

So I got these indicators to know when a unit is selected or where he's going to move:


Its a projector, its not the fastest, but it looks good. Its blend equation is set right now to multiply. That's fine but:


Multiply darkens the blend, making it hard to see in dark places. So, I try an additive blend:


So that looks better. Only it does the opposite: in bright areas, its hard to see:


More so in very bright areas:


So in the end, I am forced to use a normal alpha-blend equation. It looks plain, but is sure to be visible in both bright and dark areas:



Unfortunately, you can't emulate the blend types in Photoshop like Overlay, because blending equations in videocards are fixed-function.

Here's the Unity shaderlab code for alpha-blended projectors:

Shader "Projector/Diffuse" {
	Properties {
		_Color ("Main Color", Color) = (1,1,1,1)
		_ShadowTex ("Cookie", 2D) = "" { TexGen ObjectLinear }
	}
	Subshader {
		Tags { "RenderType"="Transparent"  "Queue"="Transparent"}
		Pass {

			ZWrite off
			Fog { Color (0, 0, 0) }
			Color [_Color]
			ColorMask RGB
			Offset -1, -1

			Blend SrcAlpha OneMinusSrcAlpha

CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma fragmentoption ARB_fog_exp2
#pragma fragmentoption ARB_precision_hint_fastest

#include "UnityCG.cginc"

sampler2D _ShadowTex;
float4x4 _Projector;
fixed4 _Color;

struct v2f {
	float4 vertex : SV_POSITION;
	float4 texcoord : TEXCOORD0;
};

v2f vert (appdata_tan v)
{
	v2f o;
	o.vertex = mul(UNITY_MATRIX_MVP, v.vertex);
	o.texcoord = mul(_Projector, v.vertex);
	return o;
}

half4 frag (v2f i) : COLOR
{
	return tex2Dproj(_ShadowTex, UNITY_PROJ_COORD(i.texcoord)) * _Color;
}
ENDCG
		}
	}
}

Wednesday, August 10, 2011

MeleeWeaponTrail: Another Unity Asset Store Submission

This is my second Unity Asset Store submission, a weapon trail effect for your character attacks. Props go to Forest Johnson (Yoggy) and xyber for the original code.



You can find the wiki page here: http://unifycommunity.com/wiki/index.php?title=MeleeWeaponTrail

UPDATE: Asset Store submission accepted! http://u3d.as/content/anomalous-underdog/melee-weapon-trail/2ck

Web build demo here: http://dl.dropbox.com/u/25260770/MeleeWeaponTrailDemo/WebPlayer.html

Tuesday, June 14, 2011

Funny



I hardly go out.

During the times that I go out, things hardly happen.

Today something happened.

I went out today to buy some PS3 games, and, funny thing, there's this person at the store, looks about at least 20 years old, and keeps on talking about American McGee's Alice.

He kept on asking questions and making conversation with anyone within his reach. What's up with this guy? From the way he speaks, you could tell he's not quite right in the mind, but well enough that he can go to a store by himself, and have his own cellphone. You can imagine that creates some problems everywhere he goes.

Eventually he reaches me, then goes on to say about American McGee, then about Suda51, about the origin of the 51 in his name, then about how its the same with how the word Konami came out to be. I'm mildly surprised Madness Returns came out already; I hadn't checked the release date at all.

He picks a copy of Duke Nukem Forever, goes on about the fact that it was 15 years in the making, "close to 20" he says. Talks about how the game's different: Duke, he's not eeemmo, he says, because the aliens took his... his girls.. he's fighting for his... uhuh pleasure, yeahhh.

He was obviously recounting what he heard in the developer interviews (I know, I saw those too). In that brief moment it made me think about what I'm making. I had better make sure Garwolf is a well-rounded character and I hope he won't be labeled "emo".

Because labels are dicks.

Even while I was finishing my purchase at the cashier he was still going at it. Me and the store people smile knowingly. Oh boy, we thought.

I do my best in not being a dick and even engage in conversation a few times; I was surprised Suda51 worked on an EA game, though I think he didn't get that I meant that.

Out of that guy's hearing, the store guy talks about how that person actually went through all of the store's branches, and that he even punched another person once, supposedly trying to recreate some scene in a game. Oops.

Walking home I thought, I'm just as much as a loser as that guy. The only difference is, his ignorance is his bliss.

Tuesday, April 5, 2011

Tuesday, March 29, 2011

All In

I did not feel inspired, I felt driven. I have to finish this. I'll shell my own money if I have to (don't have a credit card though). I need to do this. Time is running short.

Few days earlier I was trolled on the Internet. It distressed me. Now I feel confused. A mixed bag of emotions.

This time again I feel the urgency to complete a purpose larger than myself.

Wednesday, March 16, 2011

Adventures in Open Source

Ok, this sucky svn client I have on the Mac doesn't support the file:// protocol. I bet there's an open-source svn front-end just for me!
Last login: Wed Mar 16 21:50:05 on ttys000
mac:~ user$ sudo port install kdesvn
---> Computing dependencies for kdesvn
---> Dependencies to be installed: automoc cmake qt4-mac libmng lcms kdebase4-runtime bison exiv2 hicolor-icon-theme kdelibs4 aspell texinfo xz aspell-dict-en attica phonon avahi dbus-python26 dbus-glib py26-gobject libffi python26 libdaemon libglade2 py26-gtk py26-cairo py26-numpy atlas gcc44 gmp mpfr gzip fftw-3 py26-nose py26-distribute py26-py cyrus-sasl2 dbusmenu-qt qjson enchant hunspell flex giflib gmake grantlee kerberos5 gnupg libusb-compat libusb libart_lgpl liblzma openexr ilmbase gsed pcre qca shared-desktop-ontologies soprano clucene libiodbc redland raptor rasqal strigi virtuoso gawk libssh openslp oxygen-icons qimageblitz subversion apr apr-util neon serf
Wait, don't install GTK, I just want kdesvn! Surely that doesn't use GTK? Opeen Soooouuuuuurce!!!!

Its like I'm really in Linux!