Hey guys!
I first used Love a few years ago when I wanted to try and make some games in high school. I never actually finished anything of note then, and hadn't really looked at Love since. Recently though I'be been trying to get my brother to stop playing so many games and start making some, so the other day I showed him around Love and him and I sat down and started coding up a little vector Asteroids clone.
Anyway, so I saw that Love now has shader support, which was really interesting, so naturally the first thing I implemented was a Mandelbrot. I've seen a few of these before on the forums and around the internet, but I wanted to make mine a little prettier and a little better documented. My shader code is almost an exact translation of the Wikipedia article pusedocode, so it should be easy to follow.
I was also interested in the canvas library, which I'm using to draw the fractal at 2x resolution off the screen (you can adjust this multiplier using the 'o' and 'l' keys while the program is running), and only when there is an change in the fractal display, like during zooming or panning (instead of pegging the GPU constantly). I'm also using another canvas to save off a super-high resolution render of the fractal, which can be triggered by pressing the 's' key.
Here is a screenshot (there are more at the Github page):
Anyway, the full code is available here. I've also attached the .love file as well if anyone just wants to download and play with it.
Here are the key shortcuts:
click - zoom in on the area under the mouse pointer
scroll up/scroll down - increase/decrease the zoom speed
up, down, left, right - pan the viewport
i/k - step through the available color maps
s - save the fractal in a high resolution version to the Love2d data directory
o/l - increase/decrease sample rate (the multiple of the window size that the drawing canvas is sized to, default 2)
Mandelbrot Explorer Using Pixel Shaders
Mandelbrot Explorer Using Pixel Shaders
Last edited by mattegan on Tue Dec 29, 2015 5:03 am, edited 3 times in total.
Re: Mandelbrot Explorer Using Pixel Shaders
try zooming this 20000x pls
I have made a Fractal Explorer months ago and at that deep zoom it goes pixelated.
[edit]
I haven't tested this out yet sorry.
I have made a Fractal Explorer months ago and at that deep zoom it goes pixelated.
[edit]
I haven't tested this out yet sorry.
-
- Prole
- Posts: 5
- Joined: Mon Dec 28, 2015 3:37 pm
Re: Mandelbrot Explorer Using Pixel Shaders
Running the .love file gives me this error running LÖVE 0.10.0:
I'm downloading it off GitHub right now to see if that one runs without error.
[EDIT]
Just tried the version from GitHub, it gave me the same error. I also posted a GitHub issue. Since I don't see log() being defined anywhere else, I'm not sure why that error is occurring. If I replace log(2) with its decimal equivalent (0.69314718056) then it runs without error.
Code: Select all
Cannot compile pixel shader code:
Line 71: error: ambiguous overflowed function reference "log(int)"
Traceback:
[C]: in function 'newShader'
main.lua:55 in function 'load'
[C]: in function 'xpcall'
[EDIT]
Just tried the version from GitHub, it gave me the same error. I also posted a GitHub issue. Since I don't see log() being defined anywhere else, I'm not sure why that error is occurring. If I replace log(2) with its decimal equivalent (0.69314718056) then it runs without error.
-
- Party member
- Posts: 730
- Joined: Sat Apr 26, 2014 7:46 pm
Re: Mandelbrot Explorer Using Pixel Shaders
Probably your graphics card doesn't like the way he is doing things.
Like for example on my phone it has like 10 errors because opengl es is more strict when it comes to shader code.
Like for example on my phone it has like 10 errors because opengl es is more strict when it comes to shader code.
Re: Mandelbrot Explorer Using Pixel Shaders
Unfortunately not something I think I'll add at this point. This was more of a small experiment, and that requires writing some sort of arbitrary precision floating point implementation, and to keep with the pixel shader usage I'd have to do that inside GLSL.Almia wrote: try zooming this 20000x pls
Yeah, Love kind of hides the OpenGL muck from you. If you're willing to experiment, try replacing log(2) with log(2.0)? I'll try and test this on some more computers later today and see if I can find any more weird issues.roastchicken wrote: Just tried the version from GitHub, it gave me the same error. I also posted a GitHub issue. Since I don't see log() being defined anywhere else, I'm not sure why that error is occurring. If I replace log(2) with its decimal equivalent (0.69314718056) then it runs without error.
Re: Mandelbrot Explorer Using Pixel Shaders
So, according to the GLSL docs here the log() function is only supported for genType'd arguments, which is floating points (individual numbers, vectors, matrices). So, I guess it was just an implementation detail on my system that an integer argument was accepted.
I updated the download in the original post and the code on Github.
I updated the download in the original post and the code on Github.
Re: Mandelbrot Explorer Using Pixel Shaders
There are several other errors on GLES with the pow() function and the *-/< operators, all about mixing ints and floats.
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
Re: Mandelbrot Explorer Using Pixel Shaders
What platform are you seeing those on?
Re: Mandelbrot Explorer Using Pixel Shaders
Android 6.0.0 on a Nexus 6, got LÖVE from play store.
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
Re: Mandelbrot Explorer Using Pixel Shaders
Okay, let I don't have any Andriod devices, let me see if I can get it running on my iPhone.
Who is online
Users browsing this forum: Bing [Bot] and 3 guests