   Is it possible to create a simple Circle (vertex data) with the vertex shader?
  I do not know that much about VS/PS, therefore my question: Would it be possible to create the vertex data of e.g. a circle in the vertex shader? (Let's say the data (radius,...) for the creation of the circle will be given as dynamic parameters to the vertex shader program) Could this offload vertices calculation that has to be done on the CPU (if vertex data is normally generated by CPU, e.g. in a dynamic vertex buffer)Thx,Vertex   
  The vertex shader can only modify vertices, it can't create them. It is possible though; you could have a vertex structure that has a position, normal and a single float in it. The position value would be the center of the circle, and the float value would be the rotation about the normal for this vertex. You can then specify the radius of the circle as a shader parameter.Your shader then grabs the angle from the vertex, and calculates a rotation about the normal by that angle, given the current radius, and uses that position to offset the position of the vertex.You could even pass in the normal and position as shader parameters too, or pass the circle radius as a vertex parameter if you want to use the shader to draw several circles.   ;Quote:Original post by Evil SteveThe vertex shader can only modify vertices, it can't create them. It is possible though; you could have a vertex structure that has a position, normal and a single float in it. The position value would be the center of the circle, and the float value would be the rotation about the normal for this vertex. You can then specify the radius of the circle as a shader parameter.Your shader then grabs the angle from the vertex, and calculates a rotation about the normal by that angle, given the current radius, and uses that position to offset the position of the vertex.You could even pass in the normal and position as shader parameters too, or pass the circle radius as a vertex parameter if you want to use the shader to draw several circles.I think I can follow you... this sounds very interesting, since it would be possible to offload all the creation calculation from the cpu to the gpu, as long as you know the amount of vertices (and create the VB).But just to be sure: Is it possible to directly calculate the vertex xyz like I would do on CPU?What would you say about the vertex shader performance of graphics cards? Are they faster or slower as the cpu? (software VS is out of discussion) Would such an algorithm be possible on a VS1.1 graphics card? (not that it this is a criteria, but if possible why not)I hope at least some of my questions can be answered.   ;Quote:Original post by Vertex333But just to be sure: Is it possible to directly calculate the vertex xyz like I would do on CPU?The shader can do whatever you like; just remember it only deals with a single vertex at a time though.Quote:Original post by Vertex333What would you say about the vertex shader performance of graphics cards? Are they faster or slower as the cpu? (software VS is out of discussion) Would such an algorithm be possible on a VS1.1 graphics card? (not that it this is a criteria, but if possible why not)I hope at least some of my questions can be answered.The performance is going to be at least that of the CPU; and has the benefit of not needing to transfer the calculated data across from the CPU to the GPU. The main performance increase comes because vertex shaders run in parallel, with some cards processing 32 vertices simultaneously (May even be more than that).And yes, this can be done with VS 1.1 I believe - if not, you can always use software vertex processing, which isn't usually that massive a performance problem.   ;Quote:Original post by Evil SteveQuote:Original post by Vertex333But just to be sure: Is it possible to directly calculate the vertex xyz like I would do on CPU?The shader can do whatever you like; just remember it only deals with a single vertex at a time though.Quote:Original post by Vertex333What would you say about the vertex shader performance of graphics cards? Are they faster or slower as the cpu? (software VS is out of discussion) Would such an algorithm be possible on a VS1.1 graphics card? (not that it this is a criteria, but if possible why not)I hope at least some of my questions can be answered.The performance is going to be at least that of the CPU; and has the benefit of not needing to transfer the calculated data across from the CPU to the GPU. The main performance increase comes because vertex shaders run in parallel, with some cards processing 32 vertices simultaneously (May even be more than that).And yes, this can be done with VS 1.1 I believe - if not, you can always use software vertex processing, which isn't usually that massive a performance problem.Thx! Coming from the fixed function pipe view this is really amazing...   ;  If you're dealing with an object that's created once, it'd be better to create it on the CPU side. If you're dealing with something that'd change over time, and you want to calculate it in the vertex shader, consider what part of the calculation can be done only once, and take that out to the CPU side. A vertex shader will need to calculate everything every time you render.   ;Quote:Original post by ET3DIf you're dealing with an object that's created once, it'd be better to create it on the CPU side. If you're dealing with something that'd change over time, and you want to calculate it in the vertex shader, consider what part of the calculation can be done only once, and take that out to the CPU side. A vertex shader will need to calculate everything every time you render. But expecting it to change would improve performance, wouldn't it? Nevertheless it's anyway my choice to "run" a VS in a frame to update an object, isn't it? I thought of only updating needed objects. Quote:Original post by ET3DA vertex shader will need to calculate everything every time you render.Isn't it possible to save VS calculations in a VB?;  i think it is but only on ATI cards. Not sure though. It is something called R2VB technology, but i am not sure if it made it to the shader model standards   ;Quote:Original post by Vertex333Quote:Original post by ET3DA vertex shader will need to calculate everything every time you render.Isn't it possible to save VS calculations in a VB?Possibly yes, feasable no. The best way is to use ProcessVertices() to do it. You could do it on the graphics card, but the time taken to transfer the data the "wrong way" across the bus is going to vastly outweigh the time saved by doing the calculations on the GPU.   ;  I read a bit (I definitely know too less) and start to implement a simple rectangle (consisting of four, not two triangles). I'm not exactly sure in which way I should do it, but I will try to not use Processvertices/VertexBuffer upload. Instead I will simply create the data every frame. I hope that I can do this for about 10000 Vertices. I was thinking a bit of the way doing this exactly and there is one thing that seems a bit problematic to me. On the CPU I can create vertex data in a for loop with my index variable and that was it. In the vertex shader I need to know at which vertex I am to create/process it. So I may know the actual position/color of the vertex (should/can I add additional information? Maybe I can add a float (as Evil Steve mentioned) and use it as an index). The vertex shader function parameter shouldn't be useful at all I think, since as far as I know I can only assign the values for all function calls/vertices and not for each single call/vertex. Thx,Vertex   