View Full Version : Zelda MM point lighting
Gonetz
March 7th, 2005, 11:04
I want to talk about “point lighting” implemented in RiceVideo 6.1.0. Yes, with this feature ZeldaMM looks much more correct. But is it 100% correct? Since I don’t have N64 console, I can’t answer this question. However, I can analyze Rice’s plugin work. As I see, point lighting means that under some condition all directional lights are ignored and only ambient light is used. Well, may be it must work this way. However, sometimes it looks strange. Look at these screen shots. On the first screen Link is flat lit (no directional lights used). One step aside and he becomes lit by directional light. Why? What is so different in both cases? I think, light sources are the same. So how to explain directional light absence on the first screen? May be somebody can post screens from real system?
Rice
March 7th, 2005, 16:34
Gonetz
The implementation in my plugin is just better than before, as you said, it is not way to be accurate. One thing we are sure is that directional lighting, ambient lighting and point lighting are all used in this game.
I would like to see some shots from the real console, too.
I would like to see how Orkin has done with his Direct64 plugin about this.
Reznor007
March 7th, 2005, 17:44
I have my N64 connected to my PC and can take screenshots if you want. Just tell me a place to take them. It has to be in town though, as my MM cart doesn't have any saves on it right now(I beat it on Gamecube).
Sirmatto
March 7th, 2005, 17:52
It's been ages since I beat this game, but I do still have my N64 and game still. If somebody can tell me what point in the game is best, I can find my digital camera and I can remember after sitting through my hydraulics class for a very long time, I'll gladly take a picture and post it if no one else does by the time I get back
Orkin
March 7th, 2005, 19:02
Point lighting is where the light's direction is computed per-vertex by finding a the normal from the light's position (specified in the light structure) to the vertex. I haven't completely figured it out yet either (still working on how it's supposed to be attenuated), but I don't think my implementation in Direct64 has the problem you mentioned, Gonetz. At least, I never noticed it. I'll check tonight after work...
From what I can tell, directional and point lights can be used at the same time (they can in Direct64 anyway), but MM will usually set the directional lights' colors to black when using point lighting.
Orkin
March 8th, 2005, 21:26
I was wrong. Direct64 does the same thing that's shown in the screenshots above. However, it's not a problem with the point lighting, as disabling it leaves the same issue.
Could this be the way it was on the N64? Or maybe there's another type of light that we're still missing?
A few shots from the N64 of the bomber tunnel could help out...
Sirmatto
March 8th, 2005, 22:32
A few shots from the N64 of the bomber tunnel could help out...
I know I promised I'd get around to it yesterday, but I'll do it later today, in maybe 3 or 4 hours.
Federelli
March 9th, 2005, 01:51
Not the bomber hideout, but still, point lightning is used here as well at night (shop alley)
http://www.gamespot.com/n64/adventure/legendofzeldamajorasmask/screens.html?page=247
Sirmatto
March 9th, 2005, 02:28
Ok, here are the pictures I promised. No one told me any place specific, so I just took the bomber's hideout. Seems a lot more illuminated than using and emulator with Rice's plugin. But if you want anymore pictures, let me know the place and the position you want me to stand at. And the last picture is just to show how awesome I am.
And sorry for the grainy pictures, I lost my S-video out cable for the N64 and am left for now with composite only. I will try to take better picture if these actually help and are useful for this topic.
Reznor007
March 9th, 2005, 03:53
Here's some shots taken from my real N64 using a TV card and Svideo input. I tried to get hte exact same shot as Rice.
http://members.cox.net/rdawkins1/1.jpg
http://members.cox.net/rdawkins1/2.jpg
http://members.cox.net/rdawkins1/3.jpg
http://members.cox.net/rdawkins1/4.jpg
Reznor007
March 9th, 2005, 03:56
I was wrong. Direct64 does the same thing that's shown in the screenshots above. However, it's not a problem with the point lighting, as disabling it leaves the same issue.
Could this be the way it was on the N64? Or maybe there's another type of light that we're still missing?
A few shots from the N64 of the bomber tunnel could help out...
The lighting on Link does not disappear like it seems to in the emulators shots. It's on him in the entire room.
Knuckles
March 9th, 2005, 04:31
like it does with Lemmy's Nemu64 video plugin...
Gonetz
March 9th, 2005, 06:07
Point lighting is where the light's direction is computed per-vertex by finding a the normal from the light's position (specified in the light structure) to the vertex.
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 :
typedef struct {
unsigned char col[3]; /* diffuse light value (rgba) */
char pad1;
unsigned char colc[3]; /* copy of diffuse light value (rgba) */
char pad2;
signed char dir[3]; /* direction of light (normalized) */
char pad3;
} Light_t;
typedef union {
Light_t l;
long long int force_structure_alignment[2];
} Light;
so, where is the light's position?
Gonetz
March 9th, 2005, 06:14
Ok, here are the pictures I promised. No one told me any place specific, so I just took the bomber's hideout. Seems a lot more illuminated than using and emulator with Rice's plugin.
The lighting on Link does not disappear like it seems to in the emulators shots. It's on him in the entire room.
So, Rice did a step in the right direction, but the problem is not fully solved yet. And thanks Sirmatto and Reznor007 for screen shots, they made the situation more clear.
Rice
March 9th, 2005, 06:28
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 :
typedef struct {
******
} Light;
so, where is the light's position?
Gonetz
If you read general reference for DirectX or OGL lighting, you will see that a point light does not have a direction. It has a position instead. Lighting direction to a vertex is then calculated from the light position to the vertex position. You can find more information about lighting computation in Microsoft DirectX documents (or other online resources).
Please also check your PM.
Gent
March 9th, 2005, 12:17
These were taken with a special Jabo Plugin he worked on from 2 years back that supports this.
Gonetz
March 9th, 2005, 13:07
I'd like to know why it was not included in the released version? May be it is that mysterious Jabo LLE plugin?
-Shadow-
March 9th, 2005, 13:58
It might be a dumb question, but was that plugin released to the public?
olivieryuyu
March 9th, 2005, 17:58
I'd like to know why it was not included in the released version? May be it is that mysterious Jabo LLE plugin?
hmm it would be very stunning that is Jabo LLE
the LLE functions that exists in Jabo plugins(1.5.1 and 1.4) are only for 2D stuff and i never succeed to get any 3D gfx with it. But well who knows except Jabo ?
Orkin
March 9th, 2005, 17:59
That Jabo...always holding out on us!
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?
Orkin
March 9th, 2005, 18:08
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.
Gonetz
March 10th, 2005, 06:36
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?
Gonetz
March 10th, 2005, 06:51
That Jabo...always holding out on us!
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
March 10th, 2005, 08:49
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.
Federelli
March 10th, 2005, 17:24
Well, you call 15-20 fps descent? (add AA to the numbers)
Federelli
March 10th, 2005, 21:25
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
March 10th, 2005, 21:33
Lighting effects are processed by RSP in software, not in hardware.
Federelli, why not post some great screen shots.
Federelli
March 10th, 2005, 22:12
Good enough? :)
Orkin
March 10th, 2005, 22:55
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.
Rice
March 10th, 2005, 23:26
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
March 10th, 2005, 23:43
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
March 11th, 2005, 02:23
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.
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.