What's new

Zelda MM point lighting

Orkin

d1R3c764 & g1|\|64 m4|<3R
Gonetz said:
May I ask, how did you found it? I did not found information about Point lighting in the N64 Programming Manual. Besides, light structure is defined as :
...
so, where is the light's position?

MM uses a custom microcode, so it's not covered in the programming manual. There's a slightly different light structure used by point lights where the position is stored as 3 s16 values right after the color information. It's apparently 4 bytes larger than the normal light structure too. It appears that there's another 2 bytes of data stored in the point light structure after the position, but I have no idea what it's for yet.
 
OP
Gonetz

Gonetz

Plugin Developer (GlideN64)
Orkin said:
It appears that there's another 2 bytes of data stored in the point light structure after the position, but I have no idea what it's for yet.
Constant and linear attenuation? BTW, you have to calculate distance between vertex and light source to calculate attenuation. Lighting calculation is a hard calculation task by itself, plus this... How N64 managed to run this?
 
OP
Gonetz

Gonetz

Plugin Developer (GlideN64)
Orkin said:
[sarcasm]That Jabo...always holding out on us![/sarcasm]

It looks like the problem is the point lighting is supposed to be applied to link as well as the world geometry, but the way we're handling it now, it's not?

Why sarcasm? Jabos skills and knowledge are exceptional with no doubt. The were rumors that Jabo did LLE plugin, but it was never released to public as it was slow and buggy. Considering the fact that Jabo is the author of the best RSP plugin, I'm ready to believe in it.

As for Link, I don't understand, why your point lighting implementation have broken lighting on him.
1. Link was always lit by directional light before point lighting was implemented. There were flashing polygons on walls and floor, but Link was looking correct.
2. As I see in my logs, point lighting is not applied to Link. Thus, for him nothing should be changed.
Am I wrong?
 

Orkin

d1R3c764 & g1|\|64 m4|<3R
The sarcasm was because he did so much for the community, he hardly held out on us...although I would love to take a peek at the source to his video plugin...

I found the problem with my point lighting implementation. Link is lit correctly again in Direct64 (see screenshot). Part of my code was still looking at what I had originally thought to be the way point lights were identified, instead of using the geometry mode flag. It works fine now. And it appears I was wrong...a triangle can only be lit by point lights or directional lights, they can't be used at the same time. I'm still using a hacked linear attenuation distance of 256 though. It looks okay, but I'd like to figure out how this was done on the N64...I'm not sure those last 2 bytes in the point light structure are used afterall. They seem to change at strange times, such as when the fairy appears and disappears. Looks like they may just be padding.

I'm not sure how they managed to do all these complex operations on the N64 with decent FPS, but apparently they did. Without attenuation, everything's way too bright. They may have used the square distance (quadratic attenuation) in the calculations...that would cut out the sqrt anyway.
 
Last edited:

Federelli

Beta Tester
There's an area in Woodfall temple where only point lightning is used and it looks amazing in Rice's latest plug. I have a save if you want it.
 

Rice

Emulator Developer
Lighting effects are processed by RSP in software, not in hardware.

Federelli, why not post some great screen shots.
 

Orkin

d1R3c764 & g1|\|64 m4|<3R
Rice said:
Lighting effects are processed by RSP in software, not in hardware.

But the software is limited by the speed of the hardware, and point lighting compared to directional lighting adds an extra vector sub, normalization, dot product, square root, at least one multiplication, and possibly a division for each vertex. That's quite a bit of extra calculation. Which is probably why it's only used in relatively simple, closed-off areas, and only on world geometry.
 
Last edited:

Rice

Emulator Developer
Ya, I agree.

Btw, in the last two shots Federelli posted above, I wonder if the scene should not be so dark and if some other lights should be applied besides the point lights. The screen shots look great, though.
 

Dysprosium

Graphics Designer
Rice said:
Ya, I agree.

Btw, in the last two shots Federelli posted above, I wonder if the scene should not be so dark and if some other lights should be applied besides the point lights. The screen shots look great, though.

I believe they are supposed to be that dark, Rice. If I remember correctly, a couple of rooms in Woodfall required you to light up all of the fire places to move on. It would open the door, but the room was pitch black until you lit them. ;)
 

Federelli

Beta Tester
That room is meant to be dark on purpose, since you are attacked by the darkness, it looks like that on the N64.
Anyway be aware that my gamma and brightness are both at 1, therefore it's darker.
 

Top