Jump to content

DD_VOXEL 1.7 (DelphiDoom's Voxel Editor) (Updated Jan 1, 2021)


jval

Recommended Posts

DD_VOXEL is a tool for creating voxels.

Voxels created by DD_VOXEL can be used by DelphiDoom or any source port that can read slab6 VOX files.

 

Downloads:

 

Latest version:

version 1.7: https://sourceforge.net/projects/delphidoom-voxel-editor/files/DD_VOXEL_1.7/

 

Examples: https://sourceforge.net/projects/delphidoom-voxel-editor/files/Examples/

 

Older versions:

version 1.6.6: https://sourceforge.net/projects/delphidoom-voxel-editor/files/DD_VOXEL_1.6.6/
version 1.6.5: https://sourceforge.net/projects/delphidoom-voxel-editor/files/DD_VOXEL_1.6.5/
version 1.6.4: https://sourceforge.net/projects/delphidoom-voxel-editor/files/DD_VOXEL_1.6.4/
version 1.6.3: https://sourceforge.net/projects/delphidoom-voxel-editor/files/DD_VOXEL_1.6.3/
version 1.6.2: https://sourceforge.net/projects/delphidoom-voxel-editor/files/DD_VOXEL_1.6.2/

version 1.6.1: https://sourceforge.net/projects/delphidoom-voxel-editor/files/DD_VOXEL_1.6.1/

version 1.5.2: https://sourceforge.net/projects/delphidoom-voxel-editor/files/DD_VOXEL_1.5.2/

version 1.5.1: https://sourceforge.net/projects/delphidoom-voxel-editor/files/DD_VOXEL_1.5.1/

version 1.3.1: https://sourceforge.net/projects/delphidoom-voxel-editor/files/DD_VOXEL_1.3.1/


 

Features

  • Simple editing (like a paint program)
  • Imports *.KVX voxels & slab6 *.VOX files
  • Exports *.DDMESH voxels (optimized mesh for DelphiDoom's OpenGL renderer), slab6 *.VOX files
  • Heighmap and terrain importing
  • Copy/Paste front, back, left, right, top and down views
  • Optimized OpenGL rendering
  • Sprite export (8, 16 or 32 angles)

  • Advanced scripting (PascalScript)


Screenshots: (using the Voxel Vehicles Pack 1.0)

 

image.png.cd53f369b9ab1da37cdf8ee9591ea80e.png

 

image.png.2fc14c8ec0c33af9a033b1dac822852b.png

 

image.png.23d502535246cdea04b318bbf5100479.png

 

Screenshot with Height map and terrain example:

 

image.png.a22c1a86581c1e46d96d1e866f928ec0.png

 

 

Edited by jval
Add new version download link

Share this post


Link to post
  • 3 months later...

Version 1.5.1 is available https://sourceforge.net/projects/delphidoom-voxel-editor/files/DD_VOXEL_1.5.1/

 

This version adds the option to create sprites from voxels:

  • Sprites are exported as PNG images inside PK3 files. You must use an external tool (like SLADE) to rename the PNG images or convert them to the Doom patch format.
  • Sprite export can have 8 or 16 angles.
  • Sprites are generated using isometric projection.

 

Screenshots demonstrating an example of generating 16 angle sprites:

 

Image1.jpg.aa9f3905f8dc9d2581bf49cde03e261c.jpg

 

Image2.jpg.603df6583b14292e994377958ad1d502.jpg

 

Image3.jpg.1b2f3716b68f014d8121d92bedb7151f.jpg

 

Edited by jval
Update lost images

Share this post


Link to post

Thats pretty cool. I could probably make a low res version of solace dreams now using sprites instead of voxels. Goodjob!

Share this post


Link to post

So , I don't use DelphiDoom so the format that this program exports his voxels isn't useful to me , but goddamn ! The interface is so nice ! I actually can understand how to make a voxel here , not like VoxelShop or MagicaVoxel , so again. The interface is really good , and exporting to sprites with angles looks very useful as well . 

Share this post


Link to post
  • 7 months later...

Version 1.5.2 is available.

 

Download link:https://sourceforge.net/projects/delphidoom-voxel-editor/files/DD_VOXEL_1.5.2/

 

New features:

  • Option to save sprites in 32 angles.
  • Sprite export dialog with many options.
  • Small fixes

Screenshots:

 

The new sprite export dialog:

image.png.33dbf05ef0e9218f47a593e4cded06da.png

 

Sprite with 32 angles export example:

Animation.gif.c059a244d00271b8dd4db8d4efdd3f59.gif

 

The WAD file with the above example can be downloaded here. (requires DelphiDoom version 2.0.4 built 715 or higher)

 

Share this post


Link to post

@jval: I'll be checking out your source in detail, but I wanted to ask: In just a few words, how do you render your voxels? Simple z-buffer, or do you do some special culling preprocessing/post-processing? I've been wanting to do some fullscreen voxel stuff for a long time now (which seems like I'll need a very smart hidden-surface algo), so I'm just curious how you do it.

Share this post


Link to post
6 hours ago, kb1 said:

@jval: I'll be checking out your source in detail, but I wanted to ask: In just a few words, how do you render your voxels? Simple z-buffer, or do you do some special culling preprocessing/post-processing? I've been wanting to do some fullscreen voxel stuff for a long time now (which seems like I'll need a very smart hidden-surface algo), so I'm just curious how you do it. 

 

DD_VOXEL uses OpenGL rendering for voxel preview (the right part of the main screen with the 3D preview). In early version the rendering was crude and slow, but in latest versions it generates an optimized mesh from voxel data and saves it to a compiled list. Then it calls the list, binding a procedural generated 512x512 texture, (gld_InitVoxelTexture in vxe_gl.pas) with 262144 distinct colors.  I've developed that method when I was implementing voxels to DelphiDoom (version 1.1.5 build 580). So, in OpenGL the rendering is actual polygon based.

The ddmesh export format (File/Export/Optimized mesh) contains the precalculated mesh information, so DelphiDoom do not have to generate it at runtime/loadtime.

For sprite export it uses purely software calculations with z-buffer.

DelphiDoom in sortware rendering, renders the voxels as sprites, using a "colorcolfunc". i.e. voxel=collection of vertical columns, vertical column=collection of color fractions.

In all rendering scenarios non visible voxel pixels are eliminated before the actual rendering. This procedure can be done on demand using the Voxel/Remove non visible voxels command of the menu.

Share this post


Link to post

Thanks - that explains it perfectly. I want to try my hand at rendering fly-through 3D fractals using voxels, which is something that has fascinated me ever since seeing a Mandelbrot.

Share this post


Link to post

This editor looks actually quite amazing. Could this be used to add 16 rotations to Doom's original sprites? They'd have to be recreated in the voxel editor first and then adding some depth, right?

Share this post


Link to post
1 hour ago, elend said:

This editor looks actually quite amazing. Could this be used to add 16 rotations to Doom's original sprites? They'd have to be recreated in the voxel editor first and then adding some depth, right?

 

I think a problem one would face with that would be that the sprites are already perspective-warped, so it's not just a matter of direct translation. Zombies and imps might be doable, but the arch-vile and spider mastermind would probably be nightmares with their spindliness. Significant redrawing/adjustment would be necessary, in '3d' and for each frame.

 

disclaimer: I haven't touched voxels or this editor, but I think the point stands.  It would be really amazing, though.

 

..Someone really ought to arrange for the digitization of what's left of the original sculptures.

Edited by Reiken

Share this post


Link to post
9 hours ago, elend said:

This editor looks actually quite amazing. Could this be used to add 16 rotations to Doom's original sprites? They'd have to be recreated in the voxel editor first and then adding some depth, right?

 

I've checked some time ago an algorithm (link here) which describes the creation of voxel volume using depth information from different views of an object. Doom sprites do not have depth info, but I was thinking of using the +/- 90 degrees  angle to create it. Also Doom sprites do not have up/down view/info. Unfortunately never came even close to implement this method (not even tried). The only thing left from this, is just a note in my TO-DO list.

Share this post


Link to post
On 10/4/2018 at 9:50 AM, jval said:

 

I've checked some time ago an algorithm (link here) which describes the creation of voxel volume using depth information from different views of an object. Doom sprites do not have depth info, but I was thinking of using the +/- 90 degrees  angle to create it. Also Doom sprites do not have up/down view/info. Unfortunately never came even close to implement this method (not even tried). The only thing left from this, is just a note in my TO-DO list.

EDIT: I thought I submitted this a day ago - guess not. Anyway, here goes:

That's funny - that *very same thing* is on my to-do list (seriously). The trick is to map pixel for pixel on the rotations, and interpolate. The up/down view will partially appear with this method. This will get you 80-90% there, and an artistic hand get you the rest.

 

A lot of work, but in the end, you get identical original 8-angle views, with the inbetweens for free, theoretically :)

Share this post


Link to post

That is a very exciting prospect! I don't want to tell you what to do, but you should definitely look into this. :p

Share this post


Link to post
2 hours ago, elend said:

That is a very exciting prospect! I don't want to tell you what to do, but you should definitely look into this. :p

Go ahead and tell me - I need encouragement. If someone long ago told me that it was possible to become depressed by having too much work to do, I wouldn't have believed them. Now, I'm not so sure...

 

I will look into it.

 

Share this post


Link to post
  • 1 month later...

Version 1.6.1 is available.

 

What's new

  • Create or modify voxels with advanced scripting (thanks to Remobject's PascalScript).
  • Create auxiliary voxel buffers at start-up to avoid repetitive memory allocation and de-allocation.
  • Paint-Editing preview changed to be more "eye-friendly". The borders of the rectangle that represents a voxel/pixel, are not black anymore. Instead we use a color similar to the color of the voxel itself.
  • OpenGL rendering clean-up and fixes.

 

Downloads

 

Screenshots

 

animals.jpg.4a4f08ca2678daaa73ef53fc9bdff21f.jpg

 

 

lavarock1.jpg.a77ad61477c4f504783f4f79d5694536.jpg

Share this post


Link to post
  • 10 months later...

Version 1.6.3 is available.

 

What's new

  • slab6 *.VOX files support. Both importing and exporting.
  • Convert voxel to Doom, Heretic, Hexen or Strife palette.
  • Change working palette.
  • Quantize voxel pixels to 256 color palette.
  • Batch convertion of ddvox files to slab6 *.VOX files.
  • Lowest CPU utilization when idle.
  • Fixes to mouse control movement.
  • Fixed export sprite in PK3/ZIP file, it generated WAD file instead.
  • Speed optimizations in export sprite using multiple CPU cores.

 

Downloads

Windows Executable and source code: https://sourceforge.net/projects/delphidoom-voxel-editor/files/DD_VOXEL_1.6.3/

 

Screenshots

 

quantize-image.png

Share this post


Link to post
  • 5 months later...

Version 1.6.4 is available.

 

What's new

  • Key sortcuts for changing the editing level:

          - [F]: Front view

          - [ B]: Back view

          - [L]: Left view

          - [R]: Right view

          - [T]: Top view

          - [D]: Down view

          - [X]: X axis

          - [Y]: Y axis

          - [Z]: Z axis

          - [+]: Increase editing level (next level)

          - [-]: Decrease editing level (previous level)

  • Added the View menu, with all the above commands.

 

Downloads

Windows Executable and source code: https://sourceforge.net/projects/delphidoom-voxel-editor/files/DD_VOXEL_1.6.4/

 

Screenshot of the new menu:

v164.png

 

Edited by jval

Share this post


Link to post

A completely undervalued editor this is. Anyone that wants to mess with Doom and voxels should have this in their posession.

Share this post


Link to post
  • 8 months later...

Version 1.6.6 is available.

 

What's new:

  • Eliminated flickering in main form when painting.
  • Support for RAD/RADIX palette.
  • Corrected import heightmap, the elevation and texture images are now flipped correctly.

Download (win32): https://sourceforge.net/projects/delphidoom-voxel-editor/files/DD_VOXEL_1.6.6/DD_VOXEL_1.6.6_bin.zip/download

Source code: https://sourceforge.net/projects/delphidoom-voxel-editor/files/DD_VOXEL_1.6.6/DD_VOXEL_1.6.6_src.zip/download

Repository: https://github.com/jval1972/DD_VOXEL

 

Share this post


Link to post

Glad to see you are still working over this tool! Is there a way to make 3-dimensional selection,and then copy/paste it? for example Ineed a parallelepiped X1 = 12, X2 = 52, Y1= 3,Y2= 8, Z1 = 0, Z2 =16 to copy it into another place on the model. Is there a way to do it now? If not - here is an idea for your future developments) Happy Ney Year to You, Jval, and your great projects!

Share this post


Link to post
13 hours ago, GRAU said:

Glad to see you are still working over this tool! Is there a way to make 3-dimensional selection,and then copy/paste it? for example Ineed a parallelepiped X1 = 12, X2 = 52, Y1= 3,Y2= 8, Z1 = 0, Z2 =16 to copy it into another place on the model. Is there a way to do it now? If not - here is an idea for your future developments) Happy Ney Year to You, Jval, and your great projects!

 

Happy New Year!

 

That can be done using scripting.

Open the script editor by pressing the toolbar button:

image.png.ce2fdfb82fc022958893d8a37534c517.png

 

The editor will appear. Delete all the sample code.

Copy the following script to the editor.

Change the destX := 64;   destY := 64;  & destZ := 64; with the position you want to copy the buffer.

Run the script by pressing the Compile & run button:

image.png.c68f1d6b25ff68bfa70ae7f34981b954.png

 

And that's the script:

voxel voxel1;

var
  x1, x2, y1, y2, z1, z2: integer;
  destX, destY, destZ: integer;
  x, y, z: integer;
begin
// Set the source dimentions 
  X1 := 12; 
  X2 := 52;
  Y1 := 3;
  Y2 := 8;
  Z1 := 0;
  Z2 := 16;
  
// Set the destination   
  destX := 64;
  destY := 64;
  destZ := 64;
  
  for x := x1 to x2 do
    for y := y1 to y2 do
      for z := z1 to z2 do
        if voxelbuffer[x, y, z] <> 0 then
          voxelbuffer[x + destX - x1, y + destY - Y1, z + destZ - Z1] := voxelbuffer[x, y, z];
end.

 

Also @GRAU you gave me a very nice idea, thank you for that!!!!

Remobject's PascalScript that "powers" DD_VOXEL (and DelphiDoom) scripting has support for Forms. Of course the forms was left outside DelphiDoom since it's meaningless to have a popup dialog while Dooming :P, but I can't find any reason DD_VOXEL not to support this feature. So, wouldn't be nicer, instead of tampering with the code to change e.g. the source and destination parameters of the above script, to open a user-friendly dialog (created by the script) and enter the values? Or even distribute scripts that actually act like plug-ins?  Let's say you request a feature to apply a blur filter all over the voxel: No problem, here is the script, you don't need a new version!! It's not even hard for me to implement this feature, probably I can finish this within the day :) :)

 

Spoiler

Actually, it's working, just hold my beer to make some tests, and get prepared for a new version update :) :)

 

preview1.png

 

 

 

 

 

Edited by jval
Grammar

Share this post


Link to post

Here it is, version 1.7!

 

Donwloads:

Executable: https://sourceforge.net/projects/delphidoom-voxel-editor/files/DD_VOXEL_1.7/DD_VOXEL_1.7_bin.zip/download

Source code: https://sourceforge.net/projects/delphidoom-voxel-editor/files/DD_VOXEL_1.7/DD_VOXEL_1.7_src.zip/download

 

New Features:

  • Support for creating interactive Forms within the script.
  • Create compiled macros.
  • Macro menu, with previously executed macros.

Fixes/Corrections:

  • Corrected shortcut behavior when the script editor was running.
  • Script editor toolbar icons display also text.
  • When saving scripts from editor and the file already exists, prompt to overwrite.
  • When executing script, saving undo is performed only when we change the voxel.
  • If script (and macros) don't touch the voxel buffer we do not update the modified flag.

Macros

Of course the highlight of this release is the ability to create interactive forms with the script, and optionally save them in a binary (compiled) form (macros).

This new feature can expand the Editor without the need of a new release. The new macros Menu holds the latest macros run by the user and it serves as a plug-in/expandable menu.

The macros can be either in source code form, or even in a compiled form (e.g. if you want to distribute a macro but you want to keep you source code closed, or you want to avoid accidentally and unwanted editing of the source code).

Please note: There is no way to de-compile a compiled script/macro to it's original form. Keep your source code safe! Don't delete it!

 

The new menu and toolbar button to run a macro:

image.png.cebfce7ec01713ba4065b555201e9d0c.png

 

Creating Macros - Examples

To create a macro simply open the script Editor:

image.png.4d13dafa9ed3ffa2d925ca60a2d8bc70.png

 

Use the:

  • Compile button to check the script for syntax errors.
  • Run button to run the macro with-in the editor
  • Macro button to save the macro in a pre-compiled binary form and use it from the main application menu, without the need to open the editor

Example #1 - Copy3d Buffer https://sourceforge.net/projects/delphidoom-voxel-editor/files/Examples/EXAMPLE01_Copy3DBuffer.zip/download

This macro copies a portion of the voxel to a new location.

 

Copy3-DBuffer.png

 

The script of the macro:

Spoiler

// DD_VOXEL 1.7 
// Copy portion of the voxelbuffer to another location
voxel copy3dbuffer;

function GetInput(var x1, x2, y1, y2, z1, z2: integer; var destx, desty, destz: integer): boolean;
var                
  f: TForm;
  Memo: TMemo;
  labelsrc, labeldest: TLabel;
  labelX1, labelX2, labelY1, labelY2, labelZ1, labelZ2: TLabel;
  editX1, editX2, editY1, editY2, editZ1, editZ2: TEdit;
  labelX, labelY, labelZ: TLabel;
  EditX, EditY, EditZ: TEdit;
  buttonOk, buttonCancel: TButton;  
begin
  f := TForm.Create(self);
  f.Width := 360;
  f.Height := 300;
  f.BorderStyle := bsDialog;
  f.BorderIcons := [biSystemMenu];
  f.Caption := 'Enter parameters to copy voxel buffer';
  f.Position := poMainFormCenter;
  
  // Welcome memo
  Memo := TMemo.Create(f);
  Memo.Left := 10;
  Memo.Width := 375; 
  Memo.Top := 10;
  Memo.Height := 45;
  Memo.Text := 'copy3dbuffer'#13#10'Copy portion of the voxel to another location';
  Memo.Color := RGB(255, 255, 192);
  Memo.Parent := f;
  Memo.Readonly := True;
  
  // labelsrc
  labelsrc := TLabel.Create(f);
  labelsrc.Left := 10;
  labelsrc.Top := 70;
  labelsrc.Caption := 'Source dimensions: ';
  labelsrc.Parent := f;

  // X1 Input
  labelX1 := TLabel.Create(f);
  labelX1.Left := 10;
  labelX1.Top := 90;
  labelX1.Caption := 'X1: ';
  labelX1.Parent := f;
  
  editX1 := TEdit.Create(f);
  editX1.SetBounds(40, 90, 64, 15); 
  editX1.Parent := f;
  editX1.Text := IntToStr(x1);
  
  // X2 Input
  labelX2 := TLabel.Create(f);
  labelX2.Left := 120;
  labelX2.Top := 90;
  labelX2.Caption := 'X2: ';
  labelX2.Parent := f;
  
  editX2 := TEdit.Create(f);
  editX2.SetBounds(150, 90, 64, 15); 
  editX2.Parent := f;
  editX2.Text := IntToStr(x2);
  
  // Y1 Input
  labelY1 := TLabel.Create(f);
  labelY1.Left := 10;
  labelY1.Top := 110;
  labelY1.Caption := 'Y1: ';
  labelY1.Parent := f;
  
  editY1 := TEdit.Create(f);
  editY1.SetBounds(40, 110, 64, 15); 
  editY1.Parent := f;
  editY1.Text := IntToStr(y1);
  
  // Y2 Input
  labelY2 := TLabel.Create(f);
  labelY2.Left := 120;
  labelY2.Top := 110;
  labelY2.Caption := 'Y2: ';
  labelY2.Parent := f;
  
  editY2 := TEdit.Create(f);
  editY2.SetBounds(150, 110, 64, 15); 
  editY2.Parent := f;
  editY2.Text := IntToStr(y2);

  // Z1 Input
  labelZ1 := TLabel.Create(f);
  labelZ1.Left := 10;
  labelZ1.Top := 130;
  labelZ1.Caption := 'Z1: ';
  labelZ1.Parent := f;
  
  editZ1 := TEdit.Create(f);
  editZ1.SetBounds(40, 130, 64, 15); 
  editZ1.Parent := f;
  editZ1.Text := IntToStr(z1);
  
  // Z2 Input
  labelZ2 := TLabel.Create(f);
  labelZ2.Left := 120;
  labelZ2.Top := 130;
  labelZ2.Caption := 'Z2: ';
  labelZ2.Parent := f;
  
  editZ2 := TEdit.Create(f);
  editZ2.SetBounds(150, 130, 64, 15); 
  editZ2.Parent := f;
  editZ2.Text := IntToStr(z2);

  // labeldest
  labeldest := TLabel.Create(f);
  labeldest.Left := 10;
  labeldest.Top := 160;
  labeldest.Caption := 'Destination position: ';
  labeldest.Parent := f;

  // X Destination
  labelX := TLabel.Create(f);
  labelX.Left := 10;
  labelX.Top := 180;
  labelX.Caption := 'X: ';
  labelX.Parent := f;
  
  editX := TEdit.Create(f);
  editX.SetBounds(40, 180, 64, 15); 
  editX.Parent := f;
  editX.Text := IntToStr(destx);

  // Y Destination
  labelY := TLabel.Create(f);
  labelY.Left := 120;
  labelY.Top := 180;
  labelY.Caption := 'Y: ';
  labelY.Parent := f;
  
  editY := TEdit.Create(f);
  editY.SetBounds(150, 180, 64, 15); 
  editY.Parent := f;
  editY.Text := IntToStr(desty);
  
  // Z Destination
  labelZ := TLabel.Create(f);
  labelZ.Left := 230;
  labelZ.Top := 180;
  labelZ.Caption := 'Z: ';
  labelZ.Parent := f;
  
  editZ := TEdit.Create(f);
  editZ.SetBounds(260, 180, 64, 15); 
  editZ.Parent := f;
  editZ.Text := IntToStr(destz);

  // OK Button
  buttonOk := TButton.Create(f);
  buttonOk.SetBounds(80, 220, 80, 25);
  buttonOk.Caption := '&OK';
  buttonOk.ModalResult := mrOK;
  buttonOk.Default := True;
  buttonOk.Parent := f;

  // Calcel Button
  buttonCancel := TButton.Create(f);
  buttonCancel.SetBounds(200, 220, 80, 25);
  buttonCancel.Caption := '&Cancel';
  buttonCancel.ModalResult := mrCancel;
  buttonCancel.Cancel := True;
  buttonCancel.Parent := f;
  
  f.ShowModal;
  if f.ModalResult = mrOK then
  begin
    Result := True;
    x1 := StrToIntDef(editX1.Text, x1);
    x2 := StrToIntDef(editX2.Text, x2);
    y1 := StrToIntDef(editY1.Text, y1);
    y2 := StrToIntDef(editY2.Text, y2);
    z1 := StrToIntDef(editZ1.Text, z1);
    z2 := StrToIntDef(editZ2.Text, z2);
    destx := StrToIntDef(editX.Text, destx);
    desty := StrToIntDef(editY.Text, desty);
    destz := StrToIntDef(editZ.Text, destz);
  end
  else
    Result := False;
    
  // Free Up memory
  Memo.Free;
  labelsrc.Free;
  editX1.Free;
  labelX1.Free;
  editX2.Free;
  labelX2.Free;
  editY1.Free;
  labelY1.Free;
  editY2.Free;
  labelY2.Free;
  editZ1.Free;
  labelZ1.Free;
  editZ2.Free;
  labelZ2.Free;
  labeldest.Free;
  editX.Free;
  labelX.Free;
  editY.Free;
  labelY.Free;
  editZ.Free;
  labelZ.Free;
  buttonOk.Free;
  buttonCancel.Free;
  f.Free;
end;

var 
  X1, X2, Y1, Y2, Z1, Z2, destx, desty, destz: integer;
  x, y, z: integer;
begin
// Set the source dimentions 
  X1 := 0; 
  X2 := voxelsize div 2;
  Y1 := 0;
  Y2 := voxelsize div 2;
  Z1 := 0;
  Z2 := voxelsize div 2;
  
// Set the destination   
  destX := voxelsize div 2;
  destY := voxelsize div 2;
  destZ := voxelsize div 2;
  
  if GetInput(X1, X2, Y1, Y2, Z1, Z2, destx, desty, destz) then
    for x := x1 to x2 do
      for y := y1 to y2 do
        for z := z1 to z2 do
          if voxelbuffer[x, y, z] <> 0 then
            voxelbuffer[x + destX - x1, y + destY - Y1, z + destZ - Z1] := voxelbuffer[x, y, z];
end.

 

 

Example #2 Solid Sphere  https://sourceforge.net/projects/delphidoom-voxel-editor/files/Examples/EXAMPLE02_SolidSphere.zip/download

 

Creates a solid sphere depending on input parameters. The archive contains the macro in binary compiled form and also the source code:

 

Solid-Sphere.png

 

The script of the macro:

Spoiler

// DD_VOXEL 1.7 
// Create a solid shpere
voxel solidsphere;

var
  gcolor: LongWord;
  panelC: TPanel;
  
procedure OnPanelChooseColor(Sender: TObject);
var
  CDialog: TColorDialog;
begin
  CDialog := TColorDialog.Create(self);
  if CDialog.Execute then
  begin
    gcolor := CDialog.Color;
    panelC.Color := gcolor;
  end;
  CDialog.Free;  
end;

function GetInput(var x, y, z: integer; var r: integer; var color: LongWord): boolean;
var                
  f: TForm;
  Memo: TMemo;
  labelcenter: TLabel;
  labelX, labelY, labelZ: TLabel;
  editX, editY, editZ: TEdit;
  labelR: TLabel;
  EditR: TEdit;
  labelC: TLabel;
  buttonOk, buttonCancel: TButton;  
begin
  f := TForm.Create(self);
  f.Width := 360;
  f.Height := 300;
  f.BorderStyle := bsDialog;
  f.BorderIcons := [biSystemMenu];
  f.Caption := 'Enter parameters to create the sphere';
  f.Position := poMainFormCenter;
  
  // Welcome memo
  Memo := TMemo.Create(f);
  Memo.Left := 10;
  Memo.Width := 375; 
  Memo.Top := 10;
  Memo.Height := 45;
  Memo.Text := 'solidsphere'#13#10'Create a solid sphere';
  Memo.Color := RGB(255, 255, 192);
  Memo.Parent := f;
  Memo.Readonly := True;
  
  // labelcenter
  labelcenter := TLabel.Create(f);
  labelcenter.Left := 10;
  labelcenter.Top := 70;
  labelcenter.Caption := 'Sphere center: ';
  labelcenter.Parent := f;

  // X Input
  labelX := TLabel.Create(f);
  labelX.Left := 10;
  labelX.Top := 90;
  labelX.Caption := 'X: ';
  labelX.Parent := f;
  
  editX := TEdit.Create(f);
  editX.SetBounds(60, 90, 64, 15); 
  editX.Parent := f;
  editX.Text := IntToStr(x);
  
  // Y Input
  labelY := TLabel.Create(f);
  labelY.Left := 10;
  labelY.Top := 110;
  labelY.Caption := 'Y: ';
  labelY.Parent := f;
  
  editY := TEdit.Create(f);
  editY.SetBounds(60, 110, 64, 15); 
  editY.Parent := f;
  editY.Text := IntToStr(y);
  
  // Z Input
  labelZ := TLabel.Create(f);
  labelZ.Left := 10;
  labelZ.Top := 130;
  labelZ.Caption := 'Z: ';
  labelZ.Parent := f;
  
  editZ := TEdit.Create(f);
  editZ.SetBounds(60, 130, 64, 15); 
  editZ.Parent := f;
  editZ.Text := IntToStr(z);
  
  // Radius
  labelR := TLabel.Create(f);
  labelR.Left := 10;
  labelR.Top := 180;
  labelR.Caption := 'Radius: ';
  labelR.Parent := f;
  
  editR := TEdit.Create(f);
  editR.SetBounds(60, 180, 64, 15); 
  editR.Parent := f;
  editR.Text := IntToStr(r);

  // Color
  labelC := TLabel.Create(f);
  labelC.Left := 140;
  labelC.Top := 180;
  labelC.Caption := 'Color: ';
  labelC.Parent := f;
  
  PanelC := TPanel.Create(f);
  PanelC.SetBounds(175, 180, 64, 20); 
  PanelC.Parent := f;
  PanelC.Caption := ' ';
  PanelC.Color := color;
  PanelC.Cursor := crHandPoint
  PanelC.OnClick := @OnPanelChooseColor;
  gcolor := color; 
  
  // OK Button
  buttonOk := TButton.Create(f);
  buttonOk.SetBounds(80, 220, 80, 25);
  buttonOk.Caption := '&OK';
  buttonOk.ModalResult := mrOK;
  buttonOk.Default := True;
  buttonOk.Parent := f;

  // Calcel Button
  buttonCancel := TButton.Create(f);
  buttonCancel.SetBounds(200, 220, 80, 25);
  buttonCancel.Caption := '&Cancel';
  buttonCancel.ModalResult := mrCancel;
  buttonCancel.Cancel := True;
  buttonCancel.Parent := f;
  
  f.ShowModal;
  if f.ModalResult = mrOK then
  begin
    Result := True;
    x := StrToIntDef(editX.Text, x);
    y := StrToIntDef(editY.Text, y);
    z := StrToIntDef(editZ.Text, z);
    r := StrToIntDef(editR.Text, r);
    color := gcolor;
  end
  else
    Result := False;
    
  // Free Up memory
  Memo.Free;
  labelcenter.Free;
  editX.Free;
  labelX.Free;
  editY.Free;
  labelY.Free;
  editZ.Free;
  labelZ.Free;
  editR.Free;
  labelR.Free;
  labelC.Free;
  PanelC.Free;
  buttonOk.Free;
  buttonCancel.Free;
  f.Free;
end;

var 
  X, Y, Z, R: integer;
  C: LongWord;
  ix, iy, iz: integer;
  dist, maxdist: integer;
begin
// Set default values 
  X := voxelsize div 2;
  Y := voxelsize div 2;
  Z := voxelsize div 2;
  R := voxelsize div 2;
  C := RGB(255, 255, 255);
  
  maxdist := R * R; // Maximum distance from sphere center 
  if GetInput(X, Y, Z, R, C) then
    for ix := X - R to X + R do
      for iy := Y - R to Y + R do
        for iz := Z - R to Z + R do
        begin
          dist := (ix - X) * (ix - X) + (iy - Y) * (iy - Y) + (iz - Z) * (iz - Z);
          if dist <= maxdist then
            voxelbuffer[ix, iy, iz] := C;
        end;
end.

 

 

 

Screenshots:

Spoiler

The editor's new layout:

editor.png

 

Running a macro:

runmacro.png

 

Share this post


Link to post

Well, man, you are great, really! Looks like i understand - i can make my own tools via macros?

Share this post


Link to post

Share this post


Link to post

That fact that your profile picture is spinning at a different speed then the voxels is bothering me other then that they look pretty cool

Share this post


Link to post

Could it be possible to set a what resolution sprites are imported ? The maximum export resolution seems to only be 64x64 which is far too small for anything besides small to medium sized decorations and sprites such as sprites of human sized enemies/NPCs.

 

Spoiler

XErVDJz.png

1qgyT8L.png

 

Share this post


Link to post
19 hours ago, inkoalawetrust said:

Could it be possible to set a what resolution sprites are imported ? The maximum export resolution seems to only be 64x64 which is far too small for anything besides small to medium sized decorations and sprites such as sprites of human sized enemies/NPCs.

 

 

The exported sprites are exactly the size of the voxel. 64x64 sprite output means that you have a created a 64x64x64 voxel and export this as a sprite. Also modern source ports can do sprite scaling. Maximum voxel size is 256x256x256, so the biggest sprite you can have is 256x256. If there need for voxel resizing, I can make a macro and post it here...

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...