New To The Forum? Click Here To Read The How To Guide. -- Developers Click Here.

Voxel Paint v1.1 - Create pixel art in 3D

rubixcube6rubixcube6 Posts: 164
Hiro Protagonist
edited April 2015 in Games and Apps
Voxel Paint is a simple tool for making 3D pixel art.

Controls
Mouse Left Click: Draw a voxel (hold and move to draw a line).
Mouse Right Click: Erase voxels.
Pencil and Eraser (Optional): look at the pencil or eraser and left click.
Mouse scroll wheel: moves the grid forward and back.
Change colors: Look at the color tool (on your left) and use the mouse to move the sliders
Rotate Voxels and change grid size: Look at the options tool (to your right) and use the mouse to click buttons.
Change sitting position: arrow keys.

Save/Load and Delete
Look at the drawer to your left and you should see some boxes. Look at a box to highlight it and press the following keys....

S: Save
L: Load
D: Delete

example1.png

example2.png

color.png

Options.png

SaveLoad.png

Download (Windows): Voxel Paint v1.1

Comments

  • cyberealitycybereality Posts: 23,507 Oculus Staff
    Very cool.
    AMD Ryzen 7 1800X | MSI X370 Titanium | G.Skill 16GB DDR4 3200 | EVGA SuperNOVA 1000 | Corsair Hydro H110i
    Gigabyte RX Vega 64 x2 | Samsung 960 Evo M.2 500GB | Seagate FireCuda SSHD 2TB | Phanteks ENTHOO EVOLV
  • ccsccs Posts: 219
    Hiro Protagonist
    This is really fun! Thanks for sharing!

    One suggestion - can you make right-mouse be erase and left-mouse draw? It is easy to make mistakes while drawing, and this would make it much quicker to fix them!

    I think it would be cool if you could make bigger models as well, or when you are done working on the model on the desk have a way to scale the size up and walk around it somewhere away from the desk.

    ccs
  • drashdrash Posts: 2,827
    Trinity
    Thanks so much for sharing this. You've done a lot of interesting things here. The realtime clock, the mouse cursors that activate depending on which section of the table you're looking at, mixing up the different grid sizes in one drawing, and representing saved scenes as boxes in the drawer. Love it. :-)

    Without looking at any of the controls, I figured out all except for the Save/Load/Delete keys just from intuition. Before I checked the controls, I was clicking on the save scene boxes with the mouse, to no avail, since that was how you interacting with everything else. So as far as intuitive controls, perhaps information about the S/L/D keys could be integrated into that area of the desk somehow.

    I agree with ccs that it would be great if the right mouse button could erase. Or, like in some paint programs you are able to assign a "foreground" and "background" color to left and right mouse buttons and then just go from there. If you do that and then assign "clear" to the background color, then you've got your easy eraser while still having the flexibility of drawing with more than one color if the situation calls for it (like if you overwrite a colored block with another, and want to undo).

    I did find one bug -- I drew some larger 16x16 voxels, and then switched to smaller voxels in 32x32 mode and was able to draw right through the larger voxels, making them overlap and flicker.

    Also, I wasn't able to draw a larger voxel into a space occupied by one smaller voxel -- wasn't sure if that was intentional or not.

    Anyway, very cool stuff! :)
    TitansOfSpacePlus_CoverArt_VRLandscape5_60p.png
  • rubixcube6rubixcube6 Posts: 164
    Hiro Protagonist
    Thanks for the review and all the suggestions! Here's an updated version that supports right click erasing. The pencil/eraser still works like before except holding down right click will make it erase and when you let up it goes back to the pencil.

    Download (Windows): Voxel Paint v1.1

    I think instead of adding foreground/background color to the cursor, Ill add swatches to the scene so you can select from pre-made colors. Then Ill have blank swatches where you can click to save your colors. (Right click to set color, left click to select)

    The overlapping issues stem from the way the cursor detects if there are cubes touching the cursor. Turns out that using the standard unity collision detection takes a huge hit on performance. So I had to have it loop through every voxel in the scene and calculate its distance. If its close enough, then that means a collision was detected. if it detects a cube, it will not put another one over it.The problem is that collision can only be detected as a sphere meaning that it will not detect anything in the corners.

    problem_example.jpg

    I have it set to "proximity detection A". Any Ideas on how to solve that problem?
  • rubixcube6rubixcube6 Posts: 164
    Hiro Protagonist
    OOPS!! I seem to have missed a few files when I uploaded v1.1 earlier. :mrgreen: I just now fixed it so the download links should work now.
  • This is awesome dude!
    Very good job and thanks a lot for sharing :) ;)
  • g4cg4c Posts: 330
    Well done, what a lovely piece of work. Thanks for sharing!
    Android VR Developer. https://twitter.com/SiliconDroid
  • rubixcube6rubixcube6 Posts: 164
    Hiro Protagonist
    This is awesome dude!
    Very good job and thanks a lot for sharing :) ;)
    g4c wrote:
    Well done, what a lovely piece of work. Thanks for sharing!

    Thanks! :D Happy to share.
  • sanderbossanderbos Posts: 82
    Hiro Protagonist
    I only just discovered this, and just wanted to say how absolutely lovely this is!
    Thank you!!
  • Looks incredible, man. Well done.
  • rubixcube6 wrote:
    The overlapping issues stem from the way the cursor detects if there are cubes touching the cursor. ... So I had to have it loop through every voxel in the scene and calculate its distance. If its close enough, then that means a collision was detected. if it detects a cube, it will not put another one over it.The problem is that collision can only be detected as a sphere meaning that it will not detect anything in the corners.

    I have it set to "proximity detection A". Any Ideas on how to solve that problem?

    Because you're working with voxels, you can work in integer math. Instead of thinking of each voxel as a cube in 3d space, think of them as a cells on graph paper.

    Then, you can take your 3d position, chop off the floating point portion, and you'll have your cell index. You won't need to have to do any distance checks, because you're guaranteed to be constrained to that one cell.

    If your cursor is larger than a single cell, calculate the minimum and maximum positions it touches, chop off the floating point portion, and then you're left with a range of cells you need to check.

    For example, the 2D position (3.45, 6.8) with the floating point off is (3, 6). Same with (3.1, 6.2) and (3, 6.0001).
    This idea extends easily to 3D, as well.

    The entire voxel field can be stored as a big array. Voxels[width][height][depth] or Voxels[width*height*depth]. You'll have to do some math to find the index in to the 1-dimensional array, but it should be simple enough.

    There are some gotcha edge cases with this approach, but for any voxel (or pixels or tiles) setup, you'll definitely want to use this approach over a collection of independent objects.

    Hope that helps!
Sign In or Register to comment.