Jump to content
  • Advertisement
Sign in to follow this  
thekie

SSAO random texture

This topic is 3242 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, I've got a short question to the ssao implementation of crytek. They are using a 4x4 random texture to rotate the sample kernel. What kind of values are saved in the components of the texture? How do they get a rotation matrix from that? (I've got the code from ShaderX7, but dont understand the math behind it.) Thx! .kie

Share this post


Link to post
Share on other sites
Advertisement
Hi.

I implemented SSAO from this article and I used a simple rand() function
from C++. Just fill the texture with rand() and use it.

It is some time ago I implemented this one, but the math behind it is to randomly sample depth values with the vectors from the texture, if I remember right.

Share this post


Link to post
Share on other sites
For each pixel you read a single RGB-value and let this represent a 3D-vector. This vector can be used to reflect each of the vectors in the sample kernel.

something like this:

float3 randomPlane = tex2D(randomSampler, IN.UV * viewportPixelSize / RandomTextureSize).xyz;

for(int i = 0; i < NUM_SAMPLES; ++i)
{
float3 currentSamplePosition = reflect(samples,randomPlane);

//Do all the other SSAO stuff
}

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!