Join us on Discord!
You can help CodeWalrus stay online by donating here.

FBO Particle System

Started by Snektron, January 22, 2015, 10:31:58 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Snektron

Quote from: DJ Omnimaga on January 25, 2015, 05:08:22 PM
Could the slowdown be due to java itself? :P

Could verywell be. I've noticed that AWT (Java's library used for things like windows and general user interfaces, including JFrame)
is one of the worst standard Java libraries. A new object just to change 4 bytes representing a color to an int??
Come on really? just one static method is more than enough, and theres no way to change the color values
of the object.
  • Calculators owned: TI-84+
Legends say if you spam more than DJ Omnimaga, you will become a walrus...


unknownloner

#16
Creating new objects in Java really isn't a big deal, even for that. Not like it requires a malloc or anything. In practice object allocation & GC is fast enough that I got a software 3d renderer working which allocated a bunch of vectors for each triangle each frame (I was transforming the input triangles and using immutable vectors). Worked fine for rendering a huge minecraft-like world. That's not to say that I like AWT, I don't, but don't judge it harshly for the wrong reasons.

Edit: video of renderer in question, most of cpu is being spent on pixel fill and it's single threaded.

  
/)

Snektron

#17
Pretty nice vid :P. But i find making an object for every pixel of an image just bad practice, even though
Java can handle it easily. Though on Android it really does make a difference :)
P.S.: You call that big?
  • Calculators owned: TI-84+
Legends say if you spam more than DJ Omnimaga, you will become a walrus...


unknownloner

Not every pixel, every vertex ;)
And yeah I was creating new objects just because I didn't want to rewrite the vectors

  
/)

Snektron

No i didn't mean it that way :P. When you create a BufferedImage and you want to set the color
of a pixel, you can either use AWT's Color class or just do it yourself with one line of code.
The problem is withthe Color class you'd need to create a new Color object for every pixel.
  • Calculators owned: TI-84+
Legends say if you spam more than DJ Omnimaga, you will become a walrus...


unknownloner

Well yeah for setting pixels you use setRGB or you access the DataBuffer directly (which is what my renderer does I think... I don't remember). then use Color for filling large rectangles with G2D

  
/)

Snektron

Well as i said in my last update, i actually made my own image class for 16 bit/pixel images :P
  • Calculators owned: TI-84+
Legends say if you spam more than DJ Omnimaga, you will become a walrus...


Snektron

#22
Update:
- Started working on the console:
  - Set pos/vel texture size
  - enable/disable noise
  - enable/disable gravity

Edit: More updateees
- More settings:
- enable/disable particle age
- set gravity strength
- System capabillities check (for to check if the user can run fbo's etc)
- error message boxes
  • Calculators owned: TI-84+
Legends say if you spam more than DJ Omnimaga, you will become a walrus...


Dream of Omnimaga

Awesome. I hope you add a GUI for people who want to change parameters, though, since many people are not fond of command prompts. I can't wait to try it out :)
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

Snektron

  • Calculators owned: TI-84+
Legends say if you spam more than DJ Omnimaga, you will become a walrus...


Dream of Omnimaga

That's good. :) Can we change colors, by the way?
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

Snektron

#26
Update & release
Now you can 8)
- Added reset settings button
- Added color picker

Download:
Exe version: quantuminfinity.net/files/particles.exe
Jar version: quantuminfinity.net/files/FBOParticles.jar

Jar works on every system and can run by double-clicking, but if that doesn't work
you can always start it with
java -jar FBOParticles.jar

If you encounter a crash, please also run it with the above command and send me the error message :)
The default texture size is 512*512 (262144) so please don't run this on your old laptop :P.
The maximum texture size is set to 4096*4096, but you need quite the GPU to run this. It is not
required to make texture size powers of 2. Also, just to be safe, you run this at your own risk
(though i don't think it will fry your GPU :P). If you close the Particle Console you can reopen it
by pressing 'F1'. You can attract the particles with left mouse, and repel them with right.
both mouse buttons at the same times freezes the particles until you release them.

if you have any questions, feedback or suggestions of what settings i should add please leave them
below :)
  • Calculators owned: TI-84+
Legends say if you spam more than DJ Omnimaga, you will become a walrus...


CKH4

I'll try it but I only have AMD R5 onboard so it'll probably lag.
  • Calculators owned: TI-83+, TI-84+


Snektron

#28
You'd be surprised :) Also you can just change the texture size to like 256 or even 128 of your system can't handle it.
For reference: My AMD R7 250 (specs) runs at about 60 Fps on 1536.
  • Calculators owned: TI-84+
Legends say if you spam more than DJ Omnimaga, you will become a walrus...


matrefeytontias

Breaks on me with :
QuoteError creating shader: 0(143) : error C7011: implicit cast from "int" to "bool"
0(170) : error C7011: implicit cast from "int" to "bool"
0(173) : error C7011: implicit cast from "int" to "bool"
0(177) : warning C7533: global variable gl_FragData is deprecated after version 120
  • Calculators owned: TI-83+.fr, TI-Nspire CAS prototype, TI-84+ CSE, TI-Nspire CX
My TI games (some got their own article on non-calc websites !) : http://www.ticalc.org/archives/files/authors/112/11202.html

My moozik (100% free metal) : http://www.soundcloud.com/matrefeytontias

Powered by EzPortal