PDA

View Full Version : Fuzzy Objects



Rchr_3
04-09-2002, 06:54 AM
Hello

Nobody has an answer in the beginner forum, so I take one step and make my request to the OGL maters ....

To be simple, I have a square drawn on top of a background..What are the OGL technics to have the edges of the square to be a litle bit fuzzy ?..Like having noise around the square

Thks

Richard

knackered
04-09-2002, 06:58 AM
How do you mean, fuzzy?

Devulon
04-09-2002, 07:02 AM
The answer is different depending on what you are actually trying to achieve. If you are trying to simply antialias the edges then this is done through the multisample extension. (Forgive me but I don't remember exactly what it is called but it should be easy enough to find on this site or on nvidia's extension list on their developer site.)

It doesn't really sound like that is all you want. Seems like you want perhaps some sortof "noisy" halo. Jittering into the accumulation buffer can achieve this affect as well as an equivalent to multisampling. This may be best done with a texture that has a border that is noisy in the alpha channel. Then you simply need to draw the polygon larger and provide appropriate texture coords.

I think I could be of more use if you clarify what it is you are trying to achieve.

Hope this helps.

Rchr_3
04-09-2002, 07:05 AM
Originally posted by knackered:
How do you mean, fuzzy?

Let say my bckgd is white my square (or cube)is black. So after a normal display of the cube I have black/White transition only. What I want is instead of having sharp edges I have smooth transition (ie when you look at a B&W photo all edges are fuzzy)

Is that make sense ?

Devulon
04-09-2002, 07:14 AM
I still say for performance go with either 2 textures or even drawing 2 objects. There really are a miriad of ways. One of the benefits if this is only going to be a rectangle or triangle is that its doable with just a simple texture trick. If it was an object composed of multiple tris it gets a bit more tricky although not that bad.

What you are really trying to do is apply noise along edges in an image. This is entirely an image processing issue which opengl can actual help you with. Using Convolution and probably a Discrete Fourier transform. This of course is slow and significantly complicated unless you understand a fair amount of discrete math and signal processing.

I have only one question. Would it be ok to have the entire scene become noisy or do you really only want the edges to be such?

jwatte
04-09-2002, 12:31 PM
Highest performance would be to glScissor (x/4, y/4), render a sixteenth-size scene into that part of the buffer, glCopyTexSubImage into a texture, and then glScissor to the full screen and render a single quad with the generated texture texels on it. Linear interpolation should make everything nice and fuzzy. Performance should be adequate, too.

Rchr_3
04-10-2002, 04:48 AM
Originally posted by Devulon:
I still say for performance go with either 2 textures or even drawing 2 objects. There really are a miriad of ways. One of the benefits if this is only going to be a rectangle or triangle is that its doable with just a simple texture trick. If it was an object composed of multiple tris it gets a bit more tricky although not that bad.

What you are really trying to do is apply noise along edges in an image. This is entirely an image processing issue which opengl can actual help you with. Using Convolution and probably a Discrete Fourier transform. This of course is slow and significantly complicated unless you understand a fair amount of discrete math and signal processing.

I have only one question. Would it be ok to have the entire scene become noisy or do you really only want the edges to be such?


I was thinking of doing Fourier transformation to detect edges after rendering my scene and then applying a noise filter.but the pb is that will kill my CPU ...

But I'm going to try jwatte solution with glScissor. I'll let you know

Thanks for your help