GithubHelp home page GithubHelp logo

powershell-raytracing's Introduction

Raytracing in One Weekend, PowerShell edition

This project is part of Project Lemonade.

Simple path tracer written in PowerShell, based on Raytracing in One Weekend online book.

Currently, this repository can generate the following image:

Preview image

This image was created using the follwing command every commit made to the main branch:

Import-Module .\Sources\PSRaytracing.psm1
Invoke-Raytracing `
  -ImageWidth 640 `
  -ImageHeight 360 `
  -OutputFile "output.png"

Why PowerShell of all things

Read this explanation from Project Lemonade website.

How to run

First, clone and enter this repository.

git clone https://github.com/RangHo/powershell-raytracing
cd powershell-raytracing

Enter PowerShell, and import the PSRaytracing module available in Sources/ directory.

Import-Module .\Sources\PSRaytracing.psm1

This module provides Invoke-Raytracing cmdlet that renders a scene. Provide -ImageWidth and -ImageHeight to set the output image's width and height.

Invoke-Raytracing -ImageWidth 160 -ImageHeight 90

Since all vector arithmetic is implemented in PowerShell, the rendering process is extremely slow. Currently there is no plan to accelerate individual calculations via .NET Numerics library. Speed is not part of the goal of this project, but it may be implemented in the future, after the base implementation is complete.

powershell-raytracing's People

Contributors

rangho avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

powershell-raytracing's Issues

`System.Drawing` assembly is not supported on non-Windows platforms

Starting from .NET 6, System.Drawing assembly that this script depends on no longer supports platforms other than Windows. In .NET 7, the compile-time switch that allows System.Drawing.Common package to be used is removed. See this link for more info.

Since this raytracer depends on System.Drawing for PNG output, we need to address this issue. There are two possibilities:

  1. Introduce third-party image processing libraries, such as SkiaSharp;
  2. Revert back to PPM output just like the OG Raytracing Book does.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.