raytracing

Why does raytracer render spheres as ovals?

三世轮回 提交于 2019-12-06 23:52:24
问题 I've been hacking up a raytracer for the first time over the past few days. However, there are a few quirks which bother me and I don't really know how to work out. One that has been there since the beginning is the shape of spheres in the scene - when rendered, they actually look like ovals. Of course, there is perspective in the scene, but the final shape still seems odd. I have attached a sample rendering, the problem I have is especially visible on the reflective sphere in the lower left

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

我是研究僧i 提交于 2019-12-06 15:37:11
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 a native Matlab ray tracing engine to extract a depth map from these inputs, but this is quite slow

Updating OpenGL ES Touch Detection (Ray Tracing) for iPad Retina?

北城余情 提交于 2019-12-06 15:12:20
问题 I have the below code which I am using for ray tracing. The code works successfully on non-retina iPads, however does not function on the retina iPads. The touch is detected, however the converted point is off to the left and below where it should be. Can anyone suggest how I can update the below to accommodate the retina screen ? - (void)handleTap: (UITapGestureRecognizer *)recognizer { CGPoint tapLoc = [recognizer locationInView:self.view]; bool testResult; GLint viewport[4]; glGetIntegerv

Detect&find intersection ray vs. cubic bezier triangle

狂风中的少年 提交于 2019-12-06 07:55:21
问题 While writing a model editor, besides enabling raytracing I can think about couple of operations where I'd like to find an very good approximation about the intersection point between a ray and a triangular bezier patch. How to do this? I know couple of ways but likely there's better ones. Exact use-cases: I might want to use one bezier triangle patch as a reference surface for drawing detailed shapes with mouse. I might too want to pinpoint a splitting-point from such patch. If there's C

Simple C/C++ library for triangle-intersection acceleration structure

两盒软妹~` 提交于 2019-12-06 06:35:14
问题 I'm raytracing and would like to speed it up via some acceleration structure (kd-tree, BVH, whatever). I don't want to code it up myself. What I've tried so far: Yanking the kd-tree out of pbrt. There are so many intra-dependencies that I couldn't succeed at this without pulling all of pbrt into my code. CGAL's AABB tree. Frustratingly, this seems to return only the point of intersection. Without knowing which triangle the point came from, I can't efficiently interpolate color over the

Unexpected result when computing shadows in a ray tracer

泄露秘密 提交于 2019-12-06 04:23:31
I'm working on a raytracer using C++, and so far I've been able to compute a lighting model based on diffuse, specular and ambient components. My problem appeared when I tried to add shadows to my scenes: the scenes get really messed up: My code is divided as follows: I have a base class "SceneObject", which has a virtual method intersect(), which takes a ray (defined by origin and direction) and outputs a boolean, as well as return arguments for the calculated t value, a hitpoint and the normal of the object. The "Material" class contains a specular and diffuse colours (vectors) as well as a

Is this plane-ray intersection code correct?

走远了吗. 提交于 2019-12-06 01:57:20
My Plane class has two fields: public Vector3 Norm; //normal vector public double Offset; //signed distance to origin This is the code I use for intersection, and I don't know if it is correct. I double checked my equations and everything, but I would like to get feedback from people more experienced with this. public override Intersection Intersect(Ray ray) { // Create Intersection. Intersection result = new Intersection(); // Find t. double t = - (Vector3.Dot(Norm,ray.Start) + Offset) / (Vector3.Dot(Norm, ray.Dir)); if (t < 0) // the ray does not hit the surface, that is, the surface is

Ray-Polygon Intersection Point on the surface of a sphere

拜拜、爱过 提交于 2019-12-05 12:41:15
I have a point (Lat/Lon) and a heading in degrees (true north) for which this point is traveling along. I have numerous stationary polygons (Points defined in Lat/Lon) which may or may not be convex. My question is, how do I calculate the closest intersection point, if any, with a polygon. I have seen several confusing posts about Ray Tracing but they seem to all relate to 3D when the Ray and Polygon are not on the same Plane and also the Polygons must be convex. sounds like you should be able to do a simple 2d line intersection... However I have worked with Lat/Long before and know that they

What types of geometry definition file format is best used with ray tracing to include the type of material

泄露秘密 提交于 2019-12-05 06:00:18
I wanted to use .obj format, but I noticed that it doesn't have representation for the type of material, i.e. opaque, transparent, reflective. Is there a common file format that includes that information as well, or should I just take the known .obj format and change it so that it'll include that info? you might want to check mtl-files. Haven't (yet) used it myself though ;) http://people.sc.fsu.edu/~jburkardt/data/mtl/mtl.html and http://people.sc.fsu.edu/~jburkardt/data/obj/obj.html Cheers .obj can referance .mtl files, which can hold opaque, transparent, reflective, colours, refractive

Why does raytracer render spheres as ovals?

妖精的绣舞 提交于 2019-12-05 03:19:54
I've been hacking up a raytracer for the first time over the past few days. However, there are a few quirks which bother me and I don't really know how to work out. One that has been there since the beginning is the shape of spheres in the scene - when rendered, they actually look like ovals. Of course, there is perspective in the scene, but the final shape still seems odd. I have attached a sample rendering, the problem I have is especially visible on the reflective sphere in the lower left part of the image. I don't really know what could be causing this. It might be the ray-sphere