Page 1 of 1

Interactive Julia Set viewer with shaders

Posted: Tue Mar 06, 2018 10:52 am
by novemberisms
Source code https://github.com/novemberisms/julia
.love file here:
julia.love
Love file
(6.37 KiB) Downloaded 157 times
Controls

Use the mouse to control the real and imaginary parts of z
  • The y position of the mouse controls the imaginary part
  • The x position of the mouse controls the real part
  • The origin is located at the center
What's the Mandelbrot Set doing?

Julia sets are intimately connected to the Mandelbrot set in that if you mouse-over any point inside the Mandelbrot set, the corresponding Julia set for that point will be contiguous (locally connected).

All that is to say, if you mouse-over points within the Mandelbrot set, the corresponding Julia set will look nice and connected. If you bring your mouse outside, then it will look like a sparse set of little islands.

Just play around and explore. What happens when you mouse-over each of the bulbs of the Mandelbrot set? Is there a pattern? When you mouse-over each of the chasms? Math is beautiful.
sample1.png
sample1.png (137.6 KiB) Viewed 3705 times
sample2.png
sample2.png (73.52 KiB) Viewed 3705 times

Re: Interactive Julia Set viewer with shaders

Posted: Tue Mar 06, 2018 2:07 pm
by zorg
Hi and welcome to the forums!

Additionally, very nice first post. :3

Finally, please allow me to nitpick one thing;

In your code, if you define the palettes above the default used, you don't need to create one palette twice with newImage (alternatively, you could set the second palette's image in the table to the already loaded one in the default variable), just for the sake of logical consistency:

Code: Select all

palettes = {
  {background = {255,255,255,255}},
  {background = {255,255,255,255}, palette = love.graphics.newImage("shaders/pal0.png")},
  {background = {255,255,255,255}, palette = love.graphics.newImage("shaders/pal1.png")},
  {background = {255,255,255,255}, palette = love.graphics.newImage("shaders/pal2.png")},
}

julia_palette = palettes[4][2]

-- or alternatively:

julia_palette = love.graphics.newImage("shaders/pal2.png")

palettes = {
  {background = {255,255,255,255}},
  {background = {255,255,255,255}, palette = love.graphics.newImage("shaders/pal0.png")},
  {background = {255,255,255,255}, palette = love.graphics.newImage("shaders/pal1.png")},
  {background = {255,255,255,255}, palette = julia_palette},
}

Re: Interactive Julia Set viewer with shaders

Posted: Wed Mar 07, 2018 2:12 am
by novemberisms
Hi! Thanks for the warm welcome! I admit the lua part is terribly rushed. I was just so excited to see the shaders working that I wrote the lua part as fast as I can just so I can explore the results. I'll be cleaning it up soon. The main point of study are the .glsl files, and if you have any nitpicks on those, I'd be glad to see.

Also, I don't know how to use BBCode >.<
How do I get the images to show?

Re: Interactive Julia Set viewer with shaders

Posted: Wed Mar 07, 2018 2:30 am
by zorg
novemberisms wrote: Wed Mar 07, 2018 2:12 am Also, I don't know how to use BBCode >.<
How do I get the images to show?
I think the bbcode you used was correct, but you used the wrong link; should have been like this:
https://raw.githubusercontent.com/novem ... ample3.png
That said, i don't know how much github tolerates hotlinking like that.

Re: Interactive Julia Set viewer with shaders

Posted: Wed Mar 07, 2018 2:32 am
by pgimeno
Attachments work just fine to embed images :)

Also, cool program!