July 19th, 2007

camera

While waiting for more important things

My network is being slow today, so here I am posting (consuming bandwidth) about my ray tracer project (which consumes my brain, but not like a zombie).



Click on the picture, if you like.

The two changes since the last picture are:


  • A little more sensible field of view. I'm not sure, but I think the old one was something like 120 degrees horizontally, and this one's only 50 degrees horizontally. It looks much less distorted and weird.
  • Shadows. Mom always said that 3d platformers need shadows so you can time your jumps correctly. It also applies to cubes sitting on tables, or potentially levitating above tables (that's for later, really). The lighting that's going on here is super hacky and temporary, but there is actual darkening of the shaded sides of the cube (that's a simple dot product with the light direction) as well as points in the umbra (fancy word for shadow) of the table correctly being darkened.

    So, I guess what I mean to say is that the calculation of what's being lit is good solid code - the top of the cube, the areas outside the umbra on the table, that's all being categorized as lit, and the other stuff is correctly categorized as being in shadow. The logic that goes from that to say "this should be bright green" or "this should be dark green" or "let's make this black", that's temporary and will be replaced in time.


If you're curious about the direction I'm going with this, you might check out Fiat Lux by Paul Debevec. He's done a bunch of cool rendering/imagery stuff that inspires me. The big conceptual shift that revolutionized the way I think of computer graphics is to remove the 8-bit brightness assumption from the internal representation of lights and colors. It's catching on, and games are beginning to talk about High Dynamic Range (HDR) technology to say that they're trying to be a little smarter about how they represent illumination.

Rendering a shiny movie is only one of the directions I'm interested in going with this. If that's all I wanted, I could probably use an off-the-shelf tool of one sort or another. (POV-Ray? Blender?) But by making it all myself, I will have the ability to support data formats of my choice (maybe I like Collada today, maybe it's something else tomorrow), support weird camera descriptions (I want to smoothly morph from an orthographic to an isometric to a perspective view - that can't be that hard, if I'm writing the camera code), and support breaking the pipeline at various points and using subsets of it (for example, to pull out shadow maps as textures to be used in a realtime project of some sort).
doodles

(no subject)



This has an application, and it ties in to that ray tracing nonsense, and it ties into an after-hours programming project, but the basic idea is - what's the deal with boring old RGB values?

I wanted to get 20 discrete colors as separated as possible in colorspace, and this is what I came up with.

A less useful display of the same colors is here:



That looks an awful lot like the old Apple ][ low res graphics palette. But I'm a little concerned that the greens all look so similar. I know that human perception's a crazy thing, and RGB space isn't as useful as, say, YUV space for representing perceptual color. So, maybe I'll take another run at this in a bit.

But hey, I've just printed this out, and I'm going to cut it out and fold it to look at in more detail.




ETA: Ok, duh. I folded together the paper model of the picture above, and it's clear to me now one of the problems. I was worried that the greens were so similar, and it looked like the pinks were, too - there's a good reason, and I should have been able to see it in the unfolded image, above.

What I was trying to accomplish was spread the colors out as evenly as possible, but if you look at the two magenta-pink-ish dots in the center, they're practically on top of eachother, while the yellow dot is much further away from the white dot.

Ok, back to the drawing board.




ETA2:

You math geeks out there may be ahead of me on this one, but I just did some poking around and stumbled on this page:

http://mathworld.wolfram.com/Dodecahedron.html

And, in particular, there's a cube inscribed in a dodecahedron, which might be very close to what I need - it's a simple pattern, and I can do the mathematically simple projection, or I can tweak a single number (as opposed to three, which I had been attempting).

Also, all 8 of the vertices of the RGB cube coincide with vertices of the dodecahedron, which means the popular colors all show up for free.