# How to do pixel per pixel modeling in unity3d?

So generally I want to have api like pixels.addPixel3D(new Pixel3D(0xFF0000, 100, 100,100)); (color, position) where pixels is some abstraction on 3d sceen objet.So to say point cloud. It would have grate use in deep space/stars modeling... I want to set each pixel by hand (having no image base or any automatic thing)... So point is modeling something like

Or look at alive flash analog here

How to do such thing in unity?

• Unity is really not the right tool for this. Even raw OpenGL would be easier. – user744 Dec 16 '10 at 20:41
• @Joe Wreschnig flash can do this I do not see why U3d cannot do such simple thing... – Kabumbus Dec 16 '10 at 23:15
• Flash is an engine that specializes in 2D rasterization. Unity is an engine that specializes in building 3D scene graphs. "Simple" is relative to the storage and rendering model. – user744 Dec 17 '10 at 9:41
• Assuming OP wants a lot of points (point cloud) to be computed and rendered. Flash is not the tool for that, too slow. – Samaursa Dec 17 '10 at 18:50
• @Samaursa, Using vectors it would be too slow. That is why flash has the BitmapData Class. – AttackingHobo Feb 4 '11 at 16:49

As Joe pointed out, unity is not the right tool for this. I would suggest something as simple as glut if you do not require other features that unity offers. What you want to do is render all the desired pixels as particles off-screen, that is, on the GPU: High-Speed Off-Screen Particles.

Your particles will most likely be in a 3D grid. A large 3D grid is a problem (for example 256*256*256) as there are too many grid cells that you have to process, in which case you would want to design your own spatial graph, for example an Octree, to process only the cells that contain particles. For simpler patterns and not too many particles, you can get away with sequential grids.

Unless you really want to render out little cubes for each pixel, you'd probably want to do this with sprites.

• The term for what you want is "point cloud" I think. At least based on the sample picture. – Tim Holt Dec 16 '10 at 20:01
• Point clouds are a geometry storage format and rarely rendered directly. They usually require (expensive) triangulation or voxel-like rendering with marching cubes before actually rendering. – user744 Dec 16 '10 at 20:40
• I always thought point clouds were a set of vertices in a three-dimensional coordinate system. – Tim Holt Dec 16 '10 at 22:28
• Yes but vertices in themselves are not visible entities... – Oskar Duveborn Dec 17 '10 at 0:31
• A vertex is a point, yes. He wants to render a single "pixel" at each of those points. He wants to visualize a point cloud. – Tim Holt Dec 17 '10 at 2:06

You could use C# or javascript to generate the desired image as a heightmap, then place those on a bunch of planes. You could also look at the heightmap generator in the procedural generation demo, Unity has in there projects, for how to place the "Pixels"/planes at the desired height or distance from the camera.

This isn't any different than Tim's answer really, it just uses planes instead of cubes. Either way you will most likely have an object/instance for each "pixel" anyway.

Also If you are going for the look above you will probably need to have a sprite manager that converts the jpeg into the associated grouping of cubes/planes, that way you don't have to do anything special for the assets.