Skip to content

jh1sc/PowerShell-3D-Engine

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PowerShell 3D Engine 💎

G

  • title.obj

Setup 🌋

G

  • Make sure your display setting look like this otherwise it will not work properly.

Description 📶

This 3D Ascii Graphics engine is a beast.

Drawing Polygons 🔺

It consists 2 options to render, PolyFill and PolyWireFrame, both self explanatory, PolyFill uses a method called scanline rasterization, it is very efficient, in terms of computing power. PolyWireFrame, use a line drawing technique called bresenham's line, It is slightly faster than the full filled triangle.

Polygon illuminatation 🔦

The shading used in this script, calculates the shading of an object based on its position relative to a light source using the Phong Illumination Model. The script uses the dot product of the surface normal and the vector pointing to the light source to calculate the angle between them and then uses this angle to determine the shading of the object.

Face Sorting 🔰

The script sorts faces based on their dot product with a given normal vector. The dot product is calculated using the vertex coordinates of each face, as well as the coordinates of a camera position. Specifically, the script is calculating the dot product of the normal vector of each face with the vector pointing from the camera position to the centroid of the face. The script then checks whether the dot product is less than 0 and if so, it sorts the face into a different category. This sorting method is called backface culling. Its a very scappy way to do it but it still works, and its very efficient.

Controls 🎮

  • W - rotate around x axis(+)
  • S - rotate around x axis(-)
  • A - rotate around y axis(+)
  • D - rotate around y axis(-)
  • Q - rotate around z axis(+)
  • E - rotate around z axis(-)
  • UP arrow - Translate Modely(+)
  • DOWN arrow - Translate Modely(-)
  • LEFT arrow - Translate Modelx(+)
  • RIGHt arrow - Translate Modelx(-)
  • Z - scale(+)
  • X - scale(-)
  • L - Load new Model
  • T - Toggle Render Settings

Useful Sources ✅

How to create your own simple objs 💻

  • First Create your model in 3d-Paint, make sure it is not over-complicated, remember we are working with powershell here
  • Save it as a glb file, give it any name
  • Go to this website (https://fabconvert.com/convert/glb/to/obj#google_vignette) and upload and download the obj file
  • extract it from zip, then load it to the renderer!
  • If You dont see you obj file, scale the model, its that simple!

G

  • axis.obj

About

This Repository consists of the first of its kind, a 3d renderer, written in pure PowerShell! and some cheeky obj files!

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published