• 0 Posts
  • 53 Comments
Joined 5 months ago
cake
Cake day: March 12th, 2025

help-circle




  • bampop@lemmy.worldto196@lemmy.blahaj.zoneRule
    link
    fedilink
    English
    arrow-up
    18
    ·
    edit-2
    1 month ago

    Let’s say I’m writing a computer game, which features a robot holding a gun. I have a list of vectors representing the 3D model of the gun, but how do I know where to draw those points on screen? To transform the gun model to screen coordinates I just need to do this simple process:

    1. scale the gun model so it’s the right size for the game
    2. rotate and translate it so it will be in the same coordinate space as the robot’s hand, where the wrist joint is at (0,0,0)
    3. rotate again to reflect the current angle of the wrist, now it aligns with the forearm
    4. translate by forearm length so the elbow joint is at (0,0,0)
    5. rotate again to reflect elbow angle, now it aligns with upper arm
    6. translate by upper arm length so the shoulder joint is at (0,0,0)
    7. rotate again to reflect shoulder angle, now it aligns with body
    8. translate by shoulder position so body center of rotation is at (0,0,0)
    9. OK let’s just assume we’re defining body position directly, so we’ll apply another rotation and translation to reflect the robot’s position, now our coordinates are in “game space”
    10. of course the “camera” through which we view the action might be moving as well, so we’ll need another rotation and translation so transform the coordinates into “camera space”
    11. we need to apply 3D perspective to get the on-screen coordinates. If the z axis of camera space were in the direction we are looking, with 0 at the view point, you could get x and y screen coordinates by dividing camera space coordinates by z, and scaling the result as needed to fit the screen

    Oh dear, that wasn’t so simple. Are we going to do this for every vector in the gun model? Well, as it turns out, the first 10 steps are all linear transformations that can be represented by a matrix. And we can encapsulate the entire process by multiplying those matrices together, so instead of 10 operations, we can combine it into one, a single matrix which will take us all the way from the gun model to a position in camera space. So we just need to pass the graphics card some instructions to tell it what to do, plus the list of vectors for the gun model, plus the combined matrix for transforming them.

    There’s many other cool things to do with matrices in graphics programming but that’s a starting point.





  • bampop@lemmy.worldtoFunny@sh.itjust.worksLife at 40
    link
    fedilink
    arrow-up
    2
    ·
    edit-2
    2 months ago

    For me I found casual or occasional smoking could too easily become “just one more”. I hated the fact that it had a grip over me but I needed a more definitive reason to quit. What worked for me was when my sister told me she was going to have a baby. I didn’t want that kid to have smoking adults in her life. Which meant I had to quit, and hopefully that would help my sister to quit as well. I don’t know if my actions made any difference but she did quit. Doing it for a kid was a powerful motivator for me. When she gave me the news, I put down the phone, tossed my remaining cigarettes in the trash and left it at that. Not even one last one. I knew I had the motivation I was waiting for and that was the end of it.

    I guess everybody has their own way that works for them and you just need to find what that is.




  • Confession: I actually watched the ESC this year despite my moral qualms. Sorry.

    But it really struck me how fake it has become. The “performances” in the final were just recordings of the ones shown in the qualifying rounds (probably weren’t even live then). Words said by performers at the end of the song were chopped off. At the end when they showed clips of the performances with the performers in the “green room” reacting to them, pretty sure these were the same shots they used in the qualifying rounds. No continuous shots connecting the presenters to the performances. Every element of the show compartmentalized and combined using stock shots to fill in the gaps. Doesn’t even resemble a live show. I wonder how much of this is required to ensure that nobody says anything about Israel, or shows or wears any unauthorised symbols, and that any undesired crowd noise can be edited (sounded like that happened when Israel phone vote was announced). Fucking weird.

    Of course the ludicrously high phone vote for Israel was expected. But what is the deal with Switzerland’s entry getting zero phone votes? That was really strange. Maybe the organizers agreed to donate all Switzerland’s phone votes to Israel.

    Anyway, the whole thing is so fake and fucked up, I won’t be watching again. I feel sorry for the performers and the countries who try to contribute something good, it’s just wasted on Eurovision.