Jump to content
Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.
Posted 07 January 2013 - 05:43 PM
You don't need to translate to the player position. Use a special camera that is located at the origin and draw the 1st person model there too.
Most games also clear the z buffer before drawing the hand model and set the projection matrix near/far values very close to the camera to get more precision and prevent the gun from sticking into walls and objects.
You can even experiment with the projection's fov, sometimes it looks good to choose a different fov for the 1st person model.
Posted 07 January 2013 - 08:55 PM
You could do it as you have described, or just set the view matrix to be identity and render the model only in object space. That would position it relative to the camera, without doing the extra translation (they will likely be equal in performance, so it really is just your preference).
Have you tried doing one way or the other yet, or are you just getting ready to try it out? I would suggest trying both ways and see how they work in your engine, and then also see how flexible your engine is - can you support doing it either way? Is it a data driven solution, or is it all hard coded? I always try to push myself to make things configurable enough that solutions can be added later on, allowing for easy extensibility as you go!
Jason Zink :: DirectX MVP
Direct3D 11 engine on CodePlex: Hieroglyph 3
Direct3D Books: Practical Rendering and Computation with Direct3D 11, Programming Vertex, Geometry, and Pixel Shaders
Articles: Dual-Paraboloid Mapping Article :: Parallax Occlusion Mapping Article (original):: Fast Silhouettes Article
Games: Lunar Rift
GameDev.net™, the GameDev.net logo, and GDNet™ are trademarks of GameDev.net, LLC.