Skip to main content
GameDev.net gamedev.net
🔒 Locked

A small gift for all :)

Started by Nik02 Jul 12, 2003 at 5:57 PM 9 replies 5.2k views
Original Post
Nik02
Nik02
Hi all, posted this to the lounge, but this has always been my forum of choice! http://koti.phnet.fi/sunin/marzipan2.jpg rgds Nik
Niko Suni
Impossible
Impossible
Looks nice, does the name Marzipan have any relation to Homestarrunner?
kooktroop
kooktroop
i want to adopt one of the pigs ^_^
Do not remove a fly from your friend's forehead with a hatchet.Chinese Proverb
Yann L
Yann L
Heh, nice

The lighting looks like spherical harmonics, actually.
vanillacoke
vanillacoke
what the f is spherical harmonics? I was looking for info on it once and I couldn''t find anything at all.
You know what I never noticed before?
Soccerman4
Soccerman4
OMG!!!111!!1 tEh homestarrunner is teh GREATEST!!!!!!
I exist.
Nik02
Nik02
Hi all,

The lighting was calculated brute-force.
For every pixel of the lightmaps, rendering the scene with near-180deg fov, and taking the weighted average of the rendered area to the pixel''s lighting value.
Repeat this a couple of times, and you have an effective radiosity calculation, though not very physically accurate ?

This is very slow, at these map resolutions: It took almost 20sec to render on my GF2 w/2048x2048 lightmaps.

Then again it''s not yet micro-optimized, _and_ if i had HW vertexshaders, it should probably be a lot faster.

Homestarrunner? I don''t know what that is.

I don''t know the term ''spherical harmonics'', but the per-pixel light weight contribution forms a sphere tangent to the pixel
I suspect these have something in common.

And last, the pigs are not for adoption, they''re my valued test subjects. They have continuous parameter UV mapping, that is they are very rare and hard to breed.
Niko Suni
Yann L
Yann L
quote:
Original post by Nik02
The lighting was calculated brute-force.
For every pixel of the lightmaps, rendering the scene with near-180deg fov, and taking the weighted average of the rendered area to the pixel's lighting value.


Do you run this once as a preprocess, or at runtime, before every frame ? In the later case, you would indeed have a simple brute force realtime radiosity algorithm.

quote:

I don't know the term 'spherical harmonics', but the per-pixel light weight contribution forms a sphere tangent to the pixel
I suspect these have something in common.


You currently gather all the light shining on a lightmap texel over a 180° hemisphere, and set the texel to the average lightcolour. Spherical harmonics are similar, but they store the incoming light over that hemisphere as a mathematical function at each texel. So you don't store only an average colour per texel, but an equation that represents the entire incoming light from all possible directions. It's basically a precomputation, but you can dynamically modify the lights at runtime, effectively approximating realtime radiosity at a very small performance hit. It has a few drawbacks, though, especially with local pointlights.

Due to the parametric nature of SH light, it produces a very soft, characteristic light atmosphere. The lighting of your two pigs reminded me of that.

For more information, check out the forum FAQ. There is an introduction to SH lighting under the spherical harmonics section.


[edited by - Yann L on July 13, 2003 7:39:56 AM]
Nik02
Nik02
I don't expect by engine to calculate the light solution realtime, the preprocessing runs at about 0.0001 fps on GF2!

My light contribution matrix at each texel _is_ a gaussian distribution function, or _weighted_ average. That is, the contribution of external light to texel at any given dir is cos(N).

The matrix at any given texel, in this render, is only 16x16 in size. That's the reason it runs even at this speed

BTW i optimized the actual framebuffer rendering, it runs @ about 80fps now!

[edited by - Nik02 on July 13, 2003 7:55:11 AM]

[edited by - Nik02 on July 13, 2003 8:22:24 AM]
Niko Suni
Nik02
Nik02
Hi Yann,

The SH stuff at FAQ is great! I''ll have a fast version w/dynamic lights implemented quite soon!

Looks like i was right about the equations all along my almost 2-year project. I just wish i would have known the terms sooner... could''ve saved me some major work...

Thanks for your support!
Niko Suni

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.