Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I have points which I pass to a vertex shader and then to a geometry shader, but now I want to get from the geometry shader a "bigger" point. So the point should get a "dadius" like it was possible in Direct3D 9.

Can anyone help me what I have to write in my geometry shader? I actually have the following code, which only passes the point to the pixel shader.

void LightGeometryShader( point GeometryInputType input[1], inout PointStream<GeometryInputType> TriStream)
{
    GeometryInputType output;

    for( int i=0; i<1; i++ )
    {
        output.position = input[i].position;
        output.color = input[i].color;
        output.tex = input[i].tex;
        output.viewDirection = input[i].viewDirection;
        TriStream.Append( output );
    }
}
share|improve this question
    
You could render billboards. –  bobobobo Jun 20 '13 at 16:44
    
If I would take billboards is it possible that I have points with a pixel size of 3 and in the color, the passed point was? –  CmasterG Jun 20 '13 at 16:53
add comment

1 Answer

You can pass any vertex attributes you want in from IA to the VS, which in turn you can pass to the GS. Create a radius attribute in your InputLayout. The VS can pass that on to the GS, which in turn can use it to construct a view-aligned circle or a billboard of a circle texture via that radius value. You could also just set it as a uniform if all your point sprites will be of the same size and save on update bandwidth a bit.

There are GDSE articles on billboarding and a ton of information on billboarding online once you get to that part.

share|improve this answer
    
Hi! Ok Thanks a lot, but I would like to have a method, where I don't have to move my points, because it's for visualizing point clouds and it is enough to move the camera instead of the data. I thought that there is maybe a easy and fast technique to give the points a radius, like calculating points exactly next to them. :) –  CmasterG Jun 20 '13 at 20:48
    
I have no experience with point cloud visualization techniques, sorry. There's some nifty JavaScript/WebGL demos of such, though, maybe you could look at how they do it and port it over to C++/D3D. –  Sean Middleditch Jun 20 '13 at 20:51
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.