A technique for using rays to determine points of intersection. Often used in lighting simulation.

learn more… | top users | synonyms (1)

0
votes
1answer
371 views

Displaying sprites in a 2.5D raycasting engine

I'm developing a raycasting engine like the one used in DOOM, Wolfenstein 3D, etc. My engine is capable of correctly displaying walls and textures on walls, but I'm stuck at sprites rendering. Given ...
5
votes
1answer
3k views

More efficient way to implement Line of sight on a 2d grid with ray casting?

Consider a 2d grid of tiles, and an approximated sphere of coordinates - centered on the player - that represents line of sight. The goal is to block the line of sight beyond obstacles (ie walls). ...
11
votes
4answers
3k views

Cast ray to select block in voxel game

I am developing a game with a Minecraft-like terrain made out of blocks. Since basic rendering and chunk loading is done now, I want to implement block selecting. Therefore I need to find out what ...
2
votes
1answer
964 views

Raycasting “fisheye effect” question

Continuing my exploration of raycasting, I am very confused about how the correction of the fisheye effect works. Looking at the screenshot below from the tutorial at permadi.com, the way I ...
1
vote
0answers
86 views

Performance issues with visibility detection and object transparency

I'm working on a 3d game that has a view similar to classic isometric games (diablo, etc.). One of the things I'm trying to implement is the effect of turning walls transparent when the player walks ...
4
votes
1answer
1k views

Raycasting tutorial / vector math question

I'm checking out this nice raycasting tutorial at http://lodev.org/cgtutor/raycasting.html and have a probably very simple math question. In the DDA algorithm I'm having trouble understanding the ...
8
votes
3answers
1k views

Narrow-phase collision detection algorithms

There are three phases of collision detection. Broadphase: It loops between all objecs that can interact, false positives are allowed, if it would speed up the loop. Narrowphase: Determines whether ...
3
votes
1answer
1k views

Problems implementing a screen space shadow ray tracing shader

Here I previously asked for the possibility of ray tracing shadows in screen space in a deferred shader. Several problems were pointed out. One of the most important problem is that only visible ...
1
vote
2answers
764 views

Raycasting mouse coordinates to rotated object?

I am trying to cast a ray from my mouse to a plane at a specified position with a known width and length and height. I know that you can use the NDC (Normalized Device Coordinates) to cast ray but I ...
0
votes
2answers
346 views

Wavefront mesh: determine which face a point belongs to?

I have a 3D mesh Wavefront .obj file. Is there any algorithm that takes an arbitrary point coordinates as input and determines which face of the mesh that point belongs to ?? The mesh is rendered on ...
-2
votes
1answer
864 views

Ray casting on a mesh using libgdx [closed]

I'm trying to perform ray casting on a mesh using libgdx. I found this code sample and it misses some explanations. What do these vectors stand for? What is globalIntersection and localIntersection?
1
vote
1answer
162 views

Looking for a library to create a grid based first person game online

Before I go and build it myself, I have been looking for a library that may help making a grid based first person view similar to: https://www.youtube.com/watch?v=GwmZoCFd4Us I plan to make a web ...
8
votes
1answer
3k views

Why doesn't Unity's OnCollisionEnter give me surface normals, and what's the most reliable way to get them?

Unity's on collision event gives you a Collision object that gives you some information about the collision that happened (including a list of ContactPoints with hit normals). But what you don't get ...
2
votes
1answer
365 views

OpenGL 3+ Range Picking

How do I perform range picking in the latest OpenGL version? By range picking I mean selecting all objects which are picked using a selection rectangle, like in an RTS game. For single object picking ...
1
vote
2answers
4k views

How to handle 3D collisions using raycasting (with a reflection vector?)

I'm making a game using THREE.JS, and I want my character to walk on the terrain, and collide with static 3D objects (=AABB boxes) that are on that terrain. The problem is: THREE.JS has only a ...
1
vote
1answer
2k views

Raycasting Collision Detection

I need to check for collisions when firing a bullet, but I have a few questions first. My game is 2D and tile based, it also uses the XNA framework. From what I've read raycasting or continuous ...
0
votes
1answer
134 views

Is it safe to cast my 2D points to 3D points for a library which only takes Vector3s?

