26 January 2009

GLSL and Point Sprites

I survived last week. Good.
I spent the last 3 or 4 days trying to replace a few spheres with a few point sprites hoping they would be faster. I'm not getting the feeling they're faster than using billboards, or even faster than drawing a few spheres. Even on my old machine. Anyway I finally got some point sprites that behave like real spheres on a 3D world. It's strange how hard it is to find any decent information about using gl_FragDepth, or Point Sprites with GLSL.
After doing a few drawings on my new white board I concluded that I need better pens. I also found out that
[code]gl_PointSize = radius * screen_height / (tan(fov/2) * distance);[/code]
is the correct size of a sphere. Start by drawing a frustrum triangle, split it in half and you're almost there. You can probably guess what the variables mean. After that it was a lot harder to find out that after z is normalized to [-1, 1] it still has to fit in the depth buffer that goes from [0, 1]. The OpenGL specificiation is not a very good reference.
Next step?

Labels: , , ,

xernobyl @ 22:20

2 comments


18 January 2009

Bike crash, oh bike crash.

How I missed you, bike crash. That great feeling of having my elbows bleeding. Yesterday a bike crash. Today, a skate crash.
Great.
Will I fall down some stairs tomorrow? Trip in a manhole?

xernobyl @ 02:12

0 comments


16 January 2009

shading some simplicity

Yesterday I changed my usual boring night at home by going out with a friend. We walked some 3 or 4 kilometers around the downtown and riverside of Lisbon. There's something special about walking over the dark narrow streets of Alfama listening to all that Fado coming from even narrower and darker streets. I need a better camera.
After walking from Rossio to Bairro Alto to Alfama, back again to Bairro Alto, from there to Cais do Sodré, with a stop at a very nice looking McDonalds with some nice stone arches, and back home to Saldanha, after that big walk I came home and felt inspired to code another shader for my collection. I'll call it the Merry-Go-Round shader. I'll eventually upload a video/animation of the effect somewhere. Maybe I could make a screensaver with it and sell millions!

xernobyl @ 14:41

0 comments


11 January 2009

I forgot to delete this...

...so I wonder: Did people desperately press F5 in vain for years waiting for a post here?
Well, here it is. Another one in a couple of years from now.

xernobyl @ 02:32

0 comments