Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Particle bounding box too small #2492

Closed
MatthewsSam opened this issue May 11, 2016 · 7 comments
Closed

Particle bounding box too small #2492

MatthewsSam opened this issue May 11, 2016 · 7 comments

Comments

@MatthewsSam
Copy link
Member

There is a recurrent problem with particles. Their bounding box is limited to the emitter. However they can be outside of the emitter (imagine a fire, with the emitter being on the center and smoke going up).

The issue is, with frustum culling you can end up having particles popping in and out of the screen (as soon as the emitter is outside the camera's view, all particles associated with it will disappear).
#1 Easy solution:

Add an option to force the visibility of a particle system to be always visible (not optimal but it will work)
#2 A bit more complex:

Add an option to increase the bounding box of the particle system by a certain factor
#3 The optimal solution:

Compute a bounding box depending on the option in the particle system

(I know it's a rather "trivial" bug, however it prevents me to create the upcoming trailer, since there will be a huge cloud of steam)

@auriamg
Copy link
Member

auriamg commented May 12, 2016

Not committed, but here's a workaround you can use meanwhile

\stk\stk-code\src\graphics\gpu_particles.cpp, method scene::IParticleSystemSceneNode *ParticleSystemProxy::addParticleNode
add this before the return statement :

node->setAutomaticCulling(0);

A more permanent solution needs to be investigated, considering performance considerations

@auriamg auriamg modified the milestones: 0.9.3, 0.9.2 May 26, 2016
@hiker hiker modified the milestones: 0.9.4, 0.9.3 Aug 29, 2017
@Benau
Copy link
Contributor

Benau commented Oct 8, 2017

Only possible with cpu particle for 3

@Benau
Copy link
Contributor

Benau commented Oct 13, 2017

https://github.com/supertuxkart/stk-code/tree/cpu_particle_v2

This fixes the above bug with alpha test particle possible, devee this one good for you?

@Benau
Copy link
Contributor

Benau commented Oct 13, 2017

...although I have to remove the uniform if flips, otherwise my android crash when XXXParticleRenderer::getInstance()->use();, not sure if true too for you

@deveee
Copy link
Member

deveee commented Oct 13, 2017

Now it works great for me! Now I get 35-45fps in Hacienda on a tablet, previously it was something around 29-35. Other tracks work faster too. And now the difference between enabled/disabled particles is much smaller (2-3 fps caused by exhaust emitter).

You mean a crash caused by flip particles? I'm not sure where I can test it, but I didn't have any crash after playing few tracks.

Btw it looks that depth test is now disabled, because I see the waterfall in zen garden when I start a race.

@deveee
Copy link
Member

deveee commented Oct 13, 2017

If it crashes just because of uniform int, then you can try uniform float and "if (flips > 0.0)"... Or sin/cos angle may be too big, so you can try mod(value, 6.283185307179586);

Atm. I don't have better idea, particle manager seems to be ok.

Or in worst case we can disable it for GLES. The difference is imo barely visible, at least for snow.

@Benau
Copy link
Contributor

Benau commented Oct 14, 2017

Now all bugs / crashes in my end are fixed and this branch is merged.

And I have made the STKParticle working in legacy pipeline without too much work, do you want to keep the Affector in particle emitter? now it's always m_is_glsl = true;

@Benau Benau closed this as completed Oct 14, 2017
@Benau Benau modified the milestones: 0.9.4, 0.9.3 Oct 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants