Jump to content
  • Advertisement
Sign in to follow this  
XiotexStudios

Noise filter

This topic is 4504 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

Hi, I want to apply a noise filter as a post-process effect to my scenes. The shader version is fine but I was wondering if anyone had a good technique of a shader-less noise filter that doesn't involve locking a texture and filling it with noise :) I experimented for a while with shifting a 'noise' texture but maybe I am being too perfectionist but I began to notice the repeating patterns.

Share this post


Link to post
Share on other sites
Advertisement
What I'd do is create a 512x512 texture and fill it with noise once. Then render a grid of triangles across the screen, each one being something like 64x64. Every frame, change the texture coordinates of the top left vertex to a random value, and set the others to fit properly - so you get a 1:1 mapping of texels to pixels.

The larger your texture and the smaller the size of the grid, the more noise-like it'll look. Since you're changing the texture coordinates to a random value, there shouldn't be any noticiable patterns.

Share this post


Link to post
Share on other sites
I may be mis-reading you here..

Are you saying that you set each 64x64 section to a random offset or just apply the offset once to the top left tri/quad and bubble the offset to the rest of the tri/quad's (with their relative position in mind?).

Share this post


Link to post
Share on other sites
Sorry, I'm useless at explaining things [smile]

If you have a scene that's 1024x768, then you'd get 16x12 "tiles" of 64x64. Each of those tiles would be made from 4 vertices, and the top left vertex in that tile has a random UV offset.

Something like:

for(int y=0; y<12; ++y)
{
Vertex* pFirstVert;
for(int x=0; x<16; ++x)
{
pVertex->u = random_float(); // 0..1
pVertex->v = random_float(); // 0..1
pFirstVert = pVertex;
++pVertex;
pVertex->u = pFirstVert->u + 64.0f/512.0f;
pVertex->v = pFirstVert->v;
++pVertex;
pVertex->u = pFirstVert->u;
pVertex->v = pFirstVert->v + 64.0f/512.0f;
++pVertex;
pVertex->u = pFirstVert->u + 64.0f/512.0f;
pVertex->v = pFirstVert->v + 64.0f/512.0f;
++pVertex;
}
}



Or something like that anyway.

Share this post


Link to post
Share on other sites
thats olay - I am useless at understanding them :)

I'll give that a go - cheers!

Its one of those problems that seems insignificant when compared to all of the other features of an engine and yet proved difficult to get a 'good' result.

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!