Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Axis & Allies 1942 Online is now available in Early Access! Buy it on Steam. The FAQ is available.
New Premium Module: Tyrants of the Moonsea! Read More
Attention, new and old users! Please read the new rules of conduct for the forums, and we hope you enjoy your stay!

Shader experiments - Normal inspector

SorenSoren Member, Developer Posts: 35
I was toying with the idea of making a SSAO shader when I realised that most adaptations of these have a faulty way of determining normals (as far as I can tell anyway - perhaps it's a performance thing?). Either way, since I love trigonometry and a challenge, I decided to try to figure out the math.

This resultet in this little thing - a normal vector inspector - that might not have overly much practical use, but I thought it worth sharing anyway, if nothing else then to give a hint of what we can do with shaders (once we have mipmaps/lod for the FBO *nagging @niv *).

In it's basic form, all it does is render a normal vector of the current surface that the mouse is hovering. There's also an option of rendering the depth buffer of the entire view and alternatively the normal vectors of the entire screen (see below)

You can get it here: download

Put in your Neverwinter Nights override folder (the one under "My Documents") and enable the Depth of Field shader in game. It'll overwrite that, so once you are done toying with it, simply remove the file again to revert to normal.

Here's some screenshots:

To render the entire scene as depth, remove the "//" from "//color = Depth(color);" near the end of the file.

To render the entire scene as normals, remove the "//" from "//color = NormalVectors(color);" near the end of the file.

Mind you, it's not perfect - certain things were omitted because the impact it was minimal (like projecting back from focal point to screen). Still, any suggestions for improving the math is highly welcome!

Cheers :smile:



Sign In or Register to comment.