Two related questions for computer graphics people:

1. is it true that ray/line/whatever intersection tests are common in interviews?

2. how common are questions of this nature, where you have equations memorized?🤔

(boosts appreciated pls)

@ruba I never needed to recite stuff like this from memory. It's usually enough to know the edge cases that you'll run into.

@ruba

1. yes, super common

2. they're not really about memorizing equations, more about showing you have a working grasp of 3d maths and basic algebraic operations - if you're comfortable with vectors, dot product, cross product you can likely get to the answer, interviewers are looking to hear your thought process

@im @ruba yeah, basically this. In computer graphics you are kinda expected to know what vectors and especially dot products among them are. Since like 90% of all graphics is dot products, if you squint :)

And if you *really* know what dot products are, then various intersection/distance things you can derive (slowly) out of that without having to "memorize" any of them.

@im @ruba ...that said, last time I had a traditional job interview was almost 20 years ago (which I failed, yay!). Whenever I did interviews for gfx related things at Unity, I did not ask for "how do you calc intersection of this & that" though.
@aras @im iiiiiiinteresting! I (of course) see how you need to demonstrate that you have a solid and practical understanding how the dot product, but whenever I see geometric tests presented like this: https://gamemath.com/book/geomtests.html especially as they get more complicated, I just can't retain that much detail :|
Geometric Tests - 3D Math Primer for Graphics and Game Development

@aras @im @ruba yeah. DotProduct math is a “core competency”. Also true for gameplay programming.

RaySphere should be trivial. More complex should be derivable in an interview context. Especially with interviewer hints.

@forrestthewoods I'm wondering if there's another way to demonstrate it than to write out intersection tests in an interview 🤔 it's a tense situation and looking at the steps: https://gamemath.com/book/geomtests.html while I think I can reason through them sitting at home, I think they'd fly out the window in an interview
Geometric Tests - 3D Math Primer for Graphics and Game Development

