All Questions
Tagged with perspectivecamera glsl
14
questions
0
votes
1
answer
388
views
Dealing with the non-linearity of perspective shadowmap depth values
I have implemented shadow maps in GLSL by rendering the view from a light into a depth texture, and then in a second pass compare these values when rendering my geometry from camera view.
In ...
1
vote
2
answers
2k
views
Modern OpenGL: Object picking (C#, OpenTK)
I am trying to implement object picking in OpenGL using C# and OpenTK. I have written a class for this purpose based on two sources:
OpenGL ray casting (picking): account for object's transform
...
2
votes
1
answer
2k
views
Orthographic projection matrix issue in OpenGL
I'm try to render a scene with the orthographic projection matrix without any success.
this is my vertex shader:
#version 330 core
layout (location = 0) in vec3 position;
uniform mat4 model;
...
3
votes
1
answer
2k
views
X-Y-Distance from camera to object in vertex shader
I want to show some fog / aerial view in my application. But I only want to use the x,y world distance from camera to the model to determine the appearance.
I already managed to get the signed z-...
2
votes
1
answer
2k
views
Threejs: compute projected coordinate in fragment shader
I'm struggling with handling Coord in fragment Shader.
In brief, I just want to draw circle with fragment shader using (x,y,z) of world space. But because of camera position and the z of circle's ...
3
votes
1
answer
2k
views
Applying a perspective transformation matrix from GIMP into a GLSL shader
So I'm trying to add a rotation and a perspective effect to an image into the vertex shader. The rotation works just fine but I'm unable to make the perspective effect. I'm working in 2D.
The ...
5
votes
1
answer
4k
views
What's the fourth dimension in a GLSL gl_Position?
I'm learning OpenGL, and currently I'm writing a shader, but I'm confused as to why the gl_Position variable is a vec4 instead of a vec3, as I'd expect. I'd expect this of course because it uses 3D ...
2
votes
1
answer
4k
views
OpenGL NDC and coordinates
Although I am relatively new to OpenGL, I have no trouble with matrix algebra, homogeneous coordinates, rotations and projections. I have set up my mvp matrix to get a good view of a cube and it ...
2
votes
1
answer
1k
views
Is 4th row in model view projection the viewing position?
I want to light a flat surface at vertex level from the direction of the camera. I expect the lighting to not change when I rotate the view but it is brightest when I look slightly away. Is mvp[3] not ...
0
votes
1
answer
366
views
Perspective projection of GLSL textureCube on arbitrary geometry from same origin does not conserve straight lines
Problem: Certain straight lines (the blue z axis in this example) are not projected to straight lines when projecting the picture of a rotated cubecamera with the cube shader on a non-cube screen and ...
5
votes
1
answer
369
views
OpenGL: Projecting view-space co-ordinates to NDCs, results seemingly outside of [-1,1] range
I've been attempting to implement screen-space ambient occlusion as instructed by this tutorial. I've been tackling problems with my implementation as I've come across them, but this one has me ...
3
votes
1
answer
205
views
OpenGL Frustum Pedagogy
i've been drawing directly into homogenous clip space (the 2x2x2 cube centered around 0,0,0) in opengl and i've realized that the perspective transformation matrix transforms all geometry from one ...
9
votes
3
answers
11k
views
How to recover view space position given view space depth value and ndc xy
I am writing a deferred shader, and am trying to pack my gbuffer more tightly. However, I cant seem to compute the view position given the view space depth correctly
// depth -> (...
4
votes
5
answers
9k
views
raycasting: how to properly apply a projection matrix?
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 ...