raytracing

How would you implement a perfect line-of-sight algorithm?

Disclaimer: I'm not actually trying to make one I'm just curious as to how it could be done. When I say "Most Accurate" I include the basics wall distance light levels and the more complicated Dust in Atmosphere rain, sleet, snow clouds vegetation smoke fire If I were to want to program this, what resources should I look into an...

Efficiency of perspective projection vs raytracing/ray casting

I have a very general question. I wish to determine the boundary points of a number of objects (comprising 30-50 closed polygons (z) each having around 300 points(x,y,z)). I am working with a fixed viewport which is rotated about x,y and z-axes (alpha, beta, gamma) wrt origin of coordinate system for polygons. As I see it there are two ...

How to cast rays given an arbitrary camera?

I'm writing a ray tracer (using left-handed coordinates, if that makes a difference). It's for the sake of teaching myself the principles, so I'm not using OpenGL or complex features like depth of field (yet). My camera can have an arbitrary position and orientation; I indicate them by way of three vectors, location, look_at, and sky, wh...

How can I turn a ray-plane intersection point into barycentric coordinates?

Hi, My problem: How can I take two 3D points and lock them to a single axis? For instance, so that both their z-axes are 0. What I'm trying to do: I have a set of 3D coordinates in a scene, representing a a box with a pyramid on it. I also have a camera, represented by another 3D coordinate. I subtract the camera coordinate from the ...

texture minification filter in raytracing?

can someone point me to a paper/algorithm/resource/whatever that tells me how to implement a texture minification filter (applies when texels are smaller than pixels) in a raytracer? thanks! ...

KD-Tree traversal (raytracing) - am I missing a case?

Hi! I'm trying to traverse a 3D KD-Tree in my raytracer. The Tree is correct, but there seems to be something wrong with my traversal algorithm since I'm getting some errors compared to using a brute-force approach (some small surface areas seem to get ignored). Note: none of the rays in question is parallel to any axis. This is my tra...

Raytraced Shadows Problem

Hey There! I've got a problem with shadowrays in my raytracer. Please have a look at the following two pictures 3D sMax: My Raytracer: The scene is lit by a very bright light, shining from the back. It's so bright that there is no gradient in the shading, just either white or dark (due to the overexposure). both images were rend...

OpenGL gluUnProject object section

Hi everyone, I'm using gluUnProject to cast a ray into the scene and adding a primitive there. What I'm trying to do is now accurately pick existing primitives, so if I have 3 spheres I could click on one to delete it. I think the solution would somehow check if the ray intersected with an object and check if its the closest to the cast...

How to set up quadratic equation for a ray/sphere intersection?

I'm researching the math for a ray tracer, but I'm not following a transition that is made in just about every article I've read on the subject. This is what I have: Formula for a sphere: (X - Cx)^2 + (Y - Cy)^2 + (Z - Cz)^2 - R^2 = 0 Where R is the radius, C is the center, and X, Y, Z are all the points in the sphere. Formula for a ...

Ask for resource about fast ray-tracing algorithm

Hi, All, First, I am sorry for this rough question, but I don't want to introduce too much details, so I just ask for related resource like articles, libraries or tips. My program need to do intensive computation of ray-triangle intersection (there are millions of rays and triangles), and my goal is to make it as fast as I can. What I...

Testing for ray-sphere intersection

I am trying to determine whether a line segment (i.e. between two points) intersects a sphere. I am not interested in the position of the intersection, just whether or not the segment intersects the sphere surface. Does anyone have any suggestions as to what the most efficient algorithm for this would be? (I'm wondering if there are any ...

Easiest way to create and render 3D model by rotating a 2D silhouette

I have a black and white 2D drawing of a silhouette (say, a chess piece) that I would like to rotate around an axis to create a 3D object. Then I want to render that 3D object from multiple angles using some sort of raytracing software, saving each angle into a separate file. What would be the easiest way to automatically (repeatedly) ...

Unittest++: test for multiple possible values

Hi there, i am currently implementing a simple ray tracer in c++. I have a class named OrthonormalBasis, which generates three orthogonal unit vectors from one or two specified vectors, for example: void OrthonormalBasis::init_from_u ( const Vector& u ) { Vector n(1,0,0); Vector m(0,1,0); u_ = unify(u); v_ = cross(u_,n)...

POVray: How to reliably create nice merges of objects merely touching on the surface?

What I'm doing I have a scene which algorithmically draws a prism with a hexagonal cross-section and n layers of such prisms surrounding the center one, such that all the prisms together make a larger hexagon shape. Now, each row of prisms is displaced from the next by a multiple of sqrt(3)/2 (because the dimensions of one prism are <...

Raytracing / Phong

Hello, i don't make out the difference between raytracing and shading technique like Phong or Gouraud. For 3D modeling do one have to choose between those algorithms or they can be implemented both in the same algorithm. Thank you. ...

Very general question about the implementation of vectors, vertices, edges, rays, lines & line segments.

This is just a LARGE generalized question regarding rays (and/or line segments or edges etc) and their place in a software rendered 3d engine that is/not performing raytracing operations. I'm learning the basics and I'm the first to admit that I don't know much about this stuff so please be kind. :) OK, I wondered why a parametrized lin...

raycasting: how to properly apply a projection matrix?

Hi, I am currently working on some raycasting in GLSL which works fine. Anyways I want to go from orthogonal projection to perspective projection now but I am not sure how to properly do so. Are there any good links on how to use a projection Matrix with raycasting? I am not even sure what I have to apply the matrix to (propably to the...

What can cause Phong specular shading to produce gamut overflows?

I am currently implementing a basic raytracer in c++. Works pretty well so far, matte materials (with ambient and diffuse brdf) work as expected so far. Adding specular highlights would result in the full Phong Model and that's exactly what i tried to do. Unfortunately, i encounter gamut overflow, with all kinds of values for the specu...

Given an octree of voxels, how do you render with smooth surfaces?

I noticed most 3d voxel models are actually pretty low resolution, but then are rendered all smoothed out with some sort of interpolation. Given its ray traced, what is the algorithm used to render it smoothly? Could anybody suggest a book on the topic? ...

Detect&find intersection ray vs. cubic bezier triangle

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 bezie...