GithubHelp home page GithubHelp logo

jbikker / bvh_article Goto Github PK

View Code? Open in Web Editor NEW
341.0 341.0 35.0 17.49 MB

Code accompanying the blog post on bvh construction.

License: The Unlicense

C 63.99% Batchfile 0.02% Objective-C 1.15% C++ 34.84%

bvh_article's People

Contributors

davidpl1 avatar jbikker 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

bvh_article's Issues

missing macros in win_tiny.h

Thanks for your great blog posts, I was just trying to play around with the code a bit this evening.

Immediately had troubles to get this to compile in a fresh installation of VS2022. Namely the DEFINE_ENUM_FLAG_OPERATORS from winnt.h seems missing in the win_tiny.h nowadays. Including the bigger windows.h again and commenting the tiny header works again:

#include "windows.h"
// #include "lib/win_tiny.h" // windows.h replacement for faster builds

#include "lib/win_tiny.h" // windows.h replacement for faster builds

I'm on win11 with a fairly recent sdk version: 10.0.22621.0 that I just downloaded. Thought I'll leave a quick note here before others spend hours on figuring out what was missing.

Cheers,
Thomas

ray direction calculation

Hi, I am a little confused about the way to calculate orientation calculation.
in chapter2:
https://github.com/jbikker/bvh_article/blob/89bf112b7ca8c277ac0a311119aa2e29d5ee41f1/faster.cpp#L277C1-L279C57

ray.O = float3( -1.5f, -0.2f, -2.5f );
float3 pixelPos = ray.O + p0 + (p1 - p0) * ((x + u) / (float)SCRWIDTH) + (p2 - p0) * ((y + v) / (float)SCRHEIGHT);
ray.D = normalize( pixelPos - ray.O ), ray.t = 1e30f;

Why need to add ray.O for pixelPos, and minus the ray.O to calculate ray,D. It seems the rays are emitted from (0,0,0), but the ray origin point is still ( -1.5f, -0.2f, -2.5f )

and in chapter1:
In chapter1:
https://github.com/jbikker/bvh_article/blob/89bf112b7ca8c277ac0a311119aa2e29d5ee41f1/basics.cpp#L182C1-L184C41

float3 pixelPos = p0 + (p1 - p0) * (x / (float)SCRWIDTH) + (p2 - p0) * (y / (float)SCRHEIGHT);
ray.D = normalize( pixelPos - ray.O );

there is different calculation for pixelPos (no ray.O added)

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.