Coder Social home page Coder Social logo

keikan's People

Contributors

manugildev avatar slightknack avatar tloru avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

keikan's Issues

Librarification of keikan

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).

Implementing Different Objects

Right now, keikan supports:

  • Planes
  • Spheres
  • and Mandelulbs (a fractal).

This is quite a small number of objects. At the least, the following primitives should be implemented:

  • Triangles
  • Rectangular Prisms
  • Cones

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.

Update Rendering Code to be PBR Compliant.

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.

Parallel Rendering

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.

Lens blur and depth of field

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.

Texturing Objects

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.

File support

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.