@ruba interviews suck. no one knows how to do them well. and yet it’s all anyone does. But that’s a whole other story! :(

@forrestthewoods @aras @im @ruba The knowledge (or lack thereof) of the dot product is a running joke in certain gamedev circles. It started with someone who couldn't fathom that you didn't know what it was or how to use it.

Well, I don't know the formula(s) off the top of my head, so my firm stance is that I don't "know" dot product. I just have not had the need to use it in the last few years.

@forrestthewoods @aras @im @ruba Ray-sphere intersections are not something I would be able to do. I can see how to do it geometrically in 2D, but implementing it or extending it to 3D is black magic to me.

Maybe I'm not a good graphics programmer after all?

Well, I only have an MSc in graphics programming, and I have shipped games that use dot product to compute most of the game logic, and I have written some of the fastest texture compressors there are.

@forrestthewoods @aras @im @ruba But I don't know some basic mathematical formulas that have been relatively unimportant to me during my 20 years of work.

The important thing is that you can find all the answers to these silly trivia questions with 5 minutes of googling.

@wolfpld @forrestthewoods @im @ruba oh yeah the whole interviewing process is mostly stupid, but it is what it is.

If you can *somehow* make it so that you don't have to do interviewing, that is always way better (i.e. that people would want to hire specifically you). But this advice is same level of usefulness as "if poor don't want to be poor, why don't they become rich", right.

@aras @forrestthewoods @im @ruba The interviews I keep reading about seem to be nothing more than ego trips. I have never been through anything like that.

When I interviewed people, I found that asking simple questions was enough to get a reliable feeling about the candidate.

For example, simply asking what operating systems someone has worked on is a great way to see if they have been exposed to more than one environment, and if they can handle a new set of challenges.

@aras @forrestthewoods @im @ruba Asking how someone would implement the C++11 move semantics in a data structure is an eye-opener. Some people won't be able to tell you how to do it, even if you lead them straight to the solution.

One of the code-writing questions I ask is to write a strlen implementation. It's pretty simple, but people will do things like non-const parameters, or signed return values, and that shows you something.

There is no need to do anything "hard" in an interview.

@wolfpld @forrestthewoods @aras @im @ruba

*I think* it's just checking whether the distance between your step along the ray (the magnitude of the vector between the center of the sphere and the point along the ray) is ever less than the radius of the sphere.

But as usual, writing that out in english vs implementing everything involved "by heart" or "by rote" etc is another matter entirely. And then trying to remember how to do the bits in an interview isn't super fun.

I think all the other stuff you mentioned is much more mathematically involved. And to me personally, it's all the "not math bits" of graphics programming that is super hard these days anyway. But maybe "graphics plumber" is a different job nowadays?

@photex @forrestthewoods @aras @im @ruba That's exactly what I did to manage shot vs. enemy collisions in Monster Shooter (https://apps.apple.com/us/app/monster-shooter-2/id623241721). Calculate the square of the distance, segment the space with a quad tree, and it's super fast. If you have a rapid mover, like a railgun, just subdivide the steps.

Then another developer came along and decided that this was a shitty solution and algorithms should be used and it will be much better and more extensible that way.

‎Monster Shooter 2

‎In Monster Shooter, the 10 million times-downloaded smash hit, DumDum rescued his beloved kitty from the clutches of its octoped abductors and everything was peachy…for a while. Alas, those pesky extraterrestrials are back in Monster Shooter 2 -- and this time, the entire planet is in danger!, inclu…

App Store

@photex @forrestthewoods @aras @im @ruba So what ended up shipping was a full ray trace over the entire game map that returned a complete list of colliders, even if they were three screens away and the projectile only moved 5 px or something like that.

Some features were impossible to implement with this approach because it was obviously slow.

I reversed it in the second game, and now I could add things like the lightning gun going around world obstacles.

@photex @forrestthewoods @aras @im @ruba All the plumbing you have to do is super exhausting, that's for sure. And most of the time you don't get much in return.

For example, yesterday I wanted to add call stack printouts to my program when a Vulkan validation layer reports an error.

@photex @forrestthewoods @aras @im @ruba I spent what felt like an hour trying to figure out why the libbacktrace code would not compile. It turned out that I needed to define _GNU_SOURCE in a very specific place in the code, because of the way the system headers use it. Of course, I didn't know that, so I just looked at the compiler errors, the man pages, the libbacktrace code, and the actual define, right there in the editor. But it was in the wrong place.
@photex @forrestthewoods @aras @im @ruba When I finally figured it out, I also made the printout much more readable, and it was a very pleasant experience to actually be able to do something tangible with it.

@wolfpld @photex @aras @im @ruba the only sure fire way to hire is to hire people you’ve previously worked with. This is, uh, problematic in a lot of ways. But it works!

I’m not sure that “implement move semantics for a container” is any more or less “trivia” than some DotProduct questions. Although maybe dot product is more relevant to 3D gameplay programmers than graphics programmers! I dunno.

@forrestthewoods @photex @aras @im @ruba The answer I'm looking for is "you use the data pointer from the old object in the new one". I'm not interested in any kind of implementation or anything like that. Some people are unable to give this answer, even when I lead them directly by asking how a vector works, how you store the data, etc.
@forrestthewoods @aras @im @ruba After being in the games industry for over 49 years and working wirh all sorts of people, my experience has been that knowing WHAT a dot product is and HOW to use a dot product is infinitely more valuable than memorizing the math behind it.
There are a million places to find the math/code online but only experience makes you understand how it can be used.

@jakesimpson @aras @im @ruba exactly. What better way to find out if someone can use it that to ask a small question that uses it?

What is a dot product?
What are some things it is useful for?
How would return true or false if a ray is intersecting a sphere?
How would you calculate the intersection point?

Seems like a reasonable sequence to me?

@forrestthewoods @aras @im @ruba right? But what I’m getting at is that for some people, if you can’t write the math of what generates a dot product on a white board, from memory, they’ll fail you there and then.
Thats where I have issues.
@jakesimpson @aras @im @ruba oh sure. Lots of interviewers love to fail people for all kinds of dumb little reasons.
@im @ruba You shouldn't have to memorize much. The main thing about the quadratic solution equation is not knowing what it is - you can look that up on wikipedia - it's knowing that you need to look up the section on catastrophic cancellation: https://en.wikipedia.org/wiki/Quadratic_equation#Avoiding_loss_of_significance
Quadratic equation - Wikipedia

@TomF see, that's what i'd like to focus on, but I worry I'll just be asked "intersect an AABB and a plane" and knowing my memory, I'll come up blank
@ruba OK, so what? So do all your fellow applicants. How do you cope with "I can't remember for shit"? That's what matters.
@TomF be charming and distract with good jokes :D but in seriousness, that's why I asked :) for preparation and such. also, the memory aspect has been getting noticeably *a lot* worse for me, don't know if it's long covid or what, so I'm a bit worried!
@TomF I also initially asked because I saw an old post somewhere saying this is how graphics interviews go and was wondering if that advice still stands
@ruba You can't pretend to be who you aren't. Even if you could, you'd get hired and then fired in a few months. What you can do is use what you do best to figure out coping strategies for what you do worst.
@TomF that's good advice, thanks Tom :)

@ruba @TomF excellent advice from Tom. To add to that: it's the norm that you don't know all answers, not the exception. The best interviewers know that you are most likely very nervous and they currently wield incredible power over your future.

For the line-intersection thing: as an interviewer, I'd be perfectly happy if you start by drawing out lines, consider different cases, walk me through your thinking, tell me what to consider for the implementation. (I'm not a graphics programmer!)

@ruba it depends on the studio I think. Mine doesn't, but studios with a more dated hiring philosophy might try to grill you on stuff like that. In my experience, the content of a job description is usually a pretty good hint for what they're going to ask you about in an interview and what you should review beforehand.
@aeva @ruba I suspect it'll depend on the studio, yes. We don't ask that kind of questions, at least

@ruba in an interview about 10 years ago, they did indeed ask me to to intersect a ray with a sphere. they also asked me to derive the matrix for rotation about a point.

haven’t been asked about crap like that since then though.

@ruba when I was interviewing for graphics driver roles I didn't use to ask this, nor was I asked it when I was interviewed myself, but this might be very different to what gets asked of rendering engine folks