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 need to render some 3D points with WPF. How can I do this?

I need an easy and fast solution to just render this point cloud. No lights, no texture, no sound, no physics, just colored 3D points in a space with rotating camera.

How can I do this without having to learn Direct3D/OpenGL/any complex 3D engine?

share|improve this question
    
To achieve what you want to do in OpenGL for example wouldn't be too hard at all, if you genuinely don't need the lighting and such then you simply wont need to learn about nor implement it. And then if you wanted to extend what you'd done with it, it would be much easier than porting over from something else. –  Quetzalcoatl Mar 9 '13 at 17:10
    
thank you, i think i can use this as starting point: codeproject.com/Articles/265903/… Do you know where i can find some documentation on how to render my cloud point? I really don't know anything about openGl! –  AlexanderPD Mar 9 '13 at 17:13
    
There are far too many tutorials to list, but the rough thing you'll want to do is probably (using the old pipeline for simplicity); draw GL_POINTS using glVector3f(x,y,z) and use gluLookAt() for the camera that rotates around the cloud. –  Quetzalcoatl Mar 9 '13 at 19:46
    
i read about the GL_POINTS but i need to render about 1.600.000 points and update them at every frame, GL_POINTS and glVector3f will be fine for that? –  AlexanderPD Mar 10 '13 at 2:12
    
Possibly not ideal, you may wish to learn about using vector buffer objects and such. I'm by no means an expert on the subject though, only just getting into OpenGL myself, there may be better ways that I'm unaware of. –  Quetzalcoatl Mar 10 '13 at 2:40

1 Answer 1

This isn't something WPF is particularly well-suited for; it's 3D capabilities, while backed by hardware acceleration eventually, are very abstract and high-level.

Using only technology built-in to WPF itself, your best bet is probably to leverage the MeshGeometry3D class. This object has a list of 3D positions and a list of indices into that 3D position list. Every three indices into the position list define a triangle with the three referenced position points. Thus, you'd need to:

  • Generate your 3D point cloud.
  • Turn each point into some simple 3D primitive (such as a quad defined by two triangles within a plane perpendicular to the view direction).
  • Insert those points, and corresponding indices, into the relevant lists.
  • Bind those lists to a MeshGeometry3D object (or just instantiate one at runtime).

While you might be able to come up with a method that is simpler in code (in particular by avoiding the second step by simply placing a bunch of pre-defined geometry objects, like cubes or 2D rectangles adjusted by depth to fake perspective), you are likely to run into scale problems much sooner given the overhead of each point in such an approach. Stuffing everything into a single object eliminates much of that overhead for improved scaling and performance. Plus, it doesn't require you to recompute every point when the camera rotates as you would in the projected 2D case (instead, you adjust the object's 3D transform property).

If you are okay with a solution that uses external dependencies, the Helios toolkit provides a bunch of simple 3D primitives and utilities that will likely take a large chunk of the grunt work out of the above implementation.

share|improve this answer

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.