Giter Site home page Giter Site logo

raytracer.hpp's People

Contributors

tcbrindle avatar timgates42 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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

raytracer.hpp's Issues

Not able to compile

ERROR :

/home/abhi/raytracer.hpp/raytracer.hpp:432:62:   in constexpr expansion of 'rt::cmath::pow(((float)specular), ((int)surf.rt::surface::roughness))'
/home/abhi/raytracer.hpp/raytracer.hpp:79:20:   in constexpr expansion of 'std::pow<float, int>(base, iexp)'
/usr/include/c++/7/cmath:418:17: error: 'pow(2.2191121242940426e-3, 2.5e+2)' is not a constant expression
      return pow(__type(__x), __type(__y));
             ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~

How do I fix this?

Can't compile (Clang 7)

I get the following error:

Scanning dependencies of target raytracer-ct
[ 16%] Building CXX object CMakeFiles/raytracer-ct.dir/compile_time.cpp.o
/home/v/compile/raytracer.hpp/compile_time.cpp:78:20: error: constexpr variable 'image' must be initialized by a constant expression
    constexpr auto image = [] {
                   ^       ~~~~
/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/cmath:464:12: note: subexpression not valid in a constant expression
  { return __builtin_sqrtf(__x); }
           ^
/home/v/compile/raytracer.hpp/raytracer.hpp:52:12: note: in call to 'sqrt(3.425000e+01)'
    return std::sqrt(val);
           ^
/home/v/compile/raytracer.hpp/raytracer.hpp:117:12: note: in call to 'sqrt(3.425000e+01)'
    return cmath::sqrt(dot(v, v));
           ^
/home/v/compile/raytracer.hpp/raytracer.hpp:122:27: note: in call to 'mag(look_at - pos)'
    return (real_t{1.0} / mag(v)) * v;
                          ^
/home/v/compile/raytracer.hpp/raytracer.hpp:167:23: note: in call to 'norm(look_at - pos)'
              forward{norm(look_at - pos)},
                      ^
/home/v/compile/raytracer.hpp/compile_time.cpp:33:16: note: in call to 'camera(rt::vec3{3., 2., 4.}, rt::vec3{-1., 0.5, 0.})'
    camera cam_{vec3{ 3.0, 2.0, 4.0 }, vec3{ -1.0, 0.5, 0.0 }};
               ^
/home/v/compile/raytracer.hpp/compile_time.cpp:81:18: note: in call to 'static_scene()'
        r.render(static_scene{}, c, c.width, c.height);
                 ^
/home/v/compile/raytracer.hpp/compile_time.cpp:78:28: note: in call to '&[]     {
        rt::ray_tracer r{};
        static_canvas<32, 32> c{};
        r.render((anonymous namespace)::static_scene{}, c, c.width, c.height);
        return c;
    }
->operator()()'
    constexpr auto image = [] {
                           ^
1 error generated.

Reflections do not look right in my opinion

If there are too many ray bounces, the color result is an average of the albedo and grey, which does not look right in my opinion. I tried setting reflection to the current albedo, if there were too many bounces.

Before

0 bounces

render-rt-aa-0 grey

1 bounce

render-rt-aa-1 grey

2 bounces

render-rt-aa-2 grey

3 bounces

render-rt-aa-3 grey

4 bounces

render-rt-aa-4 grey

5 bounces

render-rt-aa-5 grey

6 bounces

render-rt-aa-6 grey

7 bounces

render-rt-aa-7 grey

8 bounces

render-rt-aa-8 grey

After

0 bounces

render-rt-aa-0

1 bounce

render-rt-aa-1

2 bounces

render-rt-aa-2

3 bounces

render-rt-aa-3

4 bounces

render-rt-aa-4

5 bounces

render-rt-aa-5

6 bounces

render-rt-aa-6

7 bounces

render-rt-aa-7

8 bounces

render-rt-aa-8

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.