Homebrew How to move the render camera with libctru?

displayname

New Member
OP
Newbie
Joined
Dec 28, 2020
Messages
3
Trophies
0
Age
23
XP
44
Country
United States
Hi all! This is my first post here, and although this may be a stupid question, I haven't been able to find anything about it and it's really bugging me. I want to make a 3DS game with a 3D environment, and the graphics examples in devkitpro have been very helpful for learning the basics. But I've been stumped with something I thought would be pretty simple; how does one move the camera that renders the scene?

Lets take the lenny example scene in graphics/gpu/lenny as an example, suppose I want to move the camera on the X, Y, or Z axis to look at the lenny model in all of it's glory. How does one do this? I've looked through the libctru documentation, and although I've relatively experienced in C/C++ (it being the first language I learned), it's all rather foreign to me. Again, sorry if this is a stupid question, I've just been stumped with it. Thanks! :D
 

elhobbs

Well-Known Member
Member
Joined
Jul 28, 2008
Messages
1,044
Trophies
1
XP
3,029
Country
United States
The shader in the Lenny example uses the traditional model view and projection matrixes used by 3D apis. You will need to translate and rotate the model view matrix to change the view. The matrix is used by the shader to translate object coordinates to view coordinates. If you are unfamiliar with this then I recommend taking a look at similar procedures with OpenGL.
 
  • Like
Reactions: displayname

displayname

New Member
OP
Newbie
Joined
Dec 28, 2020
Messages
3
Trophies
0
Age
23
XP
44
Country
United States
The shader in the Lenny example uses the traditional model view and projection matrixes used by 3D apis. You will need to translate and rotate the model view matrix to change the view. The matrix is used by the shader to translate object coordinates to view coordinates. If you are unfamiliar with this then I recommend taking a look at similar procedures with OpenGL.

Drats, I knew I should have familiarized myself with openGL before diving head first into something like this lol.

In any case, if it's no trouble, is there a quick explanation on how to change the model view matrix in real time with libctru? (For instance, on press A button move on the X axis, etc etc)
 

elhobbs

Well-Known Member
Member
Joined
Jul 28, 2008
Messages
1,044
Trophies
1
XP
3,029
Country
United States
Drats, I knew I should have familiarized myself with openGL before diving head first into something like this lol.

In any case, if it's no trouble, is there a quick explanation on how to change the model view matrix in real time with libctru? (For instance, on press A button move on the X axis, etc etc)
Take a look at the wide_mode_3d gpu example. It looks like it can rotate a bit.
The best advice is really just give it a go yourself - and reserve questions for when you have something specific to ask after you have tried something yourself.
 
  • Like
Reactions: displayname

displayname

New Member
OP
Newbie
Joined
Dec 28, 2020
Messages
3
Trophies
0
Age
23
XP
44
Country
United States
Take a look at the wide_mode_3d gpu example. It looks like it can rotate a bit.
The best advice is really just give it a go yourself - and reserve questions for when you have something specific to ask after you have tried something yourself.

Fair enough, thanks for the pointers! Will be taking a look at the provided example :D
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • K3Nv2 @ K3Nv2:
    I guess Ancientboi would be Peter
    +2
  • SylverReZ @ SylverReZ:
    Loooooool :rofl2:
  • SylverReZ @ SylverReZ:
    So true
  • BigOnYa @ BigOnYa:
    @K3Nv2 Snow Day is pretty fun. My only bitch would be the camera controls, when you move around, say down, you have to move the right stick left or right to get camera to turn and get your view, other than that I like it so far.
  • K3Nv2 @ K3Nv2:
    From what people say pvp isn't even worth it
  • BigOnYa @ BigOnYa:
    I just been playing offline, and they give you a few bots here n there on your team to help battle. I don't think it's as funny as the other games tho, more battle oriented than humor, which kinda sucks, but I'm still early in it
  • Xdqwerty @ Xdqwerty:
    @BigOnYa, doesnt the game have a campaign mode?
  • BigOnYa @ BigOnYa:
    Yea, and co-op, but you can also start a pvp session and battle just with friends. You get special skill cards (powers) the more you play. And higher value cards, but you can only enable so many cards at a time.
  • K3Nv2 @ K3Nv2:
    If you can find enough for it
  • BigOnYa @ BigOnYa:
    Toilet paper is considered the money, you collect and buy stuff with TP, kinda funny. Graphics are def better than the other games tho, I think they used Unity 5 engine.
  • Psionic Roshambo @ Psionic Roshambo:
    Look if I zoom in enough I can see the herpes!!!
    +1
  • BigOnYa @ BigOnYa:
    In fact I'm gonna go make a drink, roll a fatty n play some, good night to all!
    +2
  • Xdqwerty @ Xdqwerty:
    I bet most people at the time still watched it in black and white
  • SylverReZ @ SylverReZ:
    @Xdqwerty, Many of them did before colour television was common.
  • SylverReZ @ SylverReZ:
    Likely because black and white TV was in-expensive.
    +1
  • K3Nv2 @ K3Nv2:
    It certainly wasn't inexpensive it cost the same as a new car back then
  • K3Nv2 @ K3Nv2:
    How much did a 1965 color TV cost?

    For example, a 21-inch (diagonal) GE color television in 1965 had an advertised price of $499, which is equal to $4,724 in today's dollars, according to the federal government's inflation calculator.
  • Xdqwerty @ Xdqwerty:
    @K3Nv2, take into consideration how economy was back then
  • K3Nv2 @ K3Nv2:
    Yeah that's why they listed inflation rates
  • Xdqwerty @ Xdqwerty:
    Sorry didnt read that part
  • BakerMan @ BakerMan:
    @LeoTCK don't worry i knew he was joking
    +1
    BakerMan @ BakerMan: @LeoTCK don't worry i knew he was joking +1