Windows Dev Center

Visual Studio 3D Starter Kit

This sample contains the starting point for a basic game for Windows 8.1 and Windows Phone 8.1, a “Starter Kit” which provides support for consuming runtime assets produced by the VS tools. This includes loading and rendering assets (meshes, textures and shaders).

C++ (848.5 KB)
 
 
 
 
 
(26)
22,598 times
Add to favorites
4/2/2014
E-mail Twitter del.icio.us Digg Facebook
Sign in to ask a question


  • First person camera
    1 Posts | Last post July 22, 2015
    • 1. How do I change the camera position to the models point of view?
  • Visual Studio 3D Starter Kit version with DirectX 12
    1 Posts | Last post July 05, 2015
    • Hi Roberto,
      
      Are you planning a new version of the Visual Studio 3D Starter Kit with DirectX 12 (and DirectX 12 bundles)?
      
      Regards,
      
      Daniel
      
  • How to place texture in a code in DirectX
    3 Posts | Last post May 08, 2015
    • I saw your sample where you have texture of a cube (A T type image). I looked you code and I was unable to find how you added your texture dynamically. I have N (may be 3) number of dices where I like to place different side of images on each face. This is all dynamic. I have created a one cube with blender without texture. It looks to me I need only one such cube and place all N (may be 3) number of dices with some mapping of a big image. You have done similar (only one disk hanoi3D). Kindly provide me some type of direction or sample. Your help will be very much appreciated. 
    • The texture is adding in file VSD3DStarter.h in method Mesh::Load. You call method Mesh::LoadMeshFromFile, it calls Mesh::Load for each mesh in your vector. In Mesh::Load you load Texture for each SubMesh in your Mesh. Texture Name is read from mesh file. I've changed it to allow you use parameter TextureName of Mesh::LoadMeshFromFile method to set texture name.
      //
                          // load textures
                          //
                          for (int t = 0; t < MaxTextures; t++)
                          {
                              //
                              // read name of texture
                              //
                              stringLen = 0;
                              fread(&stringLen, sizeof(stringLen), 1, fp);
                              if (stringLen > 0)
                              {
                                  //
                                  // read the texture name
                                  //
      							// this change in code is made by Dmitry (not Roberto Sonnino)
      							//
      							// even when we don't use texture from file we have to read it name
      							//
      							 
      
      								std::vector<wchar_t> textureFilename(stringLen);
      								fread(&textureFilename[0], sizeof(wchar_t), stringLen, fp);
      								std::wstring sourceFile = &textureFilename[0];
      							
      							if(texturePathLocation!=L"") sourceFile = texturePathLocation;
                                  
                                  
      
                                  //
                                  // get or create texture
                                  //
                                  ID3D11ShaderResourceView* textureResource = graphics.GetOrCreateTexture(sourceFile);
                                  material.Textures[t] = textureResource;
      but if you want to add more then one texture for mesh or change them dynamically you should do that
      
      1 Add textures to your project and MARK THEM AS ImageContentPipeline
      2 In some method changing your textures write those code:
      //You can see it in the next answer
    • 	for (size_t i = 0; i < mesh.size(); i++)
      	{
      		for (size_t j = 0; j < mesh[i]->Materials().size(); j++)
      		{
      			for (size_t t = 0; t < mesh[i]->MaxTextures; t++)
      			{
      				mesh[i]->Materials().operator[](j).Textures[t] = graphics.GetOrCreateTexture(L"TextureName.dds");
      			}
      
      		}
      
      	}
  • Dynamically mapping
    1 Posts | Last post May 04, 2015
    • After compiling the sample I just realized Visual Studio creates DDS file. (_DirectX11StarterKit_C++_StarterKit_StarterKit.Shared_Assets_CubeUVImage.png.dds)  It looks that it is UV Map file, but I am not sure how we can make connection between this file and cube. My problem: I am rolling a 6 face dice where every dice face has a randomly generated latter. I have a file where I have 26 images of alphabets which I will be using, which implies somehow I want to map to a cube dynamically. I have not a clue how this can be done. I am requesting a sample where we could map an image file to 3D object. Any help will be very much appreciated. 
  • Problem using 3d Starter Kit for Windows 8.1
    1 Posts | Last post April 13, 2015
    • Hello. Although Starter Kit for Windows 8.0 works fine on my computer,I have a problem using Starter Kit for Windows 8.1. Even when I use Starter Kit for Windows 8.0, I can't make my own meshes or change meshes from Starter Kit. I add new mesh(.fbx) and some objects on it but when I try to compile it into .cmo I have an error "MeshContentTask". Here is error text:
      Error	1	error MSB4018: System.Exception: VsGraphics failed, error code 4317 returned.
         in Microsoft.VisualStudio.Graphics.Api.VsgTask.Execute()
         in Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
         in Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__20.MoveNext()	C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Extensions\Microsoft\VsGraphics\MeshContentTask.targets	75	5	StarterKit
      
      Then when I open .cmo file in NotePad I only see "Cube_Node" in it, so compiled mesh file is empty. When I close Visual Studio and open it again I can run the app, but it isn't any objects on the screen(except XAML graphics). But all original meshes from StarterKit, DiceRoller and Hanoi3D are rendering fine.
      
      But I can't use Starter Kit for Windows 8.1 at all. Without any changes, project runs but don't render any graphics except XAML. But when I debug the app and watch value of m_meshModels I see that meshes are loaded. Thanks for any help.
      
      P.S.
      I'm one hundred percent sure that I have Windows 8.1 and Visual Studio Update 4 on my computer.
  • fbx model update
    1 Posts | Last post February 23, 2015
    • The error i get is actualy an exception:
      
       	KERNELBASE.DLL!77948500()	Unknown
       	COMBASE.DLL!7780ff4c()	Unknown
       	TWINAPI.APPCORE.DLL!75950e06()	Unknown
       	TWINAPI.APPCORE.DLL!7595187a()	Unknown
       	COMBASE.DLL!77812900()	Unknown
       	COMBASE.DLL!77812998()	Unknown
       	App3dPlayground.WindowsPhone.exe!Platform::Details::ReportUnhandledError(Platform::Exception ^ ex) Line 135	C++
       	[External Code]	
      >	App3dPlayground.WindowsPhone.exe!VSD3DStarter::Mesh::ReadAsync(Windows::Storage::Streams::DataReader ^ reader, VSD3DStarter::Graphics & graphics, const std::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t> > & shaderPathLocation, const std::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t> > & texturePathLocation) Line 1881	C++
       	App3dPlayground.WindowsPhone.exe!VSD3DStarter::Mesh::LoadFromFileAsync::__l16::Concurrency::task<void> <lambda>(Windows::Storage::Streams::IBuffer ^)::__l27::<lambda>() Line 1511	C++
       	[External Code]	
       	App3dPlayground.WindowsPhone.exe!Concurrency::extras::details::iterative_task_impl(Concurrency::task_completion_event<void> finished, std::function<Concurrency::task<bool> __cdecl(void)> body, Concurrency::cancellation_token ct) Line 32	C++
       	App3dPlayground.WindowsPhone.exe!Concurrency::extras::create_iterative_task::__l5::<lambda>() Line 61	C++
       	[External Code]	
       	[Async Call]	
       	App3dPlayground.WindowsPhone.exe!Concurrency::extras::create_iterative_task(std::function<Concurrency::task<bool> __cdecl(void)> body, Concurrency::cancellation_token ct) Line 66	C++
       	App3dPlayground.WindowsPhone.exe!VSD3DStarter::Mesh::LoadFromFileAsync::__l16::<lambda>(Windows::Storage::Streams::IBuffer ^ buffer) Line 1508	C++
       	[External Code]	
      
  • fbx model
    1 Posts | Last post February 23, 2015
    • Hello,
      I have a problem with a fbx model. I created one in Visual Studio and imported it in 3d Starter Kit . When i debug it on local machine or emulator (both in Win32) it works. But when i try it on device(ARM) it does not work anymore. 
      The fbx models that are in tutorial are working. I scaled teapot.fbx and saved it again and still worked. 
      Are there any special that i have to set to 3d models to have them working in ARM platform ?
  • 3D Starter Kit with Drawing Surface
    1 Posts | Last post July 22, 2014
    • Hi Roberto,
      
      I lost all my hope and faith to rework your Starter Kit with DrawingSurface instead of DrawingSurfaceBackgroundGrid :)
      Maybe you can post a sample for this case too?
      No DX errors in output and no models are displayed, just wonderful CornflowerBlue background :)
  • About .CMO files.
    2 Posts | Last post July 21, 2014
    • Hi Roberto.
      
      I am wondering... Is there a way to batch convert 3d assets from fbx to cmo other than adding them to the solution? If not then maybe a way to access the mesh content pipeline API to convert FBX files at run-time?. 
      
      I mean i have tons of assets that i would like to convert to cmo and i cant add them to the project solution due to the build time delay... So i thought it would be cool if i can build a separate project that will convert all the assets for me.
      
      If none of it is possible then is there an FBX -> CMO Converter.
    • Hi Adel-G-Eibesh,
      
      You can definitely create a new project to do your conversions. Any C++ project will work - all you need is to set the build extensions correctly (see http://msdn.microsoft.com/en-us/library/hh972446.aspx).
      
      You can create a separate project (or even a solution) to do those conversions without repeating every build.
      
      Hope it works for you!
      Roberto
  • Not working on the device
    2 Posts | Last post July 21, 2014
    • Hello,
      
      I'm working on an animation using planes and I am able to see the meshes, with the textures and the animations working, on the Windows Phone emulators, but not on the device (Nokia Lumia 520). It also doesn't work on the emulators when set to "release". 
      Could you help me please?
      Thanks!
    • Hi marifps,
      
      Unfortunately there isn't much I can do to help without more information.
      I'd recommend to check out the Debug output to see if there are any DirectX errors being reported there. Are there any useful messages?
      
      Thanks!
      Roberto
1 - 10 of 57 Items