Give us option to horizontal billboard particle systems instead of vertical billboard


#1

EDIT:
I was originally mistaken in what is needed, see this reply:
Give us option to horizontal billboard particle systems instead of vertical billboard

Allow us to disable billboarding for particle systems so we can orient the particle systems in 3D space. Currently the XYZ rotation inputs of a particle system do absolutely nothing because of this forced billboarding. We need a checkbox on particle systems that says ‘Billboarding’ or something like that so we can disable it.

Untitled-1

Problem:
You want to create a circular particle aura effect using a circular color map like shown above, but if you aren’t in a topdown or 2D view, then you need to rotate the effect in XYZ for it to look more like an ellipse, the problem is playcanvas forces the color map to billboard. If you try to make the color map isometric to compensate for this, it will no longer spin correctly like a circle.


#2

Particles are meant for billboards only by convention. If you want your own “particle system”, looking into batching a pre-set amount of entities (with the respective particle model geometry) and then transforming each entity independantly, or apply some repeater hacks to repeat batched geometry in a batched manner without the overhead of using entities. (https://playcanvas.com/editor/scene/639519 : Each tree is batched geometry WITHOUT the usual overhead of 1 entity per tree. This approach involves the lightest memory footprint but requires some custom management on your own using the engine source code as a guide, besides allowing you to control the exact instance polycount required in any given situation, it works with pure array-based data only to determine the matrix4 values of each “particle” within the buffer.

You could (heavier approach), batch a bunch of entities (a preset buffer amount of max particles you are expected to have at any one time being rendered.), and then later get the batches itself from the batch group via the pc.BatchManager, and set the number of triangles to render for each given batch’s meshInstance primitive to limit the polycounts of what gets rendered for that batch group of batches. The batch’s meshInstance (of the combined buffer) can have other materials applied with your own custom vertex/fragment shaders used instead , if needed. But yea, that’d mean you need to set up very specific shaders for such batched geometry types (eg. y-axis-locked sprites). Look into how to use the shaderChunk system to modify parts of the shader code if you have slighly different vertex morphing rules.


#3

Sorry, I’m new to game programming and especially 3D, so probably my original thinking was incorrect. I didn’t understand much of what you said but I used some of your keywords to google and found out what is actually probably needed: horizontal billboarding instead of vertical billboarding.

I just need a way to orient the XY plane of the particle system to the ‘ground’, like this:

In unity, they call this horizontal billboarding.

I changed the title to reflect this.


#4

Simply just do up a variation of the billboard basic example in Playcanvas, using lookAt() but keeping the pitch at eye-level.
https://playcanvas.com/project/578267/overview/billboards-xz-locked


#5

If I’m understanding that example correctly, to apply it to the images above with the ‘hoola hoop magic aura’ effect, it would mean recording a flat (top down) version of the particle effect in another engine, like unity, and exporting to png, importing as an animated texture or something like that in playcanvas (with transparency), and mapping it to a XY plane

That will certainly work and thank you for that brilliant solution, I can move forward with my game now and that’s huge to me, it just means I have to use another engine to create this aspect of FX, because we can’t billboard particle systems to the XY plane, so I still think it would be useful to allow XY plane locking, also known as horizontal billboarding, for particle systems in playcanvas


#6

If you’re up to it, look into the playcanvas source code on GitHub and see what can be done. I’m not too familiar with the particle system engine in playcanvas so I’m not too sure if it’s possible to overwrite/modify the default vertex shader implementation used in the particle system ( I remembered they were using camera-aligned approach for particles where particles simply match rotation of camera instead of using the lookAt cross product approach ). Then again though it’s much better off settling for just a few hand made entities or a custom made shader specific to your app . Or you could just borrow specfic fragment shader codes used in the particle shader for your own use in your own materials and yr scripts can include parameters like graphs/Color selector and such to emulate the particle system in playcanvas . Except the case you REALLY need the original Playcanvas particle system itself, then consider if the vertex shader part of that system can be replaced with your own.