Comments (3)
I am intrested in contributing. But I dont know much about rendering engine in general. So cant gurantee. And cargo build is failing.
from keikan.
Hey @mustafapc19, thanks for the interest. In light of your failed cargo build, I recently cloned and rebuilt the project myself. It turns out that my most recent changes hadn't saved before commiting, so I've saved them and pushed to master - the project should be buildable now.
Computer graphics is a fun subject, and there are lots of resources to get started.
The way keikan currently works is simple: A scene is a list of objects with a camera. At render time, the camera asks each object to provide information about it. This information is used to calculate light bounces, which renders the final scene.
Currently, keikan supports two rendering techniques, ray-tracing and ray-marching. Ray-marching uses the distance to objects to calculate collisions, whereas ray-tracing uses direct intersections to calculate collisions. Currently, all objects are in the /objects
subfolder. Each object is a structure that implements at either of the Trace
or March
trait, or both.
The March
trait requires you implement a function that returns the distance to the nearest point on that object given a point in 3D space. For example, the distance to the nearest point on a sphere is given by the equation:
length(point - sphere_position) - sphere_radius
So to implement that for Keikan you just need to translate that to Rust and wrap it into a neat little function:
impl March for Sphere {
// ... snip
fn march(&self, point: Vec3) -> f64 {
(point - self.position).length() - self.radius
}
}
There are a lot of cool fractals you can make this way. If you want to see the distance functions for some more shapes, check out Inigo Quilez's website: https://iquilezles.org/www/articles/distfunctions/distfunctions.htm
Ray-tracing is a bit more involved. Given a ray, a ray tracer must determine:
- Whether the object was hit (i.e. intersects the ray)
- How far away the collision was
- And the normal of the collision (which way the face of the object was facing)
There are a lot of well-documented ray-intersection tests online, just google one for the specific shape you're trying to implement. If you need any help getting started, feel free to reach out. Thanks again for the interest.
from keikan.
Thanx. I will look into it. But this a new thing for me and I dont know if I have time to actually contribute. But If I can I surely will.
from keikan.
Related Issues (7)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from keikan.