Giter Club home page Giter Club logo

render_engine's People

Contributors

choleraehyq avatar mjgalindo avatar santi-7 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

render_engine's Issues

Can't compare Matrix and TransformationMatrix

The overloaded operator == for the class Matrix cannot be used to compare a Matrix object and a TransformationMatrix object. Since TransformationMatrix extends Matrix, shouldn't this be possible?

Colors can overflow

Since color is integrated in retVal (adding new values for each light source) it can easily overflow a byte. This could be checked and fixed to the maximum value 255, but then any scene with many light sources could easily end up as a white blob.

Transparent shapes hide light sources

In the ray tracer algorithm, if a shadow ray intersects with any shape in the scene, then the light is blocked. But, what happens if that intersected shape is transparent? It shouldn't block the light, but the algorithm doesn't take it into account.

glass

image.hpp compile error

/Users/cholerae/Documents/cppcode/render_engine/src/scene/materials/simpleTexture.cpp:37:18: error:
      no viable overloaded operator[] for type 'const Image'
    return mImage[i][j];
           ~~~~~~^~
/Users/cholerae/Documents/cppcode/render_engine/include/containers/image.hpp:67:20: note:
      candidate function not viable: 'this' argument has type 'const Image', but
      method is not marked const
    vector<Color>& operator[](const unsigned int i);
                   ^
1 error generated.
$ build git:(master) clang++ --version
Apple LLVM version 9.1.0 (clang-902.0.39.1)
Target: x86_64-apple-darwin17.5.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

Plane representation can be improved

In our current implementation, a plane is representated by a point and the normal vector to the plane. A plane costs 6 floats, three for the point and other three for the normal.

A plane m can be represented with only 4 floats: the normal vector n, and the distance d from the origin, as shown in the following image.

plane

This is the normalized representation of a plane.

It might be possible to change reference vectors without inverting matrices

A rotation R ∈ SO(3) together with a translation t ∈ R^3 is called a pose. Such pose transformations are of the following form:

change pose

Let us assume we have two such reference frames a and b. The transformation Rba Xa + tba transforms a point Xa in frame a to a point Xb in reference frame b. Elements of SE(3) can be written in terms of 4 × 4 matrices:

change pose matrix

Given a transformation Tba, the inverse transformation Tab is calculated using the inverse matrix:

inverse pose

Reference: the doctoral thesis Local Accuracy and Global Consistency for Efficient Visual SLAM [Hauke Strasdat, 2012].

Float precision while tracing the ray of lights

Working with floats (with doubles will also happen), we miss an important precision. When tracing the rays, the pixels calculated are not the exact points. It may be not important, but it makes fail a specific scenario: when a light of ray should lie entirely in a plane.

For example with a default Pinhole Camera and a Plane p with mPoint(0,0,0) and mNormal(1,0,0). The light of ray that crosses the central pixel (0,0,1) should lie in the plane p. But due to this lack of precision, this ray of light has a direction vector (0.00..78, 0.00..123, 0.99..43). This makes the algorithm fail.

Intersect methods can be improved

Values used in the Intersect methods can be cached, because they don't depend on the light of ray. For example the plane where a triangle lies, and many more.

A light iluminates the back side of a plane

Suppose we have a Pinhole in (0,0,0), a Plane in (0,0,3) with normal (0,0,1) and a Point light in (0,0,6). The light illuminates the back side of a plane (seen from the camera), but with the current implementation, the light illuminates entirely the two sides of the plane.

Compare operator could be faster?

If we short-circuit the comparisons, do you think the method would be faster? When a false is found, it automatically will end. But against, we have an extra check condition for each ==.

bool operator==(const Matrix &m) const
{
    return mA == m.mA & mB == m.mB & mC == m.mC & mD == m.mD &
           mE == m.mE & mF == m.mF & mG == m.mG & mH == m.mH &
           mI == m.mI & mJ == m.mJ & mK == m.mK & mL == m.mL &
           mM == m.mM & mN == m.mN & mO == m.mO & mP == m.mP;
}

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.