slightknack / keikan Goto Github PK
View Code? Open in Web Editor NEWAn elegant (imo) rendering engine written in Rust.
License: MIT License
An elegant (imo) rendering engine written in Rust.
License: MIT License
Right now, keikan is not a library. A lib.rs should be added, makescene should be moved to be a test, and the rendering code (render.rs) should be moved to more appropriate places (Like an impl on camera and scene, for instance).
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.
In the rendering code, this rather ugly line of code determines the color of the ray:
// combine the samples in a PBR manner
return (
(
( // for dielectric materials. TODO: fresnel blending
(
(transmission * material.transmission) // mix transparent
+ (diffuse * (1.0 - material.transmission)) // and diffuse
)
+ (specular * material.specular) // with a specular layer on top
// TODO: specular seems off, violating cons. of energy. review.
)
* (1.0 - material.metallic) // lerp with metal
+ ( // for metallic materials
specular * material.color
)
* material.metallic
)
* (1.0 - material.emission).max(0.0) // modified lerp with emissive
+ ( // for emissive materials
material.color * material.emission
)
);
I'll simplify it a bit:
// combine the samples in a PBR manner
// mix transparent and diffuse
let base = (transmission * material.transmission) + (diffuse * (1.0 - material.transmission));
// TODO: specular seems off, violating cons. of energy. review.
let dielectric = base + (specular * material.specular); // with a specular layer on top
let electric = specular * material.color; // for metallic materials
// lerp electric and dielectric
let non_emmisive = (electric * material.metallic) + (dielectric * (1.0 - material.metallic));
let combined = (material.color * material.emission) + (non_emmisive * (1.0 - material.emmision).max(0.0));
// final color.
return combined;
This color combination technique is naive, at best. This should be fixed to work in a PBR compliant manner. Any help is appreciated.
Right now, keikan is single threaded. This is bad, because rendering is the ultimate parallelizable operation. Using tokio, reimplement render.rs
so that is is parallelized.
Right now, keikan doesn't support depth of field. This is a fairly easy thing to do, it just requires the ray generation code to be modified in render.rs
.
Right now, objects can only take on solid colors. This is not a limitation in the render itself, it's perfectly capable of building textured objects.
To implement this feature, two things need to be done. First, traits.rs
should be refactored to include a textured
trait, and the material
function should be moved out of March
and Trace
. All objects should be required to implement the material trait.
Additionally, the material
function should be refactored to take a 3d point, so the texture can be determined.
This is a hard one, but different 3d files should be importable. Given a file object, a file parser should read, parse, and output a scene
using that file. This will probably require a Parser
trait or the like.
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.