raytracing

Multithreading RayTracer generating artifacts with two different algorithms

穿精又带淫゛_ 提交于 2020-01-06 14:26:07
问题 I have been trying to implement multithreading with my RayTracer, but I am experimenting strange artifacts related to MT. Now I am sure that is not algorithm related, because its happening with two different approaches. Bellow is what happening with a MT algorithm where the first thread takes care of the lower half of the image and the other the top half. In first case I send the thread0 to return before doing anything, in the second case, the thread1 returns. Working as expected. Now with

Finding the roots of a large number of functions with one variable

我的梦境 提交于 2020-01-03 08:27:11
问题 I'm working with Python/numpy/scipy to write a small ray tracer. Surfaces are modelled as two-dimensional functions giving a height above a normal plane. I reduced the problem of finding the point of intersection between ray and surface to finding the root of a function with one variable. The functions are continuous and continuously differentiable. Is there a way to do this more efficiently than simply looping over all the functions, using scipy root finders (and maybe using multiple

Ray tracing a Hemisphere

和自甴很熟 提交于 2019-12-31 04:21:28
问题 I am currently working on a basic raytracing program using C, and i have managed to so some simple shapes ex, sphere/box/plane/cone/... , and i also did some shading to them using phong illumination. But my question is that i can get a hang of how i can ray trace a Hemisphere , like is there a set equation that define the Hemisphere if so enlighten me on it because i couldn't find any , or is there a set method to do it that i couldn't figure out. I have also tried to tried to cut the sphere

When are structs the answer?

血红的双手。 提交于 2019-12-29 02:44:31
问题 I'm doing a raytracer hobby project, and originally I was using structs for my Vector and Ray objects, and I thought a raytracer was the perfect situation to use them: you create millions of them, they don't live longer than a single method, they're lightweight. However, by simply changing 'struct' to 'class' on Vector and Ray, I got a very significant performance gain. What gives? They're both small (3 floats for Vector, 2 Vectors for a Ray), don't get copied around excessively. I do pass

How to compute reflected color?

纵饮孤独 提交于 2019-12-25 00:39:21
问题 I'm trying to implement a simple physically-accurate raytracer. I have it working in grayscale (so with light intensities) but I'm struggling with colors. How do I calculate relation between colored (non-white) light and the surface. Say the light color is rgb(1.0,0.9,0.8) and the surface is rgb(0.8,0.9,1.0)? 回答1: In a very basic manner Let's assume you've chosen the phong shading model or you've chosen not to do any specific shading. You need the scene's ambient coefficient (a coefficient

Ray-tracing triangles

℡╲_俬逩灬. 提交于 2019-12-24 00:55:28
问题 I am writing a raytracer in java, and I was able to get tracing of spheres working, but I believe I have something wrong with how I am tracing triangles. Here is the basic algorithm, as I understand it: First determine if the ray even intersects the plane that the triangle is on. Clip all points so they are on the same plane as the triangle (so to the xy plane, as an example). Determine if the potential intersection point falls inside or out of the triangle, based on the number of polygon

What is the best approach to compute efficiently the first intersection between a viewing ray and a set of objects?

时间秒杀一切 提交于 2019-12-23 22:11:54
问题 For instance: An approach to compute efficiently the first intersection between a viewing ray and a set of three objects: one sphere, one cone and one cylinder (other 3D primitives). 回答1: What you're looking for is a spatial partitioning scheme. There are a lot of options for dealing with this, and lots of research spent in this area as well. A good read would be Christer Ericsson's Real-Time Collision Detection. One easy approach covered in that book would be to define a grid, assign all

Help me solve this bug with my ray tracer

不羁的心 提交于 2019-12-23 21:50:25
问题 I'm not going to post any code for this question because it would require way too much context, but I shall explain conceptually what I'm doing. I'm building a simple ray tracer that uses affine transformations. What I mean is that I'm intersecting all rays from camera coordinates with generic shapes. The shapes all have associated affine transformations, and the rays are first multiplied by the inverses of these transformations before intersecting with scene objects. So for example, say I

Ray tracer artifacts with reflection

∥☆過路亽.° 提交于 2019-12-23 18:29:16
问题 So I am trying to build a retracer. I followed this tutorial:https://www.youtube.com/watch?v=SMOJGxyd9BE&list=PLHm_I0tE5kKPPWXkTTtOn8fkcwEGZNETh&index=9 So everything works great, except I ran into one problem. I was trying to make the plane under the spheres reflective, but when I did I got this strange effect If you notice there are these dark spots on the reflection on the ground. I have been trying to figure out whats going on, but its strange because the entire plane has the same normal,

Depth map from calibrated image and triangular mesh using OpenCV and Matlab

不想你离开。 提交于 2019-12-23 02:46:28
问题 I want to extract a depth map from a calibrated image and triangular mesh using OpenCV called from Matlab 2014b (using the OpenCV bindings). I am a regular user of Matlab but am new to OpenCV. I have the following inputs: im - an undistorted RGB image of the scene or - camera position vector R - rotation matrix describing camera pose points - nx3 triangular mesh vertex list representing the scene faces - mx3 triangular mesh face list EFL - image effective focal length in pixels I have written