목록computer graphics (9)
일상
코드 제출은 하였지만 비효율적이라고 생각하여 다른 분들의 블로그를 참고해서 수정을 하였다. 첫 번째 방법은 2차원 배열 두개를 선언하여 풀었고 두 번째 방법은 2차원 배열 하나만 가지고 풀었다. 일회성일 경우에는 두 번째 방법이 옳겠지만 계속해서 쓸 경우에는 첫 번째 방법이 유리할 것 이라고 생각된다. 근데 사실 다 비슷한 방법으로 풀어서 그냥 아무 방법으로 풀어도 상관 없을 것 같다. 다른 분들의 방법도 대부분 내 방법과 동일하였다. 첫 번째 제출 코드 (delete[] arr1, arr2가 빠졌다) #include #include int main() { int row, col; std::cin >> row >> col; //2차원 배열 동적 할당 int** arr1 = new int *[row]; i..

이전 포스팅에서 말했던대로 물체의 개수에 따라서 bvh의 성능이 어떻게 변하는지 확인해보겠습니다. 소스코드는 Ray Tracing: The Next Week https://raytracing.github.io/books/RayTracingTheNextWeek.html For spheres, texture coordinates are usually based on some form of longitude and latitude, _i.e._, spherical coordinates. So we compute $(\theta,\phi)$ in spherical coordinates, where $\theta$ is the angle up from the bottom pole (that is, up from ..

Ray Tracing: The Next Week https://raytracing.github.io/books/RayTracingTheNextWeek.html For spheres, texture coordinates are usually based on some form of longitude and latitude, _i.e._, spherical coordinates. So we compute $(\theta,\phi)$ in spherical coordinates, where $\theta$ is the angle up from the bottom pole (that is, up from -Y), and raytracing.github.io ray tracing을 좀 더 빠르게 해줄 수 있는 bv..

Ray Tracing: The Next Week https://raytracing.github.io/books/RayTracingTheNextWeek.html#rectanglesandlights For spheres, texture coordinates are usually based on some form of longitude and latitude, _i.e._, spherical coordinates. So we compute $(\theta,\phi)$ in spherical coordinates, where $\theta$ is the angle up from the bottom pole (that is, up from -Y), and raytracing.github.io Ray Tracing..

이전 포스팅에서 Fresnel 방정식을 이용하여 이미지를 생성해보는 것을 잠정적으로 중단한다고 했는데 사실 그때부터 뭔가.. 뭔가 더 하면 Ray Tracing in One Weekend에 있는 소스코드를 수정해서 프레넬 계수를 적용한 이미지를 생성할 수 있다는 느낌을 받았다. 다만 계속 이 주제에 매달릴 수는 없어서 잠시 중단한다고 했었는데 어제 저녁에 원래의 소스코드에서 내가 만든 Ray Tracer에 있는 코드를 가져와서 수정을 한 후에 이미지를 생성을 해 보았다. 놀랍게도 정상적으로 이미지가 생성이 되었다!! 그래서 바로 Ray Tracing in One Weekend 10.5 까지의 소스코드로 만든 이미지와 내가 추가/수정한 소스코드로 만든 이미지를 비교를 해 보았다. 참고로 Ray Tracin..

이전글에서 문제를 단순화 하기 위해 기존 코드를 참고해서 ray tracer를 만들어봤다. 이번에는 저번에 한 반사, 굴절 현상을 한번에 합치기 위해 프레넬 방정식을 이용을 할 것이다. 프레넬 방정식을 아주 간단히 말하자면 굴절과 반사를 각각 몇퍼센트로 할지 결정하는 계수를 구하는 방정식 이라고 생각하고 있다. 자세한 설명은 Introduction to Shading (Reflection, Refraction and Fresnel) (scratchapixel.com) 여기를 참고하시면 될 것 같다. (그래픽스 관련 설명!) 여튼, 이번에는 코드를 작성하기 전에 충분히 생각을 하고 작성을 하였다. 간단하게 코드를 어떻게 작성할지 글로 정리를 해봤다. 1. 반사된 Ray를 Reculsive를 이용하여 구한다..

Ray Tracing in One Weekend https://raytracing.github.io/books/RayTracingInOneWeekend.html#dielectrics/ Now we can change our main to use this: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ highlight #include "color.h" #include "vec3.h" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ raytracing.github.io 이전 포스트에서는 Ray Tra..

이전 포스팅에서 말한대로 Raytracing in Oneweekend 에서는 프레넬 방정식에 대해 다루지 않아서 직접 작성해보면 좋을 것 같아서 작성을 해 보았다. 초기 생각은 간단했다. 1. 유리공에 Ray가 hit 하면 Reflaction ray, Reflection ray 둘로 나뉘어 질 것이다. 2. Reflection ray를 계산하고(reculsive), color를 구한다. 3. Reflaction ray를 계산하고(reculsive), color를 구한다. 4. 프레넬 방정식 계수를 곱한 후 2, 3에서 구한 color에 곱해준다 생각은 참 간단했다. 그래서 그것에 대한 결과는?? 그렇다.. 망해버렸다. 참고로 중간 까만공이 원래는 유리공이었어야했다. 코드를 수정해보고 디버깅도 해보고 다 ..

컴퓨터그래픽스에 관심이 생기고 실제로 무언가를 해보고 싶은 마음이 있어서 찾아보던 중 간단하게 레이트레이싱을 공부할 수 있는 사이트를 발견하게 되었다. Ray Tracing in One Weekend https://raytracing.github.io/books/RayTracingInOneWeekend.html Now we can change our main to use this: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ highlight #include "color.h" #include "vec3.h" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~..