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)
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)
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.
@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.
‎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…
@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.
@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.
@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?
@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 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.