Tag Info

Hot answers tagged

61

It's a cool idea. You'd need some sort of diffusion gradient around your ship. There are three physical models I can think of that you might want: You want it to seem almost like it's a liquid medium, where the pressure gradient rebalances, i.e. once you've passed some particles they move back into your wake (like water behind a boat). In this instance, ...


22

I stumbled across this tutorial a while back, which looks to be a good resource: http://www.gamedev.net/page/resources/_/creative/visual-arts/make-a-particle-explosion-effect-r2701


21

Check out how PixelJunk Shooter did it (including simulation) in this presentation (PDF) at GDC2010.


16

You could try the old school fire effect. Let's say you store an 8-bit temperature value for each of your pixels. At each update: Feed the bottom line with random "hot" pixels (e.g. 200-256). For the others lines, all the way up: Each pixel gets a new temperature from the pixel below Times a random decay factor Pick your pixel colors from an 8-bit ...


16

This is a very broad question, but generally particle system features can be broken down into a few categories. Here are some general ideas for the sorts of things you might want to have. Emission features define how, when, and where particles are emitted. Continuously generate particles at a fixed rate, or generate a cluster all at once when triggered ...


14

Yes, it is. Allocation time isn't the only factor. Allocation can have side-effects, such as inducing a garbage collection pass, which can not only impact performance negatively it can also impact performance unpredictably. The specifics of this will depend on your language and platform choices. Pooling also generally improves locality of reference for the ...


13

I admit I'm not aware of any ideal solution to this problem, so I'll describe a workaround that you may or may not be comfortable with: Render all of the particles using additive blending to a separate texture (or render target) with its background cleared to transparent. Render that texture (or render target) on top of your scene using alpha blending. I ...


9

George Duckett's answer is far more direct and really well presented if you need fully-simulated water in your game. For simulated shallow-water physics with minimal accuracy (less realism, more playful), this image gave me an incredible moment of clarity: http://www.patrickmatte.com/stuff/physicsLiquid/


9

What you want to do can also be thought of as reflecting the particle's velocity off the plane tangent to the circle at the point of contact. If you know the equation for doing that, then all you need to know is the circle's normal at the point of contact. To get that, all you need to do is normalize the vector from the center of the circle to the point in ...


8

Probably the first option, as the second option implies you can only have a single explosion in any given frame. Unless you're talking about having a factory produce the explosion objects in the second option, in which case the two options are not mutually exclusive and you probably should, in fact, do both. Regardless, the only downside to the first option ...


8

Conserve your precious CPU/GPU cycles! You can inexpensively approximate rain (and rain splats) without using particles. The rain drops and splats don't even have to move or be aligned! Basically, randomly draw a bunch of the following sprites onto the screen: Source: bulletproofoutlaws.com (There's also a video of the final effect)


7

I think the key phrase is particle system so most of the samples out in the wild are going to be more complex than you would think a simple demonstration should be. OOP doesn't really enter into the low level part of particle systems and C is very straight forward to convert to other languages so I wouldn't worry about that. The trick to particles is that ...


6

How does that save any significant amount of time? Presuming you handle the rotation in a vertex shader, that only saves time if you're VS bound. If you are talking about a fixed-function pipeline, it's much cheaper to precompute the rotated edge vectors for the quads you are using. Rotating the texture is then done by the GPU. The only way that might incur ...


6

Box2D was written as a tutorial on how to write 2D physics engines. The site contains links to a lot of presentations on how the algorithms work and how to make it efficient. You might also want to look into this presentation done by the Pixeljunk Shooter team, describing how they did 2D fluids. If you are interesed in 3D, read Realtime Collision ...


6

How to create prerendered effect is another question. You can create fires, smoke etc in Autodesk Maya. It has very strong fluid solver (fluids means fire, smoke, nebulas or even fog ...). This can be also putted into sequence of files and played. For real smoke/fire etc. simulation, you can implement physically correct (or very near to it) fluid solver is ...


6

Found the answer in here. You can directly use the output of the editor in the API. It's really cool.


6

