2
votes
1answer
173 views

Are ambient, diffuse and specular light or material properties?

Are ambient, diffuse and specular properties of light or material? I am doing ray casting in OpenGL, I've managed to create lit sphere using formula I = L Ka + L Kd (n . l) + L Ks (r . v)^n but I ...
0
votes
0answers
215 views

LWJGL Mouse picking when camera rotated

I have third person camera in my game and I have mouse picking which works not so good. It works good only when yaw rotation is lesser than ~75 if yaw is greater than 75 then it fails.. Here is video ...
-1
votes
1answer
120 views

Ray picking gives inversed results

I'm trying to do a simple ray picking implementation to allow a user to select a cell in a grid rendered in 3D. I'm almost there, but I've ran into an issue which I can't seem to solve. Consider the ...
7
votes
3answers
3k views

How do I implement occluded lighting in a block-based 2D game?

I want to have 2D lighting that can be blocked by in-game objects. My game has a top-down view and all game objects are described by rectangles. Let's say I have a 10x10 world and I place a light at ...
1
vote
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
666 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 ...
2
votes
1answer
353 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 ...
3
votes
1answer
337 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
1k 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 ...
5
votes
1answer
416 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 ...
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 ...
5
votes
2answers
353 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 = ...