Jump to content

jerome
 Share

Recommended Posts

Little fun for the week-end : http://www.babylonjs-playground.com/#1MURF7

A dynamic texture applied on a SPS composed with many little planes stuck together. Press "SPACE" then ... BOOM
The same with an opaque texture to better understand : http://www.babylonjs-playground.com/#1MURF7#1


From the line 32, you can change some parameters.

example : http://www.babylonjs-playground.com/#1MURF7#2

or something more dynamic : http://www.babylonjs-playground.com/#1MURF7#4

much more : http://www.babylonjs-playground.com/#1MURF7#5

Just make sure that your mouse pointer is NOT in the editor part, but in the scene part, else you can have some funny effect by pressing SPACE (or keeping it pressed)

 

 

Link to comment
Share on other sites

As always jerome your stuff fascinates me - it is almost hypnotic :)

The position of the mouse pointer does have an impact - I went to the demo and watched the particles explode and collect at the edges of the floor. I wanted to watch it again (I said it was hypnotic ;)), so I clicked the RUN button again and hit the spacebar and I got one of those "funny effect" - the explosion reverses itself as soon as I let go of the spacebar which is also a nice effect.

cheers, gryff :)

 

Link to comment
Share on other sites

@Dal : yep, for destroyable walls...

I just change here the model CreateBox instead of CreatePlane : http://www.babylonjs-playground.com/#1MURF7#6

same opaque : http://www.babylonjs-playground.com/#1MURF7#7

well... "Box" instead of "Plane", changing only 4 letters and this works ...

 

[EDIT] can't stop playing ...

discs : http://www.babylonjs-playground.com/#1MURF7#8

(triangles... discs with 3 sides : http://www.babylonjs-playground.com/#1MURF7#13 )

torus : http://www.babylonjs-playground.com/#1MURF7#9

torus knots : http://www.babylonjs-playground.com/#1MURF7#10

tetrahedrons : http://www.babylonjs-playground.com/#1MURF7#11

spheres : http://www.babylonjs-playground.com/#1MURF7#12

 

Edited by jerome
Link to comment
Share on other sites

Quote

but there's nothing new here

Well jerome, I think it has to do with demos being a dramatic visualization of the features of BJS. You can read the docs and never think of what combining two features might produce - to paraphrase the old saying "a demo is worth a thousand words".

And as for the "gentle words" - your coding does fascinate me. I thought about using your spiral mesh creation (I had seen it in a demo:o)  for decorations in my last xmas card piece. (Just could not figure out how to have the spiral run horizontally and bend in the middle from gravity. )

As for your SPS particle system - I keep thinking "leaves on trees", though I don't know what performance issues might be created.

cheers, gryff :)

EDIT: And as a more general comment - this Demos & Projects subforum is a great addition because it does give people the opportunity to illustrate what can be done with BJS. :)

Link to comment
Share on other sites

aahhh... ok for the "dramatic visualizations"
maybe, I need to add some shadows also, or some post-process, maybe an explosion sound :)

 

one more for tonight with transparent tetrahedrons : http://www.babylonjs-playground.com/#1MURF7#14

About "leaves on trees", it would interesting to test this... My old laptop computer can handle thousands of triangular or quad particles in the space (rotated, positionned, etc)... maybe it might work

Link to comment
Share on other sites

http://www.babylonjs-playground.com/#2AF3KM

News :

- better pseudo-physics : the particles don't fall or roll forever and keep really in the big box
- added some shadows from a fixed directional light. As I don't know how to set forever a constant bounding box to the SPS mesh, its bounding box is recomputed each frame with sps.afterUpdateParticles() in order to compute the right shadows. This works still at 60 fps in Chrome here. I just couldn't have the shadows work from a moving point light, I'm waiting for an answer about this in another topic.(see EDIT 2)
- the explosion impact is now computed straight from the mouse pointer position when you click (no more velocities pre-computation)
- better code comments for interested people

For people just wanting to have fun at blowing things, the parameters are from the line 41 ;)

[EDIT] something funny : you can ever blow the particles when they are flying, falling or even rolling on the ground. Just pick & click

[EDIT 2] http://www.babylonjs-playground.com/#2AF3KM#1

The same with the point light shadows fixed as explained here : 

 

 

Link to comment
Share on other sites

Here is it : http://www.babylonjs-playground.com/#1JFDFW#9

News :
- the particles bounce on a height map : the bounce angle is computed from the velocity angle when hitting the ground. Actually, the symetric vector of the velocity vector by the ground normal vector is computed and is applied an attenuation (energy loss). This illustrates the usage (and the speed) of the new getHeightAtCoordinates() and getNormalAtCoordinates() Ground methods.

- the wall still explose where you pick it, but now the explosion direction is set according to the camera-picked point axis, like you were shooting the wall from your point of view.

Finally, I've got my light pseudo physics for explosions upon a relief to start an artillery game ;)

 

[EDIT] for easier access to the parameters, I set them at the start of the code from the line 3.
And you can still blow flying or rolling particles then ...

[EDIT] just removed the shadows (and the per frame bounding box recomputation) and increased to 6300 cubes
http://www.babylonjs-playground.com/#1JFDFW#4
still 60 fps in my Chrome here

[EDIT] fixed the velocities when you re-click on moving particles and updated the PG links in this post

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...