Hi again. Well, I’ve been putting mesh borders on the canvas… and that’s fun and all.
So, i decided to branch-out. @i73 and I were fooling-around with a GUI panel… so I decided to try to particle-border THAT.
First, I had to put it in a master rectangle… make it easily moved-around within the adt. Then… I needed to change to a “For-Mesh” GUI… because otherwise… it is real difficult to “find” the border of a GUI rectangle… in worldSpace coordinates.
Generally speaking, (and likely incorrectly-stated)… the edges of a GUI rectangle are in screenSpace… X/Y only… and you need to… umm… “project” them into worldSpace coords?
It all sounded too complicated for me, so… make a plane… and make the GUI for the plane. THEN… parent some thin “plane-strips” (border edging) along the edges of that main plane… and spray particles from those thin edge-strip-mesh… in precise directions, within precise emitBoxes.
All sorts of tweaks and demented functionality came onboard. Border strips were parented to the main plane, and the positioning and span-lengths were hand-tweaked… because the sizes and positions made NO SENSE. They still don’t. Edge strips should be same span-length as edges of main plane… just like the edges of a picture frame. But noooo… it’s all a mess… but I WILL learn why.
Top border strip is 18 wide… but the main gui plane… is 30 wide. Go fig. Main plane is 25 height, but left border is 4.7 high. What the heck!? Where am I. Hand tweaked. erf. hmm.
Anyway, here it is… a gui rectangle with a sparkly particles (sparticles) border. Kind of fun. I hope @i73 doesn’t mind that we borrowed his GUI panel.
https://playground.babylonjs.com/#36UHXZ#46
Make some versions yourself, I’d love to see them. Improvements and Wingnut-teaching… quite welcomed. (thx)
PS: Does anyone know how to switch between particles BEHIND guiPlane… and IN-FRONT-OF? I used to know how to do that, I thought… using the forceDepthWrite stuff. But I went stupid, somehow, and can only get particles behind. (I realize the particles can’t be both behind AND before… at the same time. Front or back, but not both.)
It doesn’t matter on this demo, because custom direction1/2 values keep particles from crossing guiPlane completely, front or back. But if I could get them in front, I would likely remove masterRect thickness, and maybe move the particle sprayer strips… inward a bit… see what that looks like.