Forum Discussion
kuocheng
12 years agoHonored Guest
load .x using c++
Hello guys,
I am writing a program totally in c++ where there is a virtual hospital and doctors can do surgery on patients' body. I just started my project and I am trying to modify the "OculusRoomTiny" code to load a .x file of human body. In the original code, it uses PopulateRoomScene function which uses scene->World.Add() function. The function in directX to load a .X file is D3DLoadMeshFromX. My question is: do I have to use scene->World.Add() to show the image on the screen or can I use DrawSubset?
Thanks,
Kuo
I am writing a program totally in c++ where there is a virtual hospital and doctors can do surgery on patients' body. I just started my project and I am trying to modify the "OculusRoomTiny" code to load a .x file of human body. In the original code, it uses PopulateRoomScene function which uses scene->World.Add() function. The function in directX to load a .X file is D3DLoadMeshFromX. My question is: do I have to use scene->World.Add() to show the image on the screen or can I use DrawSubset?
Thanks,
Kuo
4 Replies
- cyberealityGrand ChampionHonestly, you should not be using the C++ samples as a base for a game or application. While this may be good for a quick test, it won't really be robust enough to finish a full game. There are a number of engines and libraries that can be used, Unity and Unreal 4 are the top choices with the best Oculus support.
In any case, Microsoft dropped support for the .x files since DirectX 10. Really, you should be using a better format like Fbx for model exchange and then converting to your own internal format. - sthHonored GuestAs Cybereality suggested, using an existing engine might be the better option, depending on your goals.
If you want to go the "custom engine in C++" route however, have a look at https://github.com/assimp/assimp for model loading. - kuochengHonored Guest
"cybereality" wrote:
Honestly, you should not be using the C++ samples as a base for a game or application. While this may be good for a quick test, it won't really be robust enough to finish a full game. There are a number of engines and libraries that can be used, Unity and Unreal 4 are the top choices with the best Oculus support.
In any case, Microsoft dropped support for the .x files since DirectX 10. Really, you should be using a better format like Fbx for model exchange and then converting to your own internal format.
My project is using Oculus to walk around in the hospital and using SoftKinect to detect hand motion. When my hands touch patient's body, there will be deformation on the body. I have tried Unity and with the help of their hand detection example, I could have my hands detected and when I touch the body, the color changes. But that was based on rigid body, not soft body. I know unity is not good at softbody dynamics, the closest thing I can use is probably Cloth, but that not what I want. The reason I use Oculus room example is that's the example they provided on how to integrate Oculus with c++. Do you think I can write some code in Unity so that I can realize the deformation of the body so that I don't have to bother with c++?
Thank you,
Kuo - owenwpExpert ProtegeThe .x format was never intended for use in production anyway, just a sample format to teach programmers how to implement 3D assets. Real game engines use their own custom internal formats almost without exception, and .x was an example of how to do that. This is why the directx sdk now uses a format called ".sdkmesh" to make this more clear.
FBX is probably the best choice if you need features like skinning and animation. It is well supported and well documented.
It is possible to directly modify vertices in Unity, but the physics and logic would all be up to you. If you are only using Unity to draw some polygon soup though, you won't really save much effort over starting from scratch.
Quick Links
- Horizon Developer Support
- Quest User Forums
- Troubleshooting Forum for problems with a game or app
- Quest Support for problems with your device
Other Meta Support
Related Content
- 2 years ago
- 2 years ago
- 11 months ago