• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Sending obscene amounts of data to a shader & vertex buffers question

Nehemek

Member
Hello, thanks for checking my topic.

I'm currently developing a 3d particles shader, basically a common method to do particles in 3d is to set up your own system and draw models of two triangles that will represent the 3d particles.

This is painfully slow so say no more to it. I created a single vertex buffer that countains 2*nparticles triangles, then the shader billboards each triangle and can set the speed, gravity, do the calculations etc... but I've hit a wall.

I need to send to the shader position xyz, speed xyz gravity and alpha for each particle, I thought having an array would work but there are limits on array sizes depending on the gpu, so my question is, what can I do?

The second question of my topic is about vertex buffers, maybe I can write the speed and positions directly into the buffer, however wouldn't it be slow to call vertex_create_from_buffer? Is it possible to edit the vertex_buffer with the buffer functions? Or does the vertex buffer has special formatting that do not allow this?

Thanks for your time!

--- Nehemek ----
 
You could override the function of one of the vertex attributes, like normal, or colour, if you aren't using those.
I don't know much about whether information can be added or subtracted from a vertex buffer in an efficient manner throught the course of a game. Maybe the vertex buffer could have a fixed number of "slots", and you just draw the slots that are active. Or move the 3d position of empty slots to someplace well outside of the clip space. But I don't know if you can modify vertex buffers in a random fashion. Do buffer_seek, buffer_write, work on vertex buffers? When you find out, report back. I don't see any function vertex_create_from_buffer in the documentation, so I don't know what you're talking about there.
 
Top