angelo1211 / softwarerenderer Goto Github PK
View Code? Open in Web Editor NEWSoftware rendering engine with PBR. Built from scratch on C++.
License: MIT License
Software rendering engine with PBR. Built from scratch on C++.
License: MIT License
It is not clear how to build and use the software. I initially did cmake .; make; ./softwareRenderer
. Only after I did mkdir build; cd build; cmake ..; make; ./softwareRenderer
could I test the program.
I'd like to use the SoftwareRenderer to create a png image of an STL file, and I'm lacking an example of how to do this. Preferably without SDL but in pure C++ only.
Very nice work! I am curious whether you have tried this on a many-core CPU, with 32 or 64 cores? Does the performance scale well?
Hey Angel,
I saw your post on twitter and checked the project. I've been looking for candidates that I can use as experiments for ISPC, the Intel SPMD Program Compiler. I'd love to use this project, you've done a very good job with organization so I think it's a good fit. However I can't experiment with your code as it's unlicensed.
If you were to choose MIT or Apache 2.0 I'd love to experiment with ISPC implementations for certain functions.
Namely:
void SoftwareRenderer::drawTriangularMesh(Model * currentModel)
void Rasterizer::drawTriangles(Vector3f *vertices, IShader &shader, Buffer *pixelBuffer, Buffer *zBuffer)
Cheers,
Pete
I saw you produced a binary for Windows with some variation of the Mingw theme, but I was curious how the Visual Studio toolchain would fair. It looks like there are bits of syntax and constants that are not part of the C++ spec, so I inserted into geometry.h
`#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
That went OK for a while but I borked hard with:
`
C:\Repos\SoftwareRenderer\include\shader.h(286): warning C4305: 'initializing': truncation from 'double' to 'float'
C:\Repos\SoftwareRenderer\include\shader.h(304): warning C4244: 'initializing': conversion from 'double' to 'float', possible loss of data
C:\Repos\SoftwareRenderer\include\shader.h(314): warning C4244: '=': conversion from 'double' to 'float', possible loss of data
C:\Repos\SoftwareRenderer\include\shader.h(381): error C2131: expression did not evaluate to a constant
C:\Repos\SoftwareRenderer\include\shader.h(378): note: failure was caused by a read of a variable outside its lifetime
C:\Repos\SoftwareRenderer\include\shader.h(378): note: see usage of 'this'
C:\Repos\SoftwareRenderer\include\shader.h(382): error C2131: expression did not evaluate to a constant
C:\Repos\SoftwareRenderer\include\shader.h(378): note: failure was caused by a read of a variable outside its lifetime
C:\Repos\SoftwareRenderer\include\shader.h(378): note: see usage of 'this'
C:\Repos\SoftwareRenderer\include\shader.h(383): error C2131: expression did not evaluate to a constant
C:\Repos\SoftwareRenderer\include\shader.h(378): note: failure was caused by a read of a variable outside its lifetime
C:\Repos\SoftwareRenderer\include\shader.h(378): note: see usage of 'this'
C:\Repos\SoftwareRenderer\include\shader.h(386): error C2131: expression did not evaluate to a constant
C:\Repos\SoftwareRenderer\include\shader.h(378): note: failure was caused by a read of a variable outside its lifetime
C:\Repos\SoftwareRenderer\include\shader.h(378): note: see usage of 'this'
C:\Repos\SoftwareRenderer\include\shader.h(387): error C2131: expression did not evaluate to a constant
C:\Repos\SoftwareRenderer\include\shader.h(378): note: failure was caused by a read of a variable outside its lifetime
C:\Repos\SoftwareRenderer\include\shader.h(378): note: see usage of 'this'
C:\Repos\SoftwareRenderer\include\shader.h(388): error C2131: expression did not evaluate to a constant
C:\Repos\SoftwareRenderer\include\shader.h(378): note: failure was caused by a read of a variable outside its lifetime
C:\Repos\SoftwareRenderer\include\shader.h(378): note: see usage of 'this'
C:\Repos\SoftwareRenderer\include\shader.h(389): error C2131: expression did not evaluate to a constant
C:\Repos\SoftwareRenderer\include\shader.h(378): note: failure was caused by a read of a variable outside its lifetime
C:\Repos\SoftwareRenderer\include\shader.h(378): note: see usage of 'this'
C:\Repos\SoftwareRenderer\include\shader.h(390): error C2131: expression did not evaluate to a constant
C:\Repos\SoftwareRenderer\include\shader.h(378): note: failure was caused by a read of a variable outside its lifetime
C:\Repos\SoftwareRenderer\include\shader.h(378): note: see usage of 'this'
C:\Repos\SoftwareRenderer\include\shader.h(391): error C2131: expression did not evaluate to a constant
C:\Repos\SoftwareRenderer\include\shader.h(378): note: failure was caused by a read of a variable outside its lifetime
C:\Repos\SoftwareRenderer\include\shader.h(378): note: see usage of 'this'
C:\Repos\SoftwareRenderer\include\shader.h(392): error C2131: expression did not evaluate to a constant
C:\Repos\SoftwareRenderer\include\shader.h(378): note: failure was caused by a read of a variable outside its lifetime
C:\Repos\SoftwareRenderer\include\shader.h(378): note: see usage of 'this'
C:\Repos\SoftwareRenderer\include\shader.h(393): error C2131: expression did not evaluate to a constant
C:\Repos\SoftwareRenderer\include\shader.h(378): note: failure was caused by a read of a variable outside its lifetime
C:\Repos\SoftwareRenderer\include\shader.h(378): note: see usage of 'this'
C:\Repos\SoftwareRenderer\include\shader.h(399): error C3863: array type 'Vector3f [maxLights]' is not assignable
C:\Repos\SoftwareRenderer\include\shader.h(405): error C3001: 'simd': expected an OpenMP directive name
C:\Repos\SoftwareRenderer\include\shader.h(407): error C3863: array type 'Vector3f [maxLights]' is not assignable
C:\Repos\SoftwareRenderer\include\shader.h(409): error C3863: array type 'float [maxLights]' is not assignable
C:\Repos\SoftwareRenderer\include\shader.h(414): error C3863: array type 'float [maxLights]' is not assignable
C:\Repos\SoftwareRenderer\include\shader.h(415): error C3863: array type 'float [maxLights]' is not assignable
C:\Repos\SoftwareRenderer\include\shader.h(417): error C3863: array type 'Vector3f [maxLights]' is not assignable
C:\Repos\SoftwareRenderer\include\shader.h(418): error C3863: array type 'float [maxLights]' is not assignable
C:\Repos\SoftwareRenderer\include\shader.h(419): error C3863: array type 'Vector3f [maxLights]' is not assignable
C:\Repos\SoftwareRenderer\include\shader.h(422): error C3863: array type 'Vector3f [maxLights]' is not assignable
C:\Repos\SoftwareRenderer\include\shader.h(425): warning C4305: 'argument': truncation from 'double' to 'const T'
`
Unfortunately I don't know at all what happens around line 378 but here it is
` const int maxLights = numLights;
//Fresnel, normal distribution function and geometry occlusion
Vector3f F[maxLights];`
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.