I had fun playing with perlin noise and shaders to make the various procedural smoke patterns for sixty second shooter and last week brought the same tech over to Energy Hook - but before I did, I looked around the Asset Store to see if there was anything that would do the same effect. There was, but it was all at least $50 or more, and didn't feel like paying it. So I did the work - took me longer than I expected to figure out ShaderLab - and here's the result.
And then I thought, hey, I would have paid $10 for that. So why not put it up on the Asset Store and see if I can sell any?
It's not the most powerful or flexible procedural smoke generator in the Asset Store, but I'm pretty sure it's the cheapest.
Why is the Unity Asset Store so much more pleasant than the Windows 8 Store? Well, it's curated, so there isn't a lot of utter crap in there. (It's tempting to download every single free asset.) It's sortable by a variety of parameters (such as price.) It's easy on the eyes - partly because it's curated (there aren't infinite results splitting your attention) but partly because the graphic design is better IMO.
Submitting an asset wasn't hard - about as easy as putting an app in the Chrome Web Store - and seemingly much easier than submitting something for the Windows 8 store. And it was accepted on my first try, so yay.
I'll keep you posted how it's selling. Although I doubt one could make a living out of selling stuff in the Unity Asset Store unless it was something crazy popular that almost everybody needs, like nGUI, there's a chance it could provide decent alternative revenue if you're selling stuff that you would have made anyway for your game - then it only has to pay for the effort to get it into the store to make it worthwhile (but mustn't forget to include the opportunity cost...) We'll see.
On the technical side, if you want an effect like this and you're too poor to pay the $10, I'm here for you, since you're a valued reader of my blog. This is where the magic happens, the Cg that I brought over from sixty second shooter:
float2 in v_TexCoord : TEXCOORD0,
float4 in v_Color:COLOR0,
float4 out Color : COLOR,
uniform sampler2D s_Texture : TEXUNIT0,
uniform float Time,
uniform float Rate,
uniform float2 Scroll,
uniform float4 meshColor
float offset = Time*Rate;
float4 c = tex2D (s_Texture, v_TexCoord + float2(0.25,-0.25) + offset*Scroll.xy);
c = tex2D(s_Texture, c.yx - 8.0*float2(offset*0.71,offset*0.33));
float intensity = c.r + c.g * 0.5 + c.b * 0.25;// + c.a * 0.12;
intensity = intensity * intensity;
Color = intensity * meshColor * v_Color;
The texture it looks up into should be a perlin noise texture with different frequencies of noise in each color channel. It uses the RG channels to then look up into the texture a second time, and then blends that noise together. But it does interesting kaleidoscopic things with normal textures as well. You'll have to wrap that in ShaderLab stuff to get it working in Unity, but it should work more or less as-is in engines that use straight up Cg (like Playstation Mobile.)
Enjoy! If you buy it, feel free to ask questions right here in the comments.
Great. Thanks for sharing your procedural smoke tech. I am still getting up to speed in writing/understanding shaders, so I will definitely go over to the asset store if I am in need of anything like that.
Posted by: Scott Petrovic | March 26, 2013 at 06:12 AM