

The Littlest CPU Rasterizer - zdw
http://ginsweater.com/blog/2014/03/10/the-littlest-cpu-rasterizer/

======
nwhitehead
Fun! When I saw spherical harmonics I was confused about why spherical
harmonics would come into play in a voxel universe (isn't everything flat?).
Digging into it a bit I found out more about spherical harmonic lighting:
[http://www.research.scea.com/gdc2003/spherical-harmonic-
ligh...](http://www.research.scea.com/gdc2003/spherical-harmonic-lighting.pdf)

~~~
ginsweater
The geometry may be flat, but relationships between objects are still
arbitrary, so light can still hit things from any angle. Try as you might, you
can't escape curves. ;)

That article's a classic; definitely worth a read for anyone interested in
graphics.

------
glbn
cool ! shouldn't it be:

U32 ind = (xx-xStart + (yy-yStart) * 16+ ( zz-zStart ) * 16 * 16) * 2;

in your code, though ?

~~~
ginsweater
Whoops, yeah, you caught me. As I handwaved in the post, there's a little bit
of implementation detail in the real code that I removed to clarify the
algorithm. Fixed now, thanks.

------
AnthonBerg
Wonderful! Great writing too, very clear and intuitive.

------
mrcactu5
i was trying to build a word cloud algorithm and then I had a question: how do
you rasterize letter shapes?

I looked at pyCairo but I couldn't figure out how to use it.
[http://cairographics.org/documentation/pycairo/3/](http://cairographics.org/documentation/pycairo/3/)

I asked on StackOverflow no answer
[http://stackoverflow.com/questions/21915335/getting-the-
bitm...](http://stackoverflow.com/questions/21915335/getting-the-bitmask-of-a-
text-string-in-python)

i found the true-type format shape files and extracted polygons from those -
which i also don't know how to rasterize.

i know this not really a response to the posted link - which is very low level
and interesting - but maybe someone here knows an answer.

~~~
ginsweater
I like stb_truetype myself. It's C so you'll have to bind it if you're using
any other language, but it's a lot simpler than Freetype. (Less features too,
but it'll take a .ttf and return a bitmap, which sounds like what you want.)

[http://nothings.org/stb/stb_truetype.h](http://nothings.org/stb/stb_truetype.h)

~~~
userbinator
It's always great to see things that people would consider nontrivial
programming tasks being done with a much smaller amount of code than they
would expect from looking at the more "mainstream" libraries that do it.
Public domain is a big bonus too.

In comparison, Freetype is absolutely monsterous; it is a few times faster
according to some benchmarks I've found, but a few orders of magnitude bigger
too. Sometimes you don't need the fastest, you just want something simple that
works.

------
userbinator
Reminds me of the sorts of techniques used in 4/64K demos.

------
wolfgke
Where can I find the complete source code?

------
gavanwoolery
Looks good! Are your models procedurally generated or did you create them in
an external program?

