How to draw thousands of sprites with different transparency?

Hi, I am using Firemonkey because of the cross platform capabilities. I want to create a particle system. Now I use TMesh, which works well enough to quickly display particles. Each particle is represented in a grid through two textured triangles. Using different texture coordinates, I can show many different types of particles with the same grid. The problem is that each particle can have its own transparency / opacity. With my current approach, I cannot set the transparency individually for each triangle (or even the vertex). What can I do?

I realized that TMesh.Data.VertexBuffer has other properties, such as Diffuse or other texture sets (TexCoord1-3), but these properties are not used (not even initialized) in TMesh. It doesn't seem easy to just change this behavior, inheriting from TMesh. It seems to need to inherit from a lower level of control in order to initialize a VertextBuffer with more properties. Before I try to do this, I would like to ask if it is possible to control the transparency of the triangle with this. For example. Is it possible to set a transparent color (Diffuse) or use a transparent texture (TextCoor1)? Or is there a better way to draw particles in Firemonkey.

+8
delphi delphi-xe2 firemonkey
source share
1 answer

I admit that I know little about this particular structure, but you should not change the transparency through the vertex points in the 3D model. Points are usually x, y, z coordinates. Now the vertex points will affect how sprites are illuminated if you use a lighting system. You can also use vertex information to apply various transparency effects.

Now, perhaps there are a dozen different ways to do this. Usually you have a texture with varying degrees of alpha that can be set at runtime. Graphic APIs usually have some filtering function that can quickly apply values ​​for sprites / textures, while a good one uses a graphic chip, if available.

If you can use the effect, it is usually better, since the nuclear way is to create a bunch of different copies of the sprite, and then apply the effects to them separately. If you use Gouraud Shading, then it gets easier, because Gouraud uses code to populate texture information.

Are you using light particles now? Some graphical APIs do have code that makes light particles.

Edit: I just remembered Vertex Shaders that could.

0
source share

All Articles