I need to cast a ray in 2D space for bullet collision detection, but the Ray.Intersects method requires a BoundingBox which uses vector3's not vector2's. My question is should I just ignore the Z ...
2
votes
1answer
463 views

What is an easy way to work subsurface scattering into a raycaster?

I've got some neat effects with path tracing: I want to add in an ability to do subsurface scattering, but I'm unsure of the general algorithm. With path tracing, it's: foreach pixel: trace( ...
1
vote
2answers
471 views

What mathematics would I need to know in order to build a 2.5D raycasting engine

I realize this is a fairly common-type question, but I've been studying Maths in my spare time, fairly slowly at that, and I really want to develop a raycasting engine like the original DOOM. I know ...
5
votes
1answer
2k views

Finding if a point is inside of a mesh (Point-in-polyhedron)

How can I find if a point (Vector3) is inside of a mesh? Would this work for both concave and convex objects? I read somewhere that if you raycast in both directions of every axis (X, -X, Y, -Y, Z, ...
0
votes
2answers
767 views

3D collision detection with meshes using only raycasting?

I'm building a game using WebGL and Three.js, and so far I have a terrain with a guy walking on it. I simply cast a ray downwards to know the terrain height. How can I do this for other 3D objects, ...
3
votes
1answer
346 views

3d Picking under reticle

i'm currently trying to work out some 3d picking code that I started years ago, but then lost interested the assignment was completed (this part wasn't actually part of the assignment). I am not ...
1
vote
1answer
367 views

How to calculate the viewing cone radius at a distance in raymarching?

I'm "raymarching distance fields" (proper lingo: sphere-tracing) in GLSL. To implement cone-marching atop of it (and also to minimize the number of raymarching steps regardless of whether ...
1
vote
1answer
2k views

Optimized algorithm for line-sphere intersection in GLSL

Well, hello then! I need to find intersection between line and sphere in GLSL. Right now my solution is based on Paul Bourke's page and was ported to GLSL this way: // The line passes through p1 and ...
11
votes
1answer
1k views

How can I draw an arrow at the edge of the screen pointing to an object that is off screen?

I am wishing to do what is described in this topic: http://www.allegro.cc/forums/print-thread/283220 I have attempted a variety of the methods mentioned here. First I tried to use the method ...
0
votes
1answer
4k views

OpenGL ES 2.0 gluUnProject

I've spent more time than I should trying to get my ray picking program working. I'm pretty convinced my math is solid with respect to line plane intersection, but I believe the problem lies with the ...
7
votes
1answer
749 views

Skewed: a rotating camera in a simple CPU-based voxel raycaster/raytracer

TL;DR — in my first simple software voxel raycaster, I cannot get camera rotations to work, seemingly correct matrices notwithstanding. The result is skewed: like a flat rendering, correctly rotated, ...
3
votes
4answers
184 views

Ray Triangle Intersection issue

I'm trying to perform ray triangle intersection on a mesh made of triangles. The below code seems to work fine but only about 50% of the time. The ray often gets into positions where no intersection ...
5
votes
1answer
423 views

Raymarching artifacts

I was playing with raymarching using distance fields in GLSL sandbox and got stuck with a strange problem with artifacts. Click here and take a look at the spheres generated in corners, they have ...
3
votes
1answer
438 views

How to calculate FOV with four-walled tiles?

I'm working on a 2D tile-based game. I'm trying to calculate FOV and I've implemented walls so they don't take up an entire tile. Instead, they just take up a side of each tile. Similar to: class ...
1
vote
1answer
3k views

Picking objects with mouse ray

I simply want to pick a few spheres in my scene using the mouse-ray. I have implemented(copied most of it but with little understanding) a ray-sphere collision code. Also I have implemented the code ...
14
votes
2answers
6k views

How can I implement lighting in a voxel engine?

I am creating the MC like terrain engine, and I have thought that lighting would make it look a whole lot nicer.The problem is that the blocks are not being lit properly when a block which emits light ...
1
vote
1answer
282 views

XNA - Incorrect Mouse Ray?