From the video showed it just seems to be plain gravity to me. Most people think gravity makes things flying downwards, but looking at it from a more far away perspective it makes things fly in a elliptical or spiral kind of motion around the center. The particles are always accelerated towards the center, however fly beyond it until the gravity forces it to ...


5

The first option seems overwhelmingly preferable: it allows for the particles owned by a given emitted to be processed in bulk, and it allows you to do better broad-phase culling of objects. It provides locality of reference to your particles and implies far less per-frame maintenance of the same. The second "global particle list" option is a bad design ...


5

As with all other "preferable" or "best" approaches, it depends on what your end goal is. For example, if you associate the particle list with it's emitter, this means that the emitter must continue to live until the particles have all decayed away. So your emitter needs to have more state. It needs to know whether it should be actively emitting more ...


5

Such effects are done with particle systems. Basically it's a big collection of 2D images that move as a group. In both cases the individual images have alpha transparency so that they look like blobs instead of squares. For fire the sprites usually have add blend while smoke particles generally don't.


5

You are on the right track. Typically for particle effects, flat triangles or quads are used for the particles as opposed to something like glutSolidCube. Often the quad are billboarded so that they are always oriented to the camera (so you never see them edge on). Having said that, there is no reason why you can't use cubes for your particles (apart from ...


4

For explosions in particular it's very important to get the blending right. One very important element is the use of pre-multiplied alpha. Quoted from the link: What if you want a single particle system that has additive flame particles turning into sooty lerping particles as they age? You can't change renderstate in the middle of a particle system, ...


4

It is certainly possible to run a particle simulation on the GPU using vertex shaders, but you may be very limited in the kinds of behaviors that you can simulate, depending on the capabilities of the GPU. In order to run the entire simulation on the GPU you cannot make use of the results of previous frames. Which means that the current state for any ...


4

Here's what I would do. Step 1: Don't sort. Just do it. See if it's a problem. Most likely isn't. Step 2: Limit particles into such that do not really need sorting, such as: Just solids (with possibly alpha-to-coverage edges) let zbuffer take care of the sorting. Just additive bits a+b = b+a, so order doesn't matter Step 3: if more is needed, ...


4

I would go for the first option: It sounds simpler. It adheres to encapsulation principle better. It is likely that you will have to optimize the particle emitter. One of the common ways to improve speed is to have an array for particles and reuse the "dead" ones. I think it will be easier to handle if each emitter will be dealing with its own data.


4

Two polygons with a texture is faster. Why? Because it is the typical way to do things. If you're working in 2D then you can just use SpriteBatch. And for 3D, here is a sample that you could reuse (one of many you could find online). By reusing this existing method and perhaps code, you will save yourself a lot of time researching, designing, and ...


4

Use sprites textured with glow textures, with an additive blend. The additive blend is crucial here. This is how most glowing effects are achieved. Additive is the synthesis of lights, actually. You don't need an alpha mask for textures used with an additive blend. The RGB mask is used as the alpha layer, where black is fully translucent and white fully ...


4

As David Gouveia pointed out, there's no satisfying replacement for additive blending on bright backgrounds. The best effect I found (that doesn't require something like rendering to a backbuffer) is to use the following GL blendmode: SRC: GL_ONE DST: GL_ONE_MINUS_SRC_ALPHA It's not as nice as additive blending, but way better than GL_SRC_ALPHA, ...


4

Pixel perfect collision with particles would be very CPU intensive, this would be even worse on a mobile device. You may want to cheat and use a bounding shape to surround the area the particles occupy, and use that bounding shape for collision purposes. This doesn't have to be exact. It's an approximation of the area the particles occupy. I imagine if you ...


4

Grant Kot has put some of his fluid simulation code up on Github with implementations in both javascript (canvas) and C++ with OpenFrameworks: https://github.com/kotsoft He has a few demos up on his youtube account: http://youtu.be/HqWheJSEiaw I have no idea how it works, but I know it runs fast and there's all sorts of variations to build with it. A good ...



Only top voted, non community-wiki answers of a minimum length are eligible