Hello, I'm trying to create a game with a retro look, so I need to be careful that my pixels look crisp.
When I draw an image using Gosu::Image.draw_rot (default parameters, angle 0), there seems to be some blurring/anti-aliasing. Using Gosu::Image.draw, it looks perfect.
I made a quick example using a Mario sprite, see here: http://img541.imageshack.us/img541/8573/drawrot.png
Any tips on what I could do to prevent this blurring, or what would be causing it?
Rotation aliasing normally happens when the interpreter tries to render something to imaginary positions (as you only get exact coordinates for 90° rotations normally). Some image processing programs, however, show that aliasing also for exact rotations (90° steps), in which case I guess the exact rotations aren't excluded from aliasing or whatever...
Either way, what you're asking for is completely disable rotation aliasing, isn't it... that would make your sprites look incredibly cluttered, unless you're using a scaled up image (aka each "pixel" actually has 10x10 pixels, for example). But as aliasing normally adds up to an image's appearance during rotation, I wouldn't necessarily deem it an unwanted feature.
> Any tips on what I could do to prevent this blurring, or what would be causing it?
draw_rot will center the image on x/y, so if you use an odd width or eight, that may just cause it. (Effectively drawing the image at xxx.5 or yyy.5)
Of course, that only applies to angle=0, for other angles, the rotation will still be what OpenGL makes of it. I am not sure how rotations look with the (undocumented ;) ) Gosu::enabled_undocumented_retrofication feature. If they still look too new-school with that, you can only pre-render really oldschool rotations.
I can see why (and wouldn't have a problem with) aliasing when there's some rotation involved, I was hoping that the level of aliasing would be dependant on the amount of rotation though. Ie. 0 rotation = no aliasing, 1 degree rotation = slight amount of aliasing.
I don't think it'd be good for me to try to switch off aliasing entirely, because as you pointed out, it definitely has its place.
Thanks jlnr, I'll take a look at that..
Just confirming that giving the image even dimensions worked perfectly, problem solved. Thanks, guys.
Gosu::enabled_undocumented_retrofication ftw :) .. glad someone else then me needed it too ;)
> Gosu::enabled_undocumented_retrofication ftw :) ..
> glad someone else then me needed it too ;)
I used it too, but implemented it myself at that time :)
What I don't get is: Why didn't jlnr already document it? ;)
I want it. Whos willing to share?
I use it too; I guess he just thinks that he doesn't want to support it if it goes wrong?
The syntax is clearly temporary, as soon as there is a new syntax I'll document it. But for now I don't want anyone to depend on the specific way it's activated.
I really need my retro style graphics... :)
Anyone willling to share? email@example.com
In fact, there is an efficient way to prevent ANY BLURY effect to get your pixellate render of choice (which is mine too !). But there is a big drawback.
You have to use OpenGL to setup all your textures, which (this is the drawback) have to be power of two :(
All you have then to do is to add this to your Sprite class initialize method :
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST)
Then any operation will be full pixels, no blur at all.
That is exactly what the 'Gosu::enable_undocumented_retrofication' method is doing. BTW you can do this without power of two textures, no problem. :)
Hi. I'm so stupid. Until a couple of days ago, I didn't realized all I had to do was put "Gosu::enable_undocumented_retrofication" in my code to get the rsults I wanted. I was thinking it was a method with lots of necessary arguments "a la" draw_rot.
Thanks good sir. I love GOSU.
I don't see what Gosu::enable_undocumented_retrofication refers to, I'm no native english and don't understand what it represents exactly, can you explain it to me ?
BTW, my method didn't work on textures not power of two because Gosu::Images that are not power of two don't have a gl_tex_info method.
retrofication is a made up word meaning to make something "retro" in style. That is, pixellated. By not blurring images, it allows for indie-style retro blocky graphics, without forcing the user to use a very low screen resolution .
Thanks a lot for the explanation, it's just a huge method !
Also, it's supposed to be used in a "rescue" block because it will disappear as soon as there is a proper interface to do the same thing.
Could you explain what this method does exactly, after creating the same effect I wrote earlier ? Maybe I'm coding lots of things you took care of with it ! I don't see this method on Gosu RDoc, usually I'm able to look at those points alone :)
It does exactly what you posted above for all textures. Just use it like that: "begin; Gosu::enable_undocumented_retrofication; rescue; end". It's undocumented on purpose because it will be part of the new Image constructors later. You can use it to play around in the meanwhile though.
Hi Julian !
Can you explain how to use this feature ? I don't want to use Ruby-OpenGL anymore, but I really need pixellate zooms. Please, help ! :)
Just like the code I wrote above. You can call it once after startup, in the Window constructor or directly after
Hi Julian ! I was trying that code into the draw method, which didn't work. I put it under require "gosu", now it works ! Perfect !
Thanks a lot !
Powered by mwForum 2.29.1 © 1999-2013 Markus Wichitill