Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 6 of 6

Thread: Request for Advise - Smoothing Line Edges and Otherwise improving Quality ...

  1. #1
    Intern Contributor
    Join Date
    Apr 2014
    Posts
    67

    Request for Advise - Smoothing Line Edges and Otherwise improving Quality ...

    Hello,

    So I finally got my project on the Oculus Rift! It was a good feeling but now it's a matter of drastically improving display quality.

    One of the most striking things I have noticed is that line edges are not really smooth at all. Below is a picture.

    How can I have crisp (or crisper) edges?

    Thank you for your time.

    Last edited by tmason; 05-16-2014 at 05:06 AM. Reason: For subscribing to my own thread...

  2. #2
    Advanced Member Frequent Contributor
    Join Date
    Apr 2010
    Posts
    788
    There are a huge number of techniques to reduce/remove these kinds of artefacts, they fall under the heading of "anti aliasing". It is my impression that lately techniques that work as a post processing filter have become quite popular, examples for this class of approaches are: Morphological Anti Aliasing (MLAA) and FXAA. More classic techniques are Super-Sampling and Multi-Sampling (which itself comes in a dizzying number of variations).

  3. #3
    Intern Contributor
    Join Date
    Apr 2014
    Posts
    67
    Thank you for your quick reply.

    Is there a quick way to do anti-aliasing on a texture attached to a framebuffer?

    I have the following texture/framebuffer setup which my application renders to for the Oculus Rift.

    Code :
            glGenFramebuffers(1, &g_OculusRiftFrameBufferObject_ID);
    	glBindFramebuffer(GL_FRAMEBUFFER, g_OculusRiftFrameBufferObject_ID);
    	glGenTextures(1, &g_OculusRiftTexture_ID);
    	glBindTexture(GL_TEXTURE_2D, g_OculusRiftTexture_ID);
    	glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, l_TextureSize.w, l_TextureSize.h, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
    	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR_MIPMAP_LINEAR);
    	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
    	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
    	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
    	glGenRenderbuffers(1, &g_OculusRiftDepthBufferObject_ID);
    	glBindRenderbuffer(GL_RENDERBUFFER, g_OculusRiftDepthBufferObject_ID);
    	glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT, l_TextureSize.w, l_TextureSize.h);
    	glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, g_OculusRiftDepthBufferObject_ID);
    	glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, g_OculusRiftTexture_ID, 0);
     
    	GLenum l_GLDrawBuffers[1] = { GL_COLOR_ATTACHMENT0 };
    	glDrawBuffers(1, l_GLDrawBuffers); // "1" is the size of DrawBuffers
     
    	g_DrawBufferStatusCheck_ENUM = glCheckFramebufferStatus(GL_DRAW_FRAMEBUFFER);
     
    	if (g_DrawBufferStatusCheck_ENUM != GL_FRAMEBUFFER_COMPLETE)
    	{
    		glBindRenderbuffer(GL_RENDERBUFFER, 0);
    		glBindTexture(GL_TEXTURE_2D, 0);
    		glBindFramebuffer(GL_FRAMEBUFFER, 0);
    		return false;
    	}
    	else
    	{
    ...
    }

  4. #4
    Advanced Member Frequent Contributor
    Join Date
    Apr 2010
    Posts
    788
    I suppose adding multi sampling would be fairly straightforward (assuming you are not on ancient/obscure hardware). See glTexImage2DMultisample for how to create a multisample texture that you can attach to your FBO. You may also need a multisampled renderbuffer for the depth attachment.
    Aha, there's even a description on the wiki

  5. #5
    Intern Contributor
    Join Date
    Apr 2014
    Posts
    67
    Quote Originally Posted by carsten neumann View Post
    I suppose adding multi sampling would be fairly straightforward (assuming you are not on ancient/obscure hardware). See glTexImage2DMultisample for how to create a multisample texture that you can attach to your FBO. You may also need a multisampled renderbuffer for the depth attachment.
    Aha, there's even a description on the wiki
    Thank you for the information. I will give this a shot.

  6. #6
    Intern Contributor
    Join Date
    Apr 2014
    Posts
    67
    Quote Originally Posted by carsten neumann View Post
    I suppose adding multi sampling would be fairly straightforward (assuming you are not on ancient/obscure hardware). See glTexImage2DMultisample for how to create a multisample texture that you can attach to your FBO. You may also need a multisampled renderbuffer for the depth attachment.
    Aha, there's even a description on the wiki
    Thank you so much for the help!

    Success:


Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •