I pass it down the pipeline from the input, the UV coordinate from the mesh ends up in TEXCOORD0, but I prefer to do my coloring from the texture in the fragment function because it applies on a per pixel rather than a per vertex.
What do you mean how do you move the vertices? You mean like modify the position of the vertex during the vert function? If so you can just add things onto v.pos before you multiply it with the matrix
Yes, the other alternative is to use the tex look up in the frag function because then if a color changes part way through it should update smoothly across all the pixels (at least from what I understand)
You could switch the frag to look like this:
float4 frag(v2f i) : COLOR {
return tex2D(_posTex, i.uv);
}
I set each vertex’s color separately when the mesh is created and each vertex shows up as a single pixel, so I just need it per-vertex.
By the way, this is what I am working on (make sure you enlarge it):
The particle system can handle 16777216 particles, all on the GPU. I think the session above was 1048576 particles cruising at a silky 1300 FPS. (not a typo)
My latest version is attached if you want to use it!
Now I just need to be rendering billboards instead of points and this will be golden! (then I can lose the reliance on OpenGl) When will point size (gl_pointSize) be supported on all platforms?
I’ll have to initialize 4 times as many vertices (plus two triangles per point). I think I can use the secondary UV coordinates to assign corners to the vertices.
After that it is just a matter of reading in a particle texture for which I may need to do some more research.
If you have any suggestions on how this can be made better, please tell me.