Jump to content
  • Advertisement
Sign in to follow this  
simco50

Visualize points as spheres

This topic is 635 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello,

 

I am working on a framework that works with particles and I am wondering what the best way to visualize the particles is.

I've seen the Nvidia Flex demo and it has a really nice result although I don't understand how it is done (the shader is really unreadable).

33862419312f46b187615a485bfeec73.jpeg

Do you guys have any ideas what the best approach is?

Share this post


Link to post
Share on other sites
Advertisement

Well if you want spheres you could use instancing and draw those sphere in big chunks(or in one chunk depends on your case).
Otherwise if it is suitable for you you could draw them as points. Both OpenGL and D3D support drawing directly points on the screen with customizable size.

 

@work we've simulate particles and in order to draw a preview of those particle we just draw them as points(GL_POINTS or D3D11_PRIMITIVE_TOPOLOGY_POINTLIST) and give the user an integer that specifies the size of those points. It works like a charm.

Share this post


Link to post
Share on other sites
You could use billboards to draw spheres. If you store the radius of the sphere you can calculate the correct depth values per billboard in the pixel shader and draw it accordingly.

Share this post


Link to post
Share on other sites

From the image it appears that the particles are casting shadows also. This means that points a billboards won't work as demonstrated. I haven't looked at the shader, but it looks like they are combining an instance shader with a direct light shadow mapping shader. This would effectively mean the scene would be rendered twice-- once for the shadow mapping and once for the color (I don't think they are using a texture).

Share this post


Link to post
Share on other sites

Thanks for the resposes! The spheres indeed have shadows so probably they're meshes. I've got it working by using instancing, that does the trick perfectly.

Share this post


Link to post
Share on other sites

You can render them as billboards with custom depth output from the pixel shader (also a pixel-kill). You would draw them the same way for your shadow-map (they're symmetrical).

 

You'd draw the billboards instanced, packing the vertices better into vertex wavefronts, instead of shading 4 vertices at a time greatly underutilising/wasting the wavefront size.

 

Whether it's going to be slower than rendering actual sphere meshes is unknown to me.

Share this post


Link to post
Share on other sites

But billboards would introduce scaling artefact in shadowmap, considering they can be bigger/smaller. A larger bilboard texture sampled is a serious underperforming.

 

A 64 vertex mesh being rasterized over several pixels without any texture sampling is simply the fastest thing that can happen, plus, it is a well defined sphere (a mesh).

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!