Preview Release of DDD

I now have DDD in a demo-able state, and you can try it out too.

What is DDD?

Cross-platform (Windows, Linux, Mac) 3D tools for PowerShell

That is an odd tagline, because PowerShell is known for automating IT tasks. It has nothing to do with computer graphics.

DDD is a PowerShell module. It adds commands to PowerShell to make working with 3D graphics easy.

For more info on what DDD is, see my kickoff post:

DDD Commands

The commands available in this release:

  • New-Point
  • New-PointArray
  • New-Vector
  • New-VectorArray
  • New-Matrix
  • New-MatrixArray
  • New-IdentityMatrix
  • New-ZeroMatrix
  • New-RotateXMatrix
  • New-RotateYMatrix
  • New-RotateZMatrix
  • New-ScaleMatrix
  • New-TranslateMatrixXYZ
  • New-TranslateMatrixVector
  • Get-CrossProduct
  • Get-DotProduct
  • Out-3d

These commands allow you to create points, vectors, and matrices. You can manipulate points and vectors by multiplying them by matrices. You can view the primitives in 3D by piping (‘|’) the output to the command ‘Out-3d.’

Simple DDD example

Here is a simple example. Create a point at 1, 1, 1 and display it in 3D.

New-Point 1 1 1 | Out-3d

In the 3D view, you can rotate with the mouse, keyboard (WASD or arrow keys), or touch gestures. Press Esc to exit.


DDD has a single requirement: PowerShell 7 or higher. In the near future, PowerShell 7 will be built into Windows 10. For now, you have to add it to your system.

NOTE: Even though DDD will work on any platform supported by PowerShell 7, I have not yet created a version of Out-3d that works on Mac or Linux. I plan on working on that next.


Once you have PowerShell 7 installed, you can copy and paste these demos into the PowerShell 7 console to run the scripts. You can modify these scripts and see what results you get. If you come up with your own creation, please share it with me via


# create a coil
Install-Module DDD -Repository PSGallery
Import-Module DDD
0..3600 | ForEach-Object {
    $deg = $_ 
    $rad = $deg*[Math]::PI/180 
    $x = [Math]::Sin($rad)*360
    $y = $deg
    $z = [Math]::Cos($rad)*360
    New-Point $x $y $z
} | Out-3d


# create a sphere
Install-Module DDD -Repository PSGallery
Import-Module DDD
$allPoints = @() # empty array
for($degY = 0; $degY -lt 360; $degY += 10) {
    for($degZ = 0; $degZ -lt 360; $degZ += 10) {
        $x = 1
        $y = 0
        $z = 0
        $pt = New-Point $x $y $z
        $rotZ = New-RotateZMatrix $degZ
        $rotY = New-RotateYMatrix $degY
        $allPoints += $rotZ * $rotY * $pt
$allPoints | Out-3d


The last demo is of a the iconic Utah teapot. This simple script is doing quite a bit…

  • Download an .obj file that represents a teapot
  • Convert the file in memory to an array of lines at the line breaks
  • Use a regular expression to find all the vertices
  • Create points using DDD’s New-Point
  • Visualize points using DDD’s Out-3d
# load a teapot in OBJ file format
Install-Module DDD -Repository PSGallery
Import-Module DDD

$url = ""
$obj = (Invoke-WebRequest $url).ToString()
$windowsLineEnding = "`r`n"
$lines = $obj -split $windowsLineEnding

# regular expression to match a vertex: "v <X_FLOAT> <Y_FLOAT> <Z_FLOAT>"
$geometricVertex = '^v'  #
$whitespace = '\s+'
$float = '[\d\.\-]+'
$restOfLine = '.*$'
# use "Named Captures" to get x, y, and z:
$vertRegex = "$geometricVertex$whitespace(?<x>$float)$whitespace(?<y>$float)$whitespace(?<z>$float)$restOfLine"

# parse .obj and output verts
$teapot = $lines | ForEach-Object {
    if ($_ -match $vertRegex) {New-Point $Matches.x $Matches.y $Matches.z}
$teapot | Out-3d

What’s Next?

I proved to myself that I could make PowerShell a great environment for quickly working with 3D graphics. Here are some of the things I plan on doing…

Source Code

The source code for building DDD is available here:


Let me know what you think. I want this to be a solid product, so if you have any problems, please let me know. Post in the comments or send me an email:

11/12/2020 Updates

  • Added “-Repository PSGallery” to Install-Module in examples. Without this, examples will fail for users that already have a default repository setup that is not PSGallery. Thanks Craig!
  • Updated PowerShell installation instructions for Windows 10 to use Microsoft Store

4 Replies to “Preview Release of DDD”

  1. Very impressive!!

    You didn’t mention in the blog about the module being available in PSGallery, but figured it out on my own.

    All of the examples work flawlessly. This definitely spikes my interest in wanting to know more about 3D graphics.

    1. Hey Craig. Thanks for the feedback. It helps me to know the examples worked for you.

      I am curious about why I need to mention PSGallery. How would that have helped you? Is it because you have multiple registered reposories? In that case, I can change the examples to use “Install-Module DDD -Repository PSGallery”

        1. Hmmm…Install-Module defaults to look in PSGallery in my testing. I tried the examples on a clean box via Windows Sandbox and I had a few friends try on their systems and it seemed to work. What happens when you try “Import-Module ddd”?

Comments are closed.