Fake lit planets

I figured out a way to do unlimited light support for animated spinning planets in my game virtually for free.

Animation: Planets are spheres, so just scroll the U of the UV channel for the diffuse map.

Lights: Precompute an emissive map (including light colors), put it on a different UV channel.

Only potential problem is normal mapping won’t work unless I were to put the light angle in the emissive map, but planets are so far away it doesn’t matter.

Here’s a video
Emissive Scroll

There are NO lights and NO animation in that scene. I did that emissive map by hand but by rendering to texture it would look a lot better.

Diffuse map

Emissive map


Dropping oFusion

I spent 2 days getting things looking sort-of-right in oFusion. But still about 10% of the time it would be wrong. I spent about 30 minutes figuring out why an object wasn’t lit when I lit it. Another 30 minutes on why my texture wouldn’t take. A few other things. In each case it was fixed by restarting my computer – in other words bugs with oFusion.

For all the time I spent trying to get oFusion working, I could have just done all the materials by hand. So I’m dropping oFusion.

My current approach is to tell the artists to make things look how they want, then I will go through, use oFusion only for exporting (the free exporter doesn’t work), and then do the materials by hand. I can manually do the small tweaks needed to get things looking the same between the game and the editor.

For all the time I spent on this I could have written my own exporter 🙁

Game Development

Exporter problems

The last half-week I’ve been working with artists to try to get their levels working right.

Right now this is turning into a big risk for the project. I paid $1200 for an add-on called oFusion so the artists could theoretically see how things look in the game within the modeling program. But support is too slow and the bugs are killing me.

I had a real dilemma yesterday with how to export materials.

I could:

1. Create materials by hand in text files, which is good because they are source controlled and I can easily change common properties. But then, due to bugs, the artists could not see what they are doing in the game. And also as sort of a hack I would have to name materials in the modeler exactly the same as in the text file. This means I have to do everything myself because that takes too much rigor for the artists to handle.

2. Specify in oFusion which material file I am using. This was a feature I requested, but was buggy to the point of being unusable, and caused problems in step 3.

3. Create everything using oFusion’s preferred system, which is basically to program the material in a GUI through MAX. This means every material takes about 5 minutes for me or 30 minutes for an artist to setup because you really are programming the material. Materials cannot be source controlled and changing any common property means every material in the game needs to be recreated. Worse, because step 2 could not be turned off once activated, I had to delete and recreate the object entirely.

I ultimately went with step 3, because this was the only thing that worked at all.

I’ve been waiting for support to get back to me on various bugs for half a week now and so far no response. This is such a critical time I can’t just drop oFusion or I would and ask for a refund and hire someone to program a decent exporter. Maybe the author is ignoring me. I’m trying really hard to keep a neutral tone in my bug reports but maybe some of my frustration is showing through.

End loss: $1200, plus about 200 hours of my own time, 100 hours of artists time.


Using halfLambert

Seems I misunderstood. Thanks to Enrico for this suggestion:



N dot L vs. (N dot L) * .5 + .5

Per Enrico’s suggestion:

N.L vs N.L *.5 + .5

It seems to just add an emissive light of .5 for each light?


Shader with light support

Finished rewriting the normal map shader. Supports ambient, diffuse, specular, and emmisive.

3 lights

It’s pretty optimized.

I feel good about learning but also upset that this should have been done 8 months ago by the original graphics programmer I hired. As I look around at samples, I realize he didn’t really write anything at all, but copied from those samples and made some minor changes. The result didn’t support the features I asked for and was slow.

Last week I sent the shader to another company to optimize it. What I got for my $400 was something twice as fast but was buggy.

So I went over it myself today, fixed all the bugs, and made it twice as fast again.

Funny how I, with 2 months of training and no experience doing this, can beat a supposed lead programmer and an outsourcing game company in one day. Or maybe this isn’t a reflection of how good I am but how bad I am at picking competent people to work for me.