bkach / haskellraytracer Goto Github PK
View Code? Open in Web Editor NEWA simple RayTracer written in haskell
License: Apache License 2.0
A simple RayTracer written in haskell
License: Apache License 2.0
Preprocessing executable 'raycaster' for raycaster-0.1.0.0...
[10 of 10] Compiling Main ( src/Main.hs, dist/build/raycaster/raycaster-tmp/Main.o )
src/Main.hs:106:21: parse error on input ‘=’
@rumblesan, I will look into this later
We're representing points and vectors in the same exact way - would it be advantageous to define them separately? Should we just have point as an alias to a vector?
On this branch i've implemented shadows. It's somewhat naive as it checks whether at each point of intersection, the ray from that point to the center of the light does not intersect with any other object.
If the ray is obstructed, the light is simply removed from the list of lights considered for lambert shading. I'm wondering if this approach has any repercussions - would we still need that light information?
And here's the code in question
This is coming from of the disks-initial branch (https://github.com/bkach/HaskellRaycaster/tree/disks-initial)
I'm having trouble trying to figure out what's wrong with my disk implementation.
I sometimes get the following results:
We have two light sources in the scene, and it looks like they are not being added together.
One important thing to note (confused me a lot).
The image is actually upside down: y is -y.
(u,v) coordinates start on the bottom left, while screen coordinates start at top left!
It seems like we have to have some arithmetic with our colors - and i'd rather have colors, points, and vectors all use the same three double representation.
How can we cast Doubles to Word8? Doubles take up Word64 amount of space - but since we know they only go from 0 - 255, casting it to an unsigned Word8 shouldn't be an issue... I just have no idea where to begin!
It's on this branch: https://github.com/bkach/HaskellRaycaster/tree/lambert-initial
Doesn't look great, and i'm wondering what the issue might be. Seems like it has something to do with the way I calculated the normals.. Figured i'd need another set of eyes though!
Will continue working on this, but figured i'd reach out and see if you had any ideas.
Spoke to a knowledgable friend of mine today, and he recommended looking at this as a good image library to use
http://hackage.haskell.org/package/JuicyPixels-3.2.7
specifically the generateImage function here
http://hackage.haskell.org/package/JuicyPixels-3.2.7/docs/Codec-Picture.html
Essentially you just give it a function Int -> Int -> Colour
, tell it the x and y widths, and it does the iteration and memory management of canvases. Much simpler and more efficient that dealing with list monads heh
It's incorrectly implemented 👍
What's the policy here? No preference, just want to know if we should have some ground rules.
We need to start splitting out the code into modules that have a public API and private methods.
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.