Home » Community » Forums » Image of the Day » Screen Space Normals (SSN) + SSAO
  Intel sponsors gamedev.net search:   
[Control Panel] [Register] [Bookmarks] [Who's Online] [Active Topics] [Stats] [FAQ] [Search]
GameDev.Net Discussion Forums Image of the Day  Screen Space Normals (SSN) + SSAO
Send Topic To a Friend | View Forum FAQ | Track this topic | View Forum

 Last Image Next Image 
 Screen Space Normals (SSN) + SSAO
Post Reply 



SSN Pure

SSN + SSAO

Here an experiment of Screen-Space-Normals (SSN). They are entirely computed from the depth buffer, without using any other information. The advantage is, its not necessary anymore to store normals or a normal-map anymore. However, as a certain radius is necessary for the SSN computation, there will always be an inaccuracy for about this radius.

Perhaps its possible to extend this idea further and make it more robust. For the ones of you willing to experiment, I uploaded the shader code(GLSL) - it computes SSN and SSAO in one-pass (un-smoothed).

Feel free to use it for your own experiments!

Fragment shader source
Vertex shader source

[Edited by - spacerat on December 12, 2008 1:30:16 AM]


So I wonder... would it be more efficient to push out many more polygons without normal maps and let it compute shading like that, or less polygons with normal maps, but have to include the normal map in the whole picture. Because if one ditches normal maps, the whole advantage of having > 1 normal per polygon kinda goes right down the tube. This is really interesting though and I'd love to hear what others have to say about it.

Cheers
-Scott


First of all, neat idea! Sometimes you can get a lot of geometric information from renderings of a scene at much lower cost than from the scene itself, and I like seeing new tricks.

That said, I would think you could calculate the normals more efficiently using a straightforward finite-difference scheme rather than the 'radius' stuff that you're currently using. This would require only five samples for second order accuracy and would be less sensitive to the choice of radius, and not need all the trig.

For example:

dw/du = ( w[u+eps,v] - w[u-eps,v] )/(2*eps)
dw/dv = ( w[u,v+eps] - w[u,v-eps] )/(2*eps)

normal[u,v] = ( [u+eps,v,w+eps*(dw/du)] - [u,v,w] ).Cross( [u,v+eps,w+eps*(dw/dv)] - [u,v,w] )

here w the true depth (i.e. not the biased and scaled values directly from the depth buffer), u is the x-coordinate of the current pixel in screen space, v is the y-coordinate in screen space and 'eps' is a small value (a pixel width or larger in screen space).

This will give artifacts at the silhouettes of objects but you should be able to avoid those by using one-sided differences if the sample depth values vary wildly from the value at that point. A search for "finite difference" might be helpful if you're not sure what this means.

Of course, if you're doing SSAO and sampling all those points anyway, you may as well just do it your way :)





Quote:
Original post by spacerat
The advantage is, its not necessary anymore to store normals or a normal-map anymore.


Sorry but I disagree. Consider a flat wall viewed head on, this will give an identical screen space normal at every pixel. A normal map will not.

While potentially useful for effects such as SSAO this is not a replacement for normal mapping / writing normals to a buffer in defered rendering.

[Edited by - Martin on December 19, 2008 6:04:03 AM]


AFAIK, you all seem to overlook that the OP is not rendering polygons but voxels. Hence all the speculation on normalmaps and flat-wall-polygons is pointless.

Besides the neat lighting, I'd really like to see the renderer in action... Spacerat, would you please make a demo-exe available for us all to play around with?


What are you exectly using to create the depth information? Are you rendering polygons or is this some kind of voxel engine?


He's using RLE voxels iirc. The SSAO looks spectacular, but what are those faint scanline looking rectangles on the right side of the screen?


Thank you for all the comments.

@Scott:
yes, in case of polyonal data it might not be so efficient as you not not have such a high amount of normal data - also you can easily get the surface normal there on the fly from the three vertices. As Skynet mentioned, the main purpose of this algorithm is voxel data. Usually its necessary to store one normal for each voxel - and thats a lot for the dataset above. The pure surface data already has 200 MB (2048^3 voxels) which means about 70MB of normal data would be necessary in addition to that.

@James:
The idea to include the derivative in the sampling process sounds interesting - would be worth a trial. I only dont know if it works well on voxel data, as the surface is not very smooth in this case..
Silhouettes are indeed a problem - I think for an optimal result, it might be necessary to do some sort of edge detection with segmentation..
Once I came over a paper doing this in an offline process, but I didnt see this yet for interactive applications.

@Martin:
Yes - it wont replace normal maps that was a mistake.

@Skynet:
I am currently in Germany over holidays and dont have all my development stuff with me. I hope I can put a movie or demo online when I'm back in Japan.

@PeterV:
Yes,its an RLE voxel engine, as Blindside mentioned.
Original Paper (1992)
Voxlap technology (2000)
CUDA demo of me without SSN (2008)

@Blindside:
The scalines on the side are just a debug output of the algorithm - its not related to SSN.

[Edited by - spacerat on March 9, 2009 6:48:10 AM]


All times are ET (US)

Post Reply
 Last Image Next Image 
Forum Rules:
You may not post new threads
You may not post replies
You may not edit your posts
You may not use HTML in your posts
Jump To:
Administrative Options: