Jump to content

SPS Billboard Change Camera


Robert_h
 Share

Recommended Posts

Hey guys,

I'm looking for some help with my scene, specifically the grass that I am trying to create using the SPS. An example can be found here: https://roberthucks.com/3D/tests/test5/test5.html

As you can see, when you move the camera (arrow keys) the grass does not face the camera despite these settings:

grassSPS.billboard = true;
grassSPS.isAlwaysVisible = true;
grassSPS.computeParticleRotation = false;
grassSPS.computeParticleColor = false;
grassSPS.computeParticleTexture = false;

I have an idea as to why, it being that the way in which this project it set up the world is generated before the player so when the grass gets made there isn't a camera for it to face. Atleast thats my working theory. 

So my question is, is there a way for me to change which camera the particles billboard to or is there any other methods I can use to produce the effect I am after.

 

ps. I would make a playground but I don't know how to import textures. =)

Link to comment
Share on other sites

The SPS is low-level system based on the mesh object. 

Therefore its internal billboard mode (billboard for its particles, not the whole mesh) is not managed by the engine and you have to call setParticles() in the render loop so each particle is billboarded (rotated) :http://doc.babylonjs.com/overviews/Solid_Particle_System#sps-creation

ex : http://www.babylonjs-playground.com/#WCDZS#7

[EDIT] Note : if you disable the particle rotation computation, the billboarding won't run... billboarding is rotating a particle.

As Adam said, if you are using only planar particles and not solid ones, the sprites could be a better option 

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...