I have the following code: Vector3 nearSource = new Vector3(mState.X, mState.Y, 0.0f); Vector3 farSource = new Vector3(mState.X, mState.Y, 3.0f); Vector3 nearPoint = ...
5
votes
2answers
358 views

How does this snippet of code create a ray direction vector?

In the Minecraft source code, this code is used to create a direction vector for a ray from pitch and yaw:' float f1 = MathHelper.cos(-rotationYaw * 0.01745329F - 3.141593F); float f3 = ...
6
votes
1answer
708 views

Finding which tiles are intersected by a line, without looping through all of them or skipping any

I've been staring at this problem for a few days now. I rigged up this graphic to help me visualise the issue: http://i.stack.imgur.com/HxyP9.png (from the graph, we know that the line intersects ...
0
votes
2answers
668 views

What graphics library should I use for line rendering for a raycasting renderer?

I want to develop simple RPG with ray casting rendering. I chose SDL for graphics and input. The problem is there is no native line drawing in it, which I need to start prototyping a ray casting ...
5
votes
2answers
765 views

What are the time-efficiency characteristics of these voxel data structures?

Real-time, high-resolution voxel raycasters tend to use one of the following optimising data structures in order to achieve interactive frame rates. What are the pros and cons to these, and what other ...
4
votes
1answer
385 views

Where can I find a BRDF reference implementation?

Does anyone have a link to a sample implementation of how to create/handle 4D BRDFs? I found a few interesting papers and websites, Szymon's (student, Princeton) BRDF survey, 1997 SIGGRAPH survey ...
4
votes
1answer
696 views

Raycasting problem

I have a problem with my raycasting. I have 8 cubes, that define the first level of an octree (Eg. they create bigger cube). I need to raycast them and "render" each cube. If I have only one cube, ...
3
votes
2answers
2k views

Raycasting in Unity3D?

I have a game object on screen represented by a cube (but say it was a quad or something else all the same). How do I raycast to check intersections? Keeping in mind I may not be raycasting fora ...
0
votes
1answer
888 views

How to not-unroll loops in Shader Model 3 HLSL

I'm working on raycaster in HLSL, unfortunately it have to be in DX9. But it cannot be compiled I did similar raycaster in DX11 and i know that there is always problem with FXC compiler that it tries ...
2
votes
1answer
952 views

How can I exclude some rigid body from rayTest in Bullet Physics?

I'm trying to picking some object with rayTest method of BulletPhysics. The problem is my stage is surrounded with walls (btStaticPlane) and the target objects (btSphereShape) are in there. And I'm ...
4
votes
1answer
412 views

Direction vector in raycasting

When I read about how to get the direction vector in raycasting, for example on this site: http://www.daimi.au.dk/~trier/?page_id=98 They first render the mesh with front face culling and then with ...
3
votes
1answer
402 views

Hashing 3D position into 2D position

I am doing volumetric raycasting and curently working on depth jitter. I have 3D position on ray and want to sample 2D noise texture to jitter the depth. Function for converting (or hashing) 3D ...
3
votes
1answer
1k views

Ray-plane intersection to find the Z of the intersecting point

I have a rectangle in 3d space (p1, p2, p3, p4) and when the mouse rolls over it I need to calculate the exact Z of the point on the rect, given the mouse coordinates (x, y). Would a Ray-plane ...
3
votes
1answer
6k views

3D Ray Casting / Picking

I am not sure if I should post this link, but I feel this falls into game development just as much as it does math. I have a ray cast's far and near values and I am trying to calculate the end point ...
3
votes
3answers
1k views

How to determine what triangle in a mesh the cursor is pointing to?

I have a game I'm working on in which items are "placed" and "selected". In order to do this, I need to determine what triangle in a mesh the cursor is pointing to. I have no trouble with getting ...
3
votes
2answers
340 views

What are the technologies that makes physics engines so good for raycasting?

again. This question is strictly related to this one so, what is the technology that makes physics engines suitable for raycasting? It is a particular data structure? Has it to do with the engine's ...
4
votes
3answers
3k views

Why do we use physics engines for collision testing or raycasting?

There is a thing I don't understand about game engines: why it is so common to use physics engines to do raycasting or collision testing? Say that you have a 3D scene loaded in your scene manager ...