r/processing • • Nov 03 '19

Orbital

265 Upvotes

27 comments sorted by

14

u/Volfegan Nov 03 '19

The stuff you create is really amazing.

                                      ,,
                                  ,;:#*,
                              .:'     .:'
               _.u[[/;:,.. ;*:'       ':'
            .o888UU[[[/;:-.          :#^
            oN88888UU[[[/;::-       *^
           dNMMNN888UU[[[/;:--.   .*^
          ,MMMMMMN888UU[[/;::-. .o@^
          NNMMMNN888UU[[[/~....*#^
         .888888888UU[[[/.....o@^-
        ,:*I8888UU[[[/--...*@#^:.
      .:*; YUU[[[/;::---.o@^-..
     .:;'   ^MMNN;::./o##^:-..
   .;*'       ^;:/*o#---...
  ,;:        ,:*/^v^^^'
 ,:;       ;o:'
 ';,  ,:o''
  ''*'

5

u/Simplyfire Nov 03 '19

Thanks man, I appreciate it. Cool ASCII planet you got there!

10

u/Simplyfire Nov 03 '19

3

u/FlyingSwedishBurrito Nov 03 '19

I’m currently learning several languages, I first taught myself the basics of java, currently on c and JavaScript. Would you say java is a good graphics language? I’m curious since I usually only here people talk about python now

6

u/Simplyfire Nov 03 '19

I'm not really an authority on any of this but I really like java, but I also think you should stick to one language while learning until you really get it. You could also try shaders, it's the coolest thing to know right now.

1

u/MusicOfBeeFef Nov 04 '19

Is there some kind of free, offline IDE for an open-source shader language available?

2

u/Simplyfire Nov 05 '19

I don't know about open source shader languages, OpenGL is more of an interface that each graphics card manufacturer implements in their own secret way, but you won't need to know how it works to use them.

I really liked the Atom editor with the Veda plugin for reloading the shader in the background as you write code in the foreground, it's pretty amazing. These days I just use a processing sketch, because I wrote a bit of java code that checks the last modified time of the shader file and starts using the newer version if it compiles, the only thing I need to do is Ctrl+S in any kind of editor like Notepad++ or IDEA.

2

u/FlyingSwedishBurrito Nov 03 '19

Yeah I like java a lot more than C, but I’m planning on getting really good at python after learning several languages which is why I was asking

1

u/MusicOfBeeFef Nov 03 '19

What about openframeworks? I think that's c++

and since standard processing is built off of java, I guess so

1

u/FlyingSwedishBurrito Nov 03 '19

Hmm ok. Would you recommend learning c++ after learning c?

2

u/MusicOfBeeFef Nov 03 '19

Well I'm taking C right now and hoping to eventually learn c++. and c++ evolved from c so it's probably good to learn c if you want to learn c++ and aren't very experienced with procedural languages/c++ syntax and features

2

u/[deleted] Nov 05 '19

As a C++ developer with a couple of decades of experience under my belt I can say: No. Modern C++ is very different than C and you would learn a lot of bad habits you will need to break to write good C++. If you want to learn C++ just start learning C++. Yes, C++ was derived from C but the languages have diverged and aren't similar at all anymore.

2

u/FlyingSwedishBurrito Nov 05 '19

Is there still utility to knowing C? I’ve heard that the difference is like C is the tried and true and c++ is the new expiremental language. That and I’ve also heard that c is used a lot still for hardware.

2

u/[deleted] Nov 06 '19

C++ is not new or experimental. Anyone who says so is thinking of back in the 90s or earlier.

Yes, there is value in knowing C and it is still used in lots of places. My point was that C and C++ are not the same languages and the idioms you would use in one do not apply to the other. So learning C will not help you with learning C++.

1

u/FlyingSwedishBurrito Nov 06 '19

Hmm ok, what about crossover between say, python and c++? Are there cases where you’d use both languages for some task?

1

u/[deleted] Nov 06 '19

The only case I've come across is if I wanted to use a large library that existed in C++ from a Python program. Yet with numpy, scipy, and other libraries that hasn't been something I've needed to do.

I have a personal project involving errors introduced from the IEEE 754 standard which needs more direct control over the floating point processor settings. I wrote a Python extension in C to access the settings as I didn't find a way to do it in pure Python.

1

u/FlyingSwedishBurrito Nov 06 '19

Ah ok, fascinating. Thanks man! Now off to learning all the languages!

2

u/MusicOfBeeFef Nov 03 '19

why would you use public and private for a processing sketch?

2

u/Simplyfire Nov 03 '19

I'm using IntelliJ IDEA, it highlights my code until I give everything the least amount of privileges required and I
like to get rid of all the warnings properly. If you dig a bit deeper you'll even find the protected keyword because I like to hide a lot of stuff in my abstract classes and just use it without copying it everywhere.

1

u/MusicOfBeeFef Nov 03 '19

So if I was just using the Processing IDE, it wouldn't be such a big deal to not use private and public?

1

u/Simplyfire Nov 03 '19

It's not a big deal at all, keep it simple.

0

u/[deleted] Nov 04 '19

[deleted]

2

u/Simplyfire Nov 04 '19

It's all explained in the project readme. I add some custom functionality to my sketches, in this case a gui tray and reloading shaders at runtime. When I want to use it in a sketch I just extend the abstract class and the implementation is kind of hidden. I can also fix related problems or make it better for all my sketches in just one place, because I'm not copying things around.

readme.md

GuiSketch.java

HotswapGuiSketch.java

2

u/Eronecorp Nov 04 '19

How do you get that chromatic aberration effect? It's so cool!

2

u/Simplyfire Nov 04 '19

Thanks!

It's actually not chromatic aberration, it's two effects creating a fun little feedback loop together. The color you see is due to a radial rgb split shader adapted from the PostFX library. After I split a white point into a sliver of blue, a white center and a sliver of red I don't fully redraw the background, I instead just darken it a little bit, keeping most of the last frame for the next rgb split - which takes the dimmed red and splits it again, this time only creating a bit more red color so that the reds stretch outward in a flame-like animation which at some point runs out of red as there's nothing left to split, so it doesn't cover the whole sketch with red.

For the darkening effect I used to draw a big black low alpha rectangle over the whole sketch but that approach results in faint traces of gray that don't ever get erased to full black. Now I use my alphaFade function instead which uses blendMode(SUBTRACT) to subtract a bit of white from the last frame which does the same thing without the ugly traces. You can find the alphaFade function in the abstract class I extend with some custom slider calls for runtime adjustments, but simplified it looks like this:

void alphaFade() {
        hint(PConstants.DISABLE_DEPTH_TEST);
        blendMode(SUBTRACT);
        noStroke();
        fill(255,10); //the coolest alpha values are near zero
        rectMode(CENTER);
        rect(0,0,width*2, height*2);
        hint(PConstants.ENABLE_DEPTH_TEST);
        blendMode(BLEND); // restore default blend mode
}

4

u/[deleted] Nov 03 '19

THIS IS AWESOME I LOVE IT

4

u/strudelkopf Nov 04 '19

This is so beautiful. I'm currently planning to use processing as a visual toy for live music shows and this 100% the stuff I've been thinking of. Thank you so much for sharing the source, maybe I can learn a thing or two.