Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Graphics: Set anti-aliasing at RenderTexture #1274

Closed
ghost opened this issue Sep 4, 2017 · 15 comments
Closed

Graphics: Set anti-aliasing at RenderTexture #1274

ghost opened this issue Sep 4, 2017 · 15 comments
Assignees
Projects
Milestone

Comments

@ghost
Copy link

ghost commented Sep 4, 2017

It should be possible to control the anti-aliasing like on RenderWindow. Smooth changed in nothing.

My reason: I simply need to cache a Drawable. On RenderWindow I'm able to explain the anti-aliasing amount with ContextSettings. Is it possible to draw a Drawable and get a bitmap from it?.

@ghost
Copy link
Author

ghost commented Sep 6, 2017

@eXpl0it3r @LaurentGomila Yea, could you guys look this?

@LaurentGomila
Copy link
Member

I'd rather ask @binary1248 his opinion about it.

@eXpl0it3r
Copy link
Member

eXpl0it3r commented Sep 6, 2017

@JonnyPtn
Copy link
Contributor

JonnyPtn commented Sep 6, 2017

I'll throw my hat in as someone who's wanted this for a while and would make use of it - I also know of others who would appreciate it.

If the answer is still "It's too much effort", then I'm happy to put effort in to work on an implementation

@binary1248
Copy link
Member

The TL;DR of my posts is: you don't have to supersample your intermediate surfaces if you make sure that aliasing can't happen when rendering to them. If you supersample both intermediate surfaces and final framebuffer you will end up losing more image quality than if you only did it in the final render pass.

This is like video editing: You don't compress your source video and edit the compressed clips into a final output. You work at the native resolution in some raw uncompressed format and only compress right before publishing it.

@ghost
Copy link
Author

ghost commented Sep 11, 2017

@binary1248

I did something like that with the green circle example. I drew the circle on a render-texture without anti-aliasing settings, then did get the render-texture's texture after drawn and drew it on a render-window. No anti-aliasing did happen at the end...

In order to enable anti-aliasing samples, someone suggested me to use context-settings on a context, making sure the render-texture is the active context. Though I couldn't compile my test code because the Context constructor is deleted. :/

@naezith
Copy link

naezith commented Sep 16, 2017

I'd also love to have this because my whole game is on a RenderTexture, I draw that to RenderWindow.

@binary1248
Copy link
Member

@naezith Are you applying some full screen post-processing or is there another reason that you need to do this?

@naezith
Copy link

naezith commented Sep 16, 2017

@binary1248 Yes, vignette effect shader.

@binary1248
Copy link
Member

@binary1248 binary1248 self-assigned this Sep 17, 2017
@binary1248 binary1248 added this to the 2.5 milestone Sep 17, 2017
@binary1248 binary1248 added this to Review & Testing in SFML 2.5.0 Sep 17, 2017
@naezith
Copy link

naezith commented Sep 17, 2017

@binary1248 Your test works nicely.

I tried it in my game, it's not good for me.

It makes the tiles bleed as you see in this GIF:
aa8

Also I expected my water shader to look smoother but it does not help on that. Can you explain why?

Without AA
aa0

With AA
aa8

@binary1248
Copy link
Member

@naezith If with "bleed" you mean the seams that appear in between tiles, that is a side-effect of drawing them on individual polygons with multi-sampling enabled. OpenGL is working as intended... if the tiles are supposed to align with each other they need to share vertices among other things so the rasterizer can resolve the samples properly based on the correct data.

As for your water shaders... you need to describe a bit more what I am supposed to be seeing... because I don't notice anything out of the ordinary...

@naezith
Copy link

naezith commented Sep 17, 2017

@binary1248 Yeah everything seems to work as it is supposed to work as you said. Just not a good option for me unlike I thought.

About water shader, Those bright white lines are normally rectangles drawn first. Then that area is passed to a frag shader. Then water bends and twists the background as you see there. The end result is pixelated, I expected AA to draw them smoother but I guess AA works only for the polygon's edge pixels.

@ghost
Copy link
Author

ghost commented Sep 17, 2017

@naezith Man, that's nice!

@eXpl0it3r eXpl0it3r moved this from Review & Testing to Ready in SFML 2.5.0 Mar 26, 2018
@eXpl0it3r
Copy link
Member

Implemented with #1285

SFML 2.5.0 automation moved this from Ready to Merged / Superseded Mar 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
SFML 2.5.0
  
Merged / Superseded
Development

No branches or pull requests

5 participants