mathematics – Emulate doom-style raycaster projection distortion with modern graphics apis

Currently working on a doom-like engine with fewer technical limitations, and looking into rendering techniques. I’m aware doom’s a raycaster, and I want to capture a similar look but with modern graphics APIs, without implementing a raycasted column-renderer in them.

One of the technical limitations I’m ignoring is on the inclination of the camera, which was locked to be parallel in doom due to the “column” drawing. Modern faithful sourceports, such as crispydoom, and some of the later-era doom-based games like Heretic, allowed looking up-and-down using y-shearing. In the image bellow, taken from the linked page, the green rectangle represent the regular un-inclinded view and the red rectangle represents the “inclined” view.

image from linked page, displaying y shearing animated view of y-sheared camera

From the image, you can see that it’s effectively rendering a vertically wide FOV, and cropping it – though with column rendering that’s a little more direct. This is different from simply adjusting the height of the camera, as with this method the vanishing points remain at their original location – causing some distortion as you look up and down. For example in the image above the apparent angle between the columns and roof don’t change with this method, where-as with moving the camera upwards you would expect the angle between them to become more orthogonal the closer they come to the vertical-center of the camera’s view.

I would like to emulate such a distortion using modern graphics APIs (wgpu, vulkan, dx12, metal) without implementing the equivalent of the software renderer, and without overdrawing the screen and then cropping. I’m also definitely only looking for an approximate emulation of the effect, if it looks pretty close then that’s good enough

I did also see this on one of the other exchanges, and it sounds eerily similar to how I described y-shearing:

I imagine that you would cancel out the inclination of the camera in the view matrix, then somehow map it to a vertical “shift” of the projection matrix, though I’m uncertain how to perform that mapping – or if there even is a sensical one.

Thanks for your time!

opengl – Orthographic projection not showing a triangle

I just want to draw a simple triangle using GL_LINES primitive with orthographic projection matrix.

This is my vertices…

