-
-
Notifications
You must be signed in to change notification settings - Fork 119
Add comments about default gravity in the particle system. #294
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
Conversation
ca4d900
to
fdd71fc
Compare
Hi and thanks for the kind words, I really appreciate it 🙏 I think you are right, it’s a bit weird that there is a default acceleration. I have changed it so you’ll have to pass in an acceleration in About the Thanks for the contributions 💪 |
Oh, that's an even better solution, agreed. Thanks for doing that.
Check, I wasn't quite sure about the backwards compatibility policy. With that in mind, some more thoughts for consideration :) The use of The second thing is - again because of familiarity with other tools - that I wanted to be able to pan the OrbitControl, so change the point it rotates around. With the current OrbitControl that's not really possible, so I ended up making these changes (not sure if the math is 100% right, but it works well enough), effectively using the |
Sorry for the late reply, I'm trying to take a small break from my computer - it's not going super great 🙂 Really nice feedback, I really appreciate it! It can be hard for me to see where there can be usability problems since I'm so familiar with everything, so please keep the feedback coming if you have any 🙂 And if you want to make some example, please go ahead, I think the more examples the better! It's a great way of contributing! I see the problem with instances having rotations, translations and scale instead of just a transformation matrix, maybe that was not a great choice. My reason for doing it, is that if you only want to apply a rotation to each instance, you still need 12 floats on the GPU for each instance (the first three rows of a Nice to hear that you got a speedup using instances, it is a really powerful optimisation 👍 And as I said, if you want to make an instanced example, please go ahead. The About the |
I've opened a PR for the proposed example, one last thing I'd like to respond to from this thread.
Yeah, I don't think that optimisation really matters, the amount of 'stuff' happening around the calculation of the updated pose / translation likely vastly exceeds the difference between sending a 4x4 or sending a quaternion. With the current API the only thing one can do is send translation and rotation, since translation is not optional. I guess it could make a difference if the gpu was used stateful, and we could solely update the rotations, but keep the positions as they were previously. (Not sure if that's possible, my understanding of modern graphics things is super limited). Personally, I'd lean towards making
It implements Quaternion to Matrix3 and Matrix4, it does not provide Matrix4 to Quaternion, to do that you first have to go to Matrix3, then you can convert that to a quaternion. But I didn't see a convenient way to convert from a Matrix4 to Matrix3. So I ended (comment in the code links to an upstream issue around this) up truncating the columns, creating a new matrix and then converting that into a quaternion. Not a big deal for the developer, or for the performance, but something I ran into that was surpsising. Definitely minor in the grand scheme of things 👍 |
By optimisation, I mean the amount of graphics memory used, not performance, but yeah, probably not really worth it. Fun side note, I actually had it as a transformation, but explicitly thought splitting it into different elements was a good idea, see the discussion in #234 🙂 I think I will just change it to a That is a bit weird that it doesn't implement I will look at the example shortly 👍 |
Ah, different background / domains, for me optimisations and performance always refer to CPU and memory lookups / allocations.
I think this will be tricky; The scaling component in the 4x4 matrix means the top left 3x3 is no longer a pure rotation matrix, and splitting it into individual parts may not be trivial (if at all possible). I've never tried it though, I just scale the meshes themselves and then all 4x4 transforms are normalized. If you want to easily allow for this future optimisation, I'd make the translation optional and add |
Yeah you are right, it's not trivial to split it. However, the common use-case is to only apply translation to each instance (for example if you have a point cloud), and in that case, I can check to see if all the |
Hi again, let me start this PR by saying; Thanks for this library, it's been a joy to work with so far!
Today I ran into the first surprise using it: I was trying to integrate the fireworks example into my own project; copied in some parts, modified the origin, scaling etc... then I noticed all particles were flying to the side by a few meters during the explosion time. Looking at the velocity generation from the example, I couldn't figure out how that could be the case...
After a while I discovered that there's a default gravity of
(0.0, -9.82, 0.0)
in theParticleSystem
. But that default doesn't work for me: I'm a roboticist and used to a coordinate system with x forward, y to the side and z being upwards. To be able to do all math and rendering in a familiar coordinate system my camera has an up vector of(0.0, 0.0, 1.0)
, which meant that the default gravity of the particles makes everything fly off in they
direction.This PR adds a bunch of comments throughout the fireworks example, including calling out the default gravity, currently that's not mentioned in the example. It also adds it to the main section of the ParticleSystem documentation. Currently the default acceleration is mentioned for the acceleration field, but not in the main section. I think this is worth calling out, I at least found it surprising.
I'd even consider changing the default acceleration to be zero, happy to make that change, but thought that improving comments and docs would go a long way while being backwards compatible.
Edit: Discovered that to hide particles that are behind other geometries in my scene I had to set the
depth_test
RenderStates attribute toLessOrEqual
. In the example that is set to Always, to me the example looks the same with that set toDepthTest::LessOrEqual
. The pipeline what looks like a flakey error retrieving a dependency, so going ahead and pushing a commit to change that toDepthTest::Always
.