-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implementing Different Objects #2
Comments
I am intrested in contributing. But I dont know much about rendering engine in general. So cant gurantee. And cargo build is failing. |
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 The 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:
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. |
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. |
Right now, keikan supports:
This is quite a small number of objects. At the least, the following primitives should be implemented:
To implement a new object, go to
objects/
and make a new file with a data structure that implements the March and/or the Trace traits.The text was updated successfully, but these errors were encountered: