Any way to achieve N64-esque 3D lighting?

(Disclaimer: this is probably a very basic question about lighting and/or shaders. I’m not too good with them)


So, I’ve been working on an N64-looking game for the past year now. It’s… a bit wonky, but I’ve kept it accurate to the style. Except, one issue has been causing me problems for the better part of the year, and that’s the lighting:

Try as I might, I can’t get the lighting in my game to resemble that of an N64 game (like Ocarina of Time for example). Either the shadows are too intense, and everything looks dark, or they’re near non-existent and the game looks next to unlit. For context, I’m using a custom shader which is near identical to the BasicEffect.

An example of what my issue is: the sandstone block on the left is just that, a block, yet its corner looks flat and the sides are blending together.

Is the problem with my lighting, or with my texture work? Is it even possible to achieve the type of lighting I want without adding extra lights to my shader? I’m not sure which part of my method I should change to accomplish what I’m after…

1 Like

You want to implement flat shading and gouraud shading:

“Lighting is another core feature of 3D graphics, which N64 implemented on its own way. In the simplest case, for lighting calculation we need color of the surface (provided via vertices), normals to the surface in each of its vertices, color of the light and light direction. OpenGL expects that all these components are provided to calculate lighting. Vertex color is blended with light color in proportions defined by the angle between light direction and vertex normal. Pixels get their color values through interpolation of vertices’s colors. This is known as Gouraud shading. N64 uses basically the same mechanism, but with essential optimization: N64 vertex structure use the same fields for color and normal. Thus vertex has either color information, when lighting is not used, or normal, but not both. But surface color is still necessary for lighting calculation. N64 does the trick: it provides light color already blended with surface color for the surface it is applied, and RSP calculates intensity of that color for particular vertex. This mechanism is not very suitable for implementation via standard OpenGL/DirectX functionality.”

from here:

also take a look at this:

1 Like

Thanks! I’ll take a crack at it when I get home. Hopefully it’s something I can figure out :stuck_out_tongue:

Well… progress…

I think this may be the best result I’ll get from just one light (I’ve also put in a limiter so that if the diffuse is between [0.25, 1] instead of [0, 1]).

I’m still not a fan of how the sandstone on the left is lit up compared to the wall behind it, but I suppose fixing that would require an area/spotlight and not just a directional light. I guess it wasn’t as much of a quick-fix as I thought it would be…

That, and I should just be painting more shadows into the actual textures themselves (and using vertex colour) rather than relying on lighting alone to do it (which is what the N64 did).

Thanks for the help mikehaggar (nice beat 'em up btw)!