GameMaker: Studio

GameMaker: Studio

View Stats:
Fish Eye Lens
Hello all, im looking to get a close, non cpu consuming mimmick of a Fish Eyle Lens in game maker. Im using 8.0 Professional (i know this is the Studio forum but i have already build the engine in 8.

A great fish eye example is the game "sonic xtreme", but no, im not making sonic xtreme.

Im looking to get this fish eye effect done using shaders and surfaces, not so much d3d like discussed in the GMC formus.

Is there a good base, or could someone explain how to go about implementing and optimizing such an effect?

any help would be appreciated. and please, i use 8.0, no "studio written only" examples.

thank you.
< >
Showing 1-13 of 13 comments
Sera Aug 8, 2014 @ 9:07am 
GM8 is going to kill your desire to use shaders, then, unless you've some sort of extension adding the functionality. In that case, you actually are best off looking for Studio examples and trying to convert their shader code into whatever the extension uses.

Without that, though, D3D is probably the only real option; you're trying to draw a distorted texture, basically, and without shaders you need to wing it some other way. Regardless, the first step is going to be getting what you want fisheyed drawn to a surface, and then applying that surface to the right thing (either a round, swelling set of polygons, or run through the distortion shader).
Blind Aug 8, 2014 @ 10:24am 
The tutorial on surfaces comes with a water filter, as I don't even know what a Fisheye lens is supposed to be since I nevre had Sonic Xtreme, you'd just rend the surface to a circle (I guess) instead of a square.
DescipleOfZen Aug 8, 2014 @ 11:11am 
Originally posted by BBX:
The tutorial on surfaces comes with a water filter, as I don't even know what a Fisheye lens is supposed to be since I nevre had Sonic Xtreme, you'd just rend the surface to a circle (I guess) instead of a square.

Fish eye is more or less distorting a world, or wrather blending it self to curve backwards. you see were you are and on the sides, curved portions of the level.
DescipleOfZen Aug 8, 2014 @ 11:13am 
Originally posted by Zaron X:
GM8 is going to kill your desire to use shaders, then, unless you've some sort of extension adding the functionality. In that case, you actually are best off looking for Studio examples and trying to convert their shader code into whatever the extension uses.

Without that, though, D3D is probably the only real option; you're trying to draw a distorted texture, basically, and without shaders you need to wing it some other way. Regardless, the first step is going to be getting what you want fisheyed drawn to a surface, and then applying that surface to the right thing (either a round, swelling set of polygons, or run through the distortion shader).


Well, the entire engine is 2D. Once before when i was experementing with filters, d3d really didden't like my work. things would be upside down, stretched, invisible and even inverted.

If i had to use d3d, i would not know an efficent or even working way. previous GMC posts say to put it in OBJ_CAMERA's step event, which i have done, and for the most part, it was upside down, no effect even. very incompatible and needs to me modified. secondly, GMC complained it ate up CPU, i'd need a method of reducing that, but im sure their are many ways of optimizing.
Last edited by DescipleOfZen; Aug 8, 2014 @ 11:17am
Sera Aug 8, 2014 @ 11:16am 
Fisheye is a type of camera lens that whips out pictures like this[paulbourke.net]; Sonic Extreme simply tried to apply that effect to 3D platforming. It was a Western-developed Saturn project amongs the early attempts to bring Sonic into 3D, but was never finished. The idea was that it would make it easier to see things at a greater distance and a broader range of angles, helping offset Sonic's historical visibility problems. It's an interesting, weird idea, but I question how it would hold up against motion sickness or just peoples' general handling of such distortion in motion.
DescipleOfZen Aug 8, 2014 @ 11:20am 
Originally posted by Zaron X:
Fisheye is a type of camera lens that whips out pictures like this[paulbourke.net]; Sonic Extreme simply tried to apply that effect to 3D platforming. It was a Western-developed Saturn project amongs the early attempts to bring Sonic into 3D, but was never finished. The idea was that it would make it easier to see things at a greater distance and a broader range of angles, helping offset Sonic's historical visibility problems. It's an interesting, weird idea, but I question how it would hold up against motion sickness or just peoples' general handling of such distortion in motion.
:p im not making sonic xtreme though, and of course, it would be a toggle-able option, which i can create by setting a few variables, easy. The trick is getting the distort to even render right. i have no experience what so ever with D3D and camera filters.
Sera Aug 8, 2014 @ 11:23am 
Originally posted by JATWORKS:
Well, the entire engine is 2D. Once before when i was experementing with filters, d3d really didden't like my work. things would be upside down, stretched, invisible and even inverted.

2D can be done in 3D mode but requires a little adjustment to your approach to accomplish this. Make sure orthographic drawing is enabled; this removes the depth projection that makes things stretched out or distant. I believe it's y values that are inverted, which creates some weird problems... there's a lot of fiddling one has to do. If something passes a certain point towards the camera or away - I don't entirely remember - the inversion happens. Having a project on the side explicitly to experiment with working with 2D in the 3D environment isn't a terrible idea, frankly.

Also bear in mind that if you ever do jump to Studio, what you solve will likely break entirely. I had a project that solved a lot of that basic stuff because I wanted dynamic camera zooms and such and 3D seemed the most supportive option, but on import to Studio there was a large number of compile bugs, the adjusment or removal of which leaving me pretty much where you are now. I never really bothered to solve it.

Looking around, I've seen there's a shader extension for 8.0 (that doesn't work in 8.1, as another warning), so if you're in that ballpark you won't need 3D anyway. You probably WILL want to draw a larger area than your screen takes up, since that extended region will be bent into the fisheye and drasitcally reduced. Otherwise, BBX seems more knowledgeable than me, but you're still going to have to convert things from whatever Studio guys are doing with the native shader support to what your extension needs.
DescipleOfZen Aug 8, 2014 @ 11:29am 
Hmm, yeah, i figured. the reason i'm even on 8 is because of optimization. i used some pre made platforming code as a base and built off of that to learn a while back, and while the engine i have is custom now, it partains some of the original work structure, which is not studio friendly. i have studio, but i never use it. previous witten tasks that i still want to update don't compile right and its extremely slow. I do use 8.0 pro, so what should i look for to obtain this extension? google it i suppose.
Blind Aug 8, 2014 @ 12:47pm 
If it's EXACTLY like the picture Zaron provided... then just: 1. Capture the application surface (or other) as an image. 2. d3d a sphere 3. Texture Dat!

I don't even think you need cameras or anything for d3d primitives. I'm not sure though since I haven't used it before. (Indeed, I'm currently studying GLSL without much success)
Last edited by Blind; Aug 8, 2014 @ 12:48pm
Sera Aug 8, 2014 @ 2:12pm 
In all fairness, I think you can toggle 3D on and off pretty freely, so you might be able to just turn it on for the sake of drawing the primitive and then switch it back off for your 2D drawing to the surface. You might need to flip your final image some way or other, but that's not too bad all things considered. I don't think switching to 3D mode would overwrite what's already drawn, largely because that would be extremely silly.

As for the shader extension, if you're ready for a pretty steep learning curve (assuming it's anything like GM's own shaders and their lovely single-PDF non-referenced unlinked documentation people still think is a good idea for reasons that completely and utterly baffle me and my way of learning), you can find that right here[gmc.yoyogames.com].
DescipleOfZen Aug 8, 2014 @ 2:49pm 
hhmm, yeah, pretty steep. thank you for the link. ill be messing around with this for a while, its not that bad but ive ponderd on a few ways to work with and optimize this. only time will tell
\(u.u)/
DescipleOfZen Aug 14, 2014 @ 7:16am 
https://www.dropbox.com/s/pyimchaa73we8id/PINEAPPLE_ERROR_0020.png

This is what i get. I have very accurate fish eye but my block has an incorrect texture. i tried drawing it via background image , object itself and a sprite. i either get his pineapple looking texture or red lines. what??
< >
Showing 1-13 of 13 comments
Per page: 1530 50

Date Posted: Aug 8, 2014 @ 12:30am
Posts: 13