Skip to main content
8 events
when toggle format what by license comment
Sep 5, 2016 at 12:09 answer added Simon F timeline score: 6
Sep 5, 2016 at 3:14 comment added russ This shader looks like it should be super fast already, can't think of any further optimizations really. If / else branches will only really hurt you in a shader if you have a fair bit of code in each branch, here you're not even doing any arithmetic in the branches, just returning values, so the performance hit should be negligible. You could always replace it with a ternary operator, as in gl_FragColor = (condition) ? true_value : false_value. This compiles to a conditional move rather than a branch, so might get you a small speed boost.
Sep 4, 2016 at 3:49 comment added Nicol Bolas @J.Doe: The only way you could avoid the dot product would be... by using a conditional branch around it. Which could wind up being slower than just doing the dot product. And let's face facts: a 2D vector dot-product is trivially fast on GPUs these days.
Sep 3, 2016 at 4:07 comment added J.Doe The simulation has many modes. Sometimes they move with herd mentality meaning they might all be longer or they all might be shorter. Sometimes they are vary individualistic with some being long and others short. I have thought about it quite a bit and thought the simulation the particles will be shorter and longer equally. So unfortunately we can optimize due to use cases.
Sep 3, 2016 at 4:02 comment added aces What is the average speed of the particle? Is it normal to be the same size as that blue diagram at the bottom? I'm just trying to get a good idea of the use cases.
Sep 3, 2016 at 3:43 comment added J.Doe Yes, I have used dot(delta, delta) before in place of dist * dist. I just did the dot product that way to simplify things.
Sep 3, 2016 at 3:41 comment added aces To clarify, is the dot product you are referring to "len"?
Sep 3, 2016 at 1:48 history asked J.Doe CC BY-SA 3.0