float_t vertices(){
    -0.5f, -0.5f, 0.0f,     0.0f, 0.0f, 1.0f,
     0.5f, -0.5f, 0.0f,     0.0f, 0.0f, 1.0f,
     0.5f, -0.5f, 0.0f,     0.0f, 0.0f, 1.0f,
     0.0f,  0.5f, 0.0f,     0.0f, 0.0f, 1.0f,
     0.0f,  0.5f, 0.0f,     0.0f, 0.0f, 1.0f,
    -0.5f, -0.5f, 0.0f,     0.0f, 0.0f, 1.0f

And this is my matrices(model, view, projection)…

glm::mat4 model = glm::mat4(1.0f);
prog.setMat4fv1("model", model);

glm::mat4 view = glm::mat4(1.0f);
view = glm::translate(view, glm::vec3(0.0f, 0.0f, -3.0f));
prog.setMat4fv1("view", view);

glm::mat4 projection = glm::mat4(1.0f);
projection = glm::ortho(0.0f, 800.0f, 0.0f, 600.0f, 0.1f, 100.0f);
prog.setMat4fv1("projection", projection);

And this is the code in the while loop (game loop) that draws a triangle…

glDrawArrays(GL_LINES, 0, 6);

I see nothing. But when I change the code for projection matrix from glm::ortho() to glm::perspective(), it draws a triangle which is obviously smaller than the original one because of the code view = glm::translate(view, glm::vec3(0.0f, 0.0f, -3.0f)); which moves all the objects a little bit away from the camera.(I am not coding for the camera class at this time.)

So this is the code for projection matrix which works fine…

projection = glm::perspective(glm::radians(45.0f), (float_t)win_width / (float_t)win_height, 0.1f, 100.0f);

Am I doing something wrong with glm::ortho()? I can only create a model matrix and it’s just fine. But this the first time I am using glm::ortho() and I don’t see any examples on the internet. How can I solve the issuse with glm::ortho()?

real analysis – Is every analytic set the projection of a set with sections large in some sense?

Is every analytic set $A$ in, say, $I=(0,1)$, the projection of a Borel set $B$ in, say, $(0,1) times (0,1)$, $A = pi_1(B)$, with the following property: For every regular Borel probability measure $mu$ on $(0,1)$, there is $y in (0,1)$ s.t.

$ int 1_B(x,y) mu(dx) > 0 $

where $1_B(cdot,cdot)$ is the indicator function of $B$?

Any results that show that analytic sets are projections of sets with sections ‘large’ in some sense are appreciated as well. Answers that use axioms in addition to ZFC (in particular, $V=L$) are also useful.

linear algebra – Is it possible to construct an orthographic projection matrix with an infinitely distant far clipping plane?

By using a reversed z buffer, where $z=1$ indicates the near plane and $z=0$ indicates the far plane, it is possible to achieve an infinitely distant far clipping plane in a perspective projection with roughly linear precision due to the pseudo-logrithmic distribution of IEEE floats nearly cancelling out the nonlinearity of the stored $1/z$ in the depth buffer.

With a +x right, +y up, and +z towards the viewer (right handed) world space, the perspective projection for an infinitely far z clip plane (with reversed clip-z) is

(tan{(fovydiv 2)} times aspect)^{-1} & 0 & 0 & 0 \
0 & (tan{(fovydiv 2)})^{-1} & 0 & 0 \
0 & 0 & 0 & znear \
0 & 0 & -1 & 0 \

Column-major matrix; a point is a column vector multiplied on the right with $w=1$.

The standard orthographic projection is, of course,

2(x_{right}-x_{left})^{-1} & 0 & 0 & (x_{left}+x_{right})(x_{left}-x_{right})^{-1} \
0 & 2(y_{top}-y_{bottom})^{-1} & 0 & (y_{bottom}+y_{top})(y_{bottom}-y_{top})^{-1} \
0 & 0 & (z_{far}-z_{near})^{-1} & (z_{near})(z_{near}-z_{far})^{-1} \
0 & 0 & 0 & 1 \

Written with ^{-1} rather than as more commonly seen with frac such that it’s actually legible at MSE screen size.

Naïvely taking the limit as ${z_{far} to infty}$ yields that $s_z = 0$ and $t_z = 0$, which obviously isn’t correct, as now $z_{near}$ has no impact on the output. Additionally, in order to scale the infinite $z$ distance into the (reverse) range $(1, 0)$, we need to utilize the perspective divide and put the $z$ coordinate into $w$.

Based on an intuitive understanding of the simple orthographic projection as a series of axis-wise range maps, I can guess that we want $k_z = 0$, $k_w=-1$, $t_z=znear$, $t_w=0$, as in the perspective projection, but I am at a loss as to how to achieve the correct scaling of $x$ and $y$.

The mapping of $x$ (and equivalently $y$) that we want is still the same as with a fixed far plane,

(frac{2}{x_{right}-x_{left}})x + frac{x_{left}+x_{right}}{x_{left}-x_{right}}text{,}

but we have to somehow cancel out the $w$ ($z$) perspective divide that we’re using to project the $z$ coordinate. It’s this step that I’m stuck on, and am unsure if is possible.

Showing the steps used to derive a correct matrix is appreciated, but not neccessary, if you show that it performs the described projection.

Any errors are of my own transcription, and should not reflect back onto my sources. theory – Factoring a projection of surface groups through a free group

Consider the surface group $S_g=langle a_1,b_1,a_2,b_2,dots,a_g,b_g mid (a_1,b_1)(a_2,b_2)cdots(a_{g},b_{g})=1rangle$, which is the fundamental group of the closed orientable genus-$g$ surface.

Suppose $2leq m<n$ and let $p:S_nto S_m$ be the canonical projection, which is the identity on generators $a_i,b_i$, $1leq ileq m$ and which trivializes $a_i,b_i$, $m+1leq ileq n$. Let $F_r$ denote the free group with rank $r$.

Question: Is it possible to have finite rank free group $F_r$ and epimorphisms $f:S_nto F_r$ and $g:F_rto S_m$ such that $gcirc f=p$?

There is apparently a kind of classification of epimorphisms of surface groups onto free groups that seems relevant (in the following reference). However, I have not been able to see exactly how it helps answer this question.

R. I. Grigorchuk, P. F. Kurchanov, and H. Zieschang, “Equivalence of homomorphisms of surface groups to free groups and some properties of 3-dimensional handlebodies,” Preprint, Ruhr-Universität Bochum, 1990.

The classification: If $r>n$, then no epimorphism $S_nto F_r$ can exist. Apparently, when $rleq n$, then there is only one epimorphism $S_nto F_r$ “up to automorphism.” The representative is this: choose $F:S_nto F_r$ to send $a_i$, $1leq ileq r$ to the free generators and trivialize all other generators. This is unique in the sense that for any other epimorphism $f:S_nto F_r$, we must have $F=fcirc sigma$ for some $sigmain Aut(S_n)$.

Considering this classification and the structure of $p$, my feeling is that the question has a negative answer but that I am perhaps overlooking something simple.

fa.functional analysis – Geometrical interpretation of back projection operator or adjoint of Radon transform

If $f in C_{c}^{infty}left(mathbb{R}^{2}right)$, the Radon transform of $f$ is the function $$R f(s, omega):=int_{-infty}^{infty} fleft(s omega+t omega^{perp}right) d t, quad s in mathbb{R}, omega in S^{1} .$$

From the definition, Radon transform captures integral of functional along the line.

$R^{*}$ is the backprojection operator defined as
$$R^{*}: C^{infty}left(mathbb{R} times S^{1}right) rightarrow C^{infty}left(mathbb{R}^{2}right), quad R^{*} h(y)=int_{S^{1}} h(y cdot omega, omega) d omega$$

Above is an adjoint of the Radon transform. I think it captures the integral of a function over the circle of radius $ycdot omega$ passing through the point $y$. Is this geometrical interpretation is correct?

Any help or hint will be greatly appreciated.

real analysis – Zygmund class, Schwartz class and Littlewood-Paley projection operators

I’m studying Littlewood-Paley theory in harmonic analysis, where I encountered the following problem related to the Zygmund class of functions:

Consider the Zygmund class of functions defined as follows:
$$Z_C = left{f in L^{infty} bigg | sup_{x,h}frac{|f(x-h)+f(x+h)-2f(x)|}{|h|} < inftyright}$$
Let $P_{k} (k in mathbb{Z})$ denote the Littlewood-Paley projection operators. Then we have:

(1) If $f in Z_C$, then $sup_{k geq 0}(2^{k}||P_{k}f||_{L^2}) < infty$

(2) If $f in mathcal{S}$ (Here $S$ denotes the Schwartz class of functions) and $sup_{k in mathbb{Z}}(2^{k}||P_{k}f||_{L^2}) < infty$, then $f in Z_C$

I have tried investigating properties of Zygmund class of functions, but I made almost no progress…any hint/idea?