Particle Panel alternative

This is something I’ve been making in the last week, it’s not finished but it’s working:

This is an alternative tool for making particle effects, it saves all the parameters in a json file (+some images), the rendering of the particles is assisted by a shader.

Manual:

When the script is lunched you will probably first see a white screen and all the panels - all the particles are initially rendered white, and the camera is zoomed in, just zoom out, the script uses the default mouse look.

UI:
Bottom rows (from top to bottom):
The buttons here show how the shape, size, color and transparency of the particles changes over their life time, the left side shows how they will look at the moment of their birth and the right side shows how they will look dieing.

-Shape:
There are 8 buttons/icons here (initially all white). Clicking one of them will show a pop-up window with available shapes, clicking a shape in that window assigns that shape at the given time. The shapes can be changed at will in any given moment. The eye icon in the far right can be used to hide/show this panel.
-Alpha:
There are 64 buttons here, forming a gradient. When you click any of them a pop-up widget, that will help select a value will be shown.
The widget will have a black and white gradient, an input field and two buttons labeled “Set Alpha” and “Remove Alpha”. Click on the gradient to set a value and then confirm by pressing the “Set Alpha” button. If you prefer to input a value by hand, be sure to press enter after entering a value. The “Remove Alpha” button can be used to remove a previously set value.
To make things easy, you don’t need to fill all the values, the script will automagically generate a smooth gradient between the values you’ve set.
The values you have set will be marked with a little circle.
The eye icon in the far right can be used to hide/show this panel.
-Color:
There are 64 buttons here, forming a gradient. When you click any of them a pop-up widget, that will help select a value will be shown.
The widget will have a color gradient, an input field and two buttons labeled “Set Color” and “Remove Color”. Click on the gradient to set a value and then confirm by pressing the “Set Color” button. If you prefer to input a value by hand, be sure to press enter after entering a value. The “Remove Color” button can be used to remove a previously set value.
To make things easy, you don’t need to fill all the values, the script will automagically generate a smooth gradient between the values you’ve set.
The values you have set will be marked with a little circle.
The eye icon in the far right can be used to hide/show this panel.
-Size:
There are 64 buttons here, forming a line. When you click any of them a pop-up widget, that will help select a value will be shown.
The widget will have a slider, an input field and two buttons labeled “Set Size” and “Remove Size”. It works just like the color and alpha panels, but it plots a line showing how the size of the particles will change over time.
The values you have set will be marked with a red line.
The eye icon in the far right can be used to hide/show this panel.
-Save dir:
This panel shows where the particles are saved… editing options for this feature are on the TODO list.

Top part:
This shows the properties of the particle emitter. The Blend mode is not working at this point in time, the rest should be clear (if it’s not -ask here).

There’s some example code in vfx_loader.py how the effect could be loaded, but I haven’t yet tested it :mrgreen:

VIDEO tutorial (making a waterfall):
youtube.com/watch?v=KscgDCk … e=youtu.be

License:
Choose ont that you like:
CC0 or Beer ware license or GPL or MIT or BSD or BDSM (no wait, that’s not a license)

Code:
Git:
github.com/wezu/koparka/tree/master/tools
Or zip:
patric.zip (315 KB)

Wow. Nice work. How do I save a ptf?

The save/load function is a bit meh, at the moment. The editor will make a new dir each time you run it and save files there…but not a ptf.

I don’t like the ptf format much… it’s just a python script loaded with exec(). I don’t think any ‘asset’ (be it a 3d model, image, sound or particle effect) should run arbitrary code.

Imagine someone making an mod for your game that will delete all files in your home directory every time a spell using a ptf is cast. Not a good idea.

Getting an error
python patric.py
Known pipe types:
CocoaGraphicsPipe
(all display modules loaded.)
:display:gsg:glgsg(error): An error occurred while compiling GLSL shader vfx_v.glsl:
ERROR: vfx_v.glsl:19: ‘round’ : no matching overloaded function found
:display:gsg:glgsg(error): An error occurred while compiling GLSL shader vfx_f.glsl:
ERROR: vfx_f.glsl:22: ‘r’ : field selection requires structure or vector on left hand side

That should be easy to fix - looks like there’s no round() function in glsl 120, but there is a floor().

EDIT:
Bugfixed version:
patric_17_05_2015.zip (297 KB)

Still giving me this error.
python patric.py
Known pipe types:
CocoaGraphicsPipe
(all display modules loaded.)
:display:gsg:glgsg(error): An error occurred while compiling GLSL shader vfx_f.glsl:
ERROR: vfx_f.glsl:22: ‘r’ : field selection requires structure or vector on left hand side
WARNING: vertex shader writes varying ‘color’ which is not active.
WARNING: vertex shader writes varying ‘vpos’ which is not active.
WARNING: vertex shader writes varying ‘fog_factor’ which is not active.

Another bugfix:
patric2_17_05_2015.zip (297 KB)

Can you give me an example of how to load an effect?

There should be a file called vfx_loader.py with the editor (if it’s not you can use the one that’s in the Koparka git github.com/wezu/koparka/blob/ma … _loader.py). You may need to edit that file to point to the shaders that are needed if you moved them or if you have other shaders.

And now that I think of it, the loader tries to load a texture from ‘…/partices/smoke1.png’, so if you don’t have a texture like that in a place like that, replace it with someting sane. I know it was a stupid thing to do but well…

Load the values from a json file (let’s call the file effect.json) and let the createEffect function from vfx_loader do the rest:

from vfx_loader import createEffect
import json

with open('effect.json') as f:  
    values=json.load(f)
particle_effect=createEffect(values)
#particle.start(parent=model, renderParent=render)