Jump to content

  • Log In with Google      Sign In   
  • Create Account


Render-to-texture different from render-to-framebuffer


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
5 replies to this topic

#1 irreversible   Crossbones+   -  Reputation: 1182

Like
0Likes
Like

Posted 11 September 2012 - 02:37 PM

I have my regular GUI code looking the way I expect it to. However, due to certain optimization requirements, I'm now trying to double buffer portions of my GL-drawn window controls. This has brought up an unexpected surprise - there are minor differences between the double buffered and the directly drawn graphics.

Attached are two images - the first one is the direct draw result and the second one is unscaled FBO output blitted into the frame buffer (a matching quad drawn in ortho mode). Images are captured via PrintScreen, not copied from the GPU. I've blown them up 400% (no interpolation) to accentuate the minuscule changes - notably the corners of the rects are visibly different, even at 100%.

The FBO target has filter mode set to GL_NEAREST for both min and max, it's a 32 bit non-float RGBA image (same as the frame buffer) and mipmaps are disabled.

It's hard to post code unless I know where to look as everything's neck-deep in a larger framework.

I'm probably missing something really obvious here so if anyone can point it out, that'd be awesome Posted Image

Note - the one-pixel vertical blur on the right of the rects in the first image is due to a 0.1 subpixel shift to emulate slight antialiasing. Looks better at 100%.

gui1.png gui2.png

Edit: added the third screenshot of a GL_LINEAR/GL_LINEAR target.

Attached Thumbnails

  • gsl3.png

Edited by irreversible, 11 September 2012 - 07:38 PM.


Sponsor:

#2 Kaptein   Prime Members   -  Reputation: 1843

Like
0Likes
Like

Posted 11 September 2012 - 06:13 PM

well, nearest doesn't interpolate any values
so, thats why its different.. the old image obviously had bilinear (cheap) interpolation Posted Image
write quintic interpolation in your frag shader! or not, depending onwhat you need
lots of funky curves to make the pixels smooth.. but since its a pixel game, maybe not

please not that bilinear only looks like crap when you zoom in lots, like walking up to a mesh in a (any) first-person game

Edited by Kaptein, 11 September 2012 - 06:15 PM.


#3 irreversible   Crossbones+   -  Reputation: 1182

Like
0Likes
Like

Posted 11 September 2012 - 07:37 PM

I added a,interpolated version of the FBO target (min and mag filters set to GL_LINEAR) to the original post. Notice the lack of detail.

In any case, the problem seems to be elsewhere.

#4 Kaptein   Prime Members   -  Reputation: 1843

Like
0Likes
Like

Posted 12 September 2012 - 06:33 AM

ok clearly you have a megazoomed image, so no bilinear
but subpixel shift, i dont understand, you CANT get mixed colors with nearest unless you do it by hand in shaders
and make sure the screensize is at least an even number...

#5 Hodgman   Moderators   -  Reputation: 27043

Like
0Likes
Like

Posted 12 September 2012 - 06:38 AM

The FBO target has filter mode set to GL_NEAREST for both min and max

Is this regarding the step where you blit the FBO to the screen, or the step where you render your GUI into the FBO?

#6 irreversible   Crossbones+   -  Reputation: 1182

Like
0Likes
Like

Posted 12 September 2012 - 01:58 PM

This is for the FBO target (eg the texture that the GUI is rendered to). Like I said, I'm probably missing something really obvious here, but I don't see why it would affect texture drawing to the screen.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS