So much lost time…
So today I started implementing SSAO, and it was demoralizing…
I was looking into my old SSAO shaders, and I decided to implement the simple version before moving towards more complex versions, and I hit the first hurdle…
When I started work on my deferred renderer (which was going to be used by the SSAO stuff), I had to compute the world position of the pixel of the rendered image, based only on the depth at that point. But at the time, I wasn’t getting the math right, and since I had a self-imposed deadline, I cheated and stored the world position into one my render targets, to be changed at a later time… Well, that later time never came, which means that the reconstruction of the position was never done… Since I don’t want to make the same mistake again, I started working on that for this shader… and again, I couldn’t get the math right!
After a long time looking at the math and the parameters, etc, I finally found out what the problem was… I was computing the position correctly, yes, but relative to the camera, not the actual world position. So, basically I was interpreting the data wrong…
After this revelation, I could change the shader to display normals if the distance in X is lower than 10, and the depth if it’s higher:
I think view-space position is good enough for AO, since it’s all relative for its sake, but then I still have the problem of the normal… The normal is a world-space normal, so maybe I have to change it so it’s a view-space normal instead to be able to use it this way, which would require me to do some math on the pixel shader to account for that… Need to check if I actually need it in view-space… I can find good reasons for both, so I really need to go into the math…
Now listening to “The Metal Opera, Part I” by “Avantasia”
Link of the Day: All gamers have a backlog… Mine is mostly on Steam, and thanks to this nifty site, I can see how much time it would take me to play through all my unfinished games on Steam: About 105 days… Check yours out at http://steamleft.com/
Comment
You must be logged in to post a comment.