A technique for using rays to determine points of intersection. Often used in lighting simulation.
3
votes
1answer
91 views
How to ray cast 2D light in a block-based game
I want to use 2D lighting that can be blocked by in-game objects. My game is block-based and has a view from the top of the flat world. Now lets say I have a 10x10 world and I place a light at 1x1 and ...
6
votes
2answers
151 views
Diagonal line of sight with two corners
Right now I'm using Bresenham's line algorithm for line of sight. The problem is I've found an edge case where players can look through walls. Occurs when the player looks between two corners of a ...
0
votes
1answer
52 views
Quick 3D sight calculation algorithm
I have a tile based board game where units move in 3D space on a 2D isometric view. When calculating attack tiles for a unit, how do I verify that they aren't shooting through a wall or a level too ...
1
vote
1answer
90 views
Ray Tracing in 3D - generating a ray
A ray is shot from the camera eye to the camera screen at point (i,j) how do I get the coordinates of that point in 3D world coordinates?
The best I could find online is for point S
S = Q + au + bv
...
0
votes
3answers
90 views
Keeping raycast on the same level
I want my raycast to end at certain height(red line). But as the game is 3D and the camera rotates I can't use a fixed magnitude. What I thought was a stroke of genius, I figured I'd project the ...
0
votes
1answer
143 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 ...
0
votes
0answers
43 views
Reading text-coord from a multitextured mesh
Ive been trying different ways to create a ray method that gives me back whatever texture is on a mesh by using the xna triangle picking sample as a starting point, but
theres just one last thing I ...
3
votes
1answer
378 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).
...
4
votes
4answers
534 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 ...
1
vote
1answer
302 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
69 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 ...
3
votes
1answer
369 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 ...
6
votes
3answers
321 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 ...
1
vote
1answer
464 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
297 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
1answer
158 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
279 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
114 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 ...
6
votes
1answer
546 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
295 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 ...
0
votes
2answers
1k 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
795 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
118 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
151 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
304 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 ...
4
votes
1answer
469 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
482 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
296 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
248 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
834 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
566 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
2k 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 ...
6
votes
1answer
494 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, ...
2
votes
4answers
141 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
344 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
346 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
2k 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 ...
12
votes
2answers
3k 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
228 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
305 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
369 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
499 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
575 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
267 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
0answers
522 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, ...
2
votes
1answer
1k 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
560 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
595 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
307 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
371 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 ...