DGSL (Directed Graph Shader Language) editor in Visual Studio 2012 - hlsl

I'm using the DGSL (Directed Graph Shader Language) editor in VS 2012 to create shader that I wish to export to HLSL and then load in MAYA
http://msdn.microsoft.com/en-us/library/hh315733.aspx
At this stage I cannot for the life of me figure out to create custom naming for inputs and also expose variables so I can make connections in maya..
There is little or no documentation on this feature of VS.. has anyone had any experience with this editor to create shaders for programs like maya or max?

Related

Tessellation shaders not working with UWP DirectX 11 on Xbox Series X|S

I ported a DirectX 11 application to UWP to deploy it on Xbox Series X|S and hardware tessellation shaders are not working when running the app on Xbox (tested on retail Xbox Series X and Series S in devmode). The rendered geometry doesn't show up in the viewport but no errors are thrown. Running the same app locally on my PC renders the tessellated geometry without any issues. After reading through this blogpost and the follow-up, I made sure my application is running in game mode and a DirectX 11 Feature Level 11.0 context is created (creating a 10.1 context procudes errors when trying to use tessellation primtives as expected). Rendering statistics from the app suggest that there are vertex shader invokes but no hull shader invokes afterwards and hull shader invokes, but not domain shader invokes afterwards.
Because I assumed there to be some sort of subtle bug in the tessellation implementation of my app, I next tried the SimpleBezierUWP sample app from Microsoft. The result is the same: On PC, it renders just fine but when running on Xbox, the geometry is missing. This applies to both the DX11 and DX12 version of that sample app.
To recreate this bug just download the SimpleBezierUWP sample, build it and deploy it to a retail Xbox Series X or S in devmode.
So has anyone successfully used tessellation shaders in an UWP application on Xbox Series X or S? Is it not supported after all, even if Direct X Feature Level 11.0 is? Or are there special requirements for writing hull and domain shaders for this specific hardware that I was not able to find out about from publicly available source?
Thanks!

DirectX11 DirectXTK need a CSO file for testing

I am piecing together information on how to import models following a bunch of different tutorials, because there isn't a resource that explains how to do this in a simple way.
So far I can import and display my model, but it's shown in the Gouraud shader if I use DirectX::BasicEffect
This makes my mechanical models appear very badly shaded, because they were exported from Solidworks.
I want to try switching to DirectX::DGSLEffect , but I need to load a shader, and I don't have any shaders to test.
Can anyone point me to where I can find a pre-compiled *.cso shader?
I need one that can preferably do flat shading, but I can settle for any, just to test that my application is working right.
I know that I need to compile a shader myself from .hlsl files, but this is too many steps and I just need something that works right now before I can continue further,
Thank you,
-D
I want to point out that I am not making a video game, but a mechanical visualization tool, and I do not need to know how to write shaders or do any advanced features of DirectX at this time. Please do not recommend reading books as that would be counter-productive to the amount of time I can work on this project. I would like to learn more in the future, but not for this application. Thanks,
EDIT:
It looks like I can compile with the following line, but now I cant find any HLSL files.
ID3DBlob* PS_Buffer;
D3DCompileFromFile(L"PixelSHader.hlsl", 0, 0, "main", "ps_5_0", 0, 0, &PS_Buffer, 0);
CSO files are complied HLSL shaders. Visual Studio can generate them from HLSL files, and the DGSL pipeline can create pixel shaders using a visual language.
The DirectX Tool Kit BasicEffect system is quite flexible, so you can override in code the parameters or provide your own material information. See the wiki for more information.
If you want to use the Visual Studio content pipeline, you should look at Working with 3-D Assets for Games and Apps for the details. Visual Studio converts WaveFront obj or Autodesk fbx files and can include DGSL materials as part of that pipeline. The DirectX Tool Kit DGSLEffect provides a built-in vertex shader that will work with the DGSL shader designer output.
If you'd like an example of using the DGSLEffect pipeline, look at the tutorial Creating custom shaders with DGSL.

How do I render all actors in a single area using DirectX 11 in C++ efficiently and easily?

I have searched SO and have not found one relating to the very basics, explaining step by step. We are in need of this.
Assuming that I am using only the DirectX SDK supplied by microsoft.
Also assuming that I have .fbx and .3ds models already made and in the working directory which are generic, monochrome, shapes (cube, sphere, pyramid, etc.).
Please also condense the rendering process into a function that uses the directX functions (As in, can be compiled), as an example:
//the following is a suggestion, not a guideline for those who
//want to get into 3D programming.
vector<DX3DModel>modelsToBeRendered;
void bufferFrame(vector<DX3DModel>models){
while(1){
/* something something vertexes, lets say DX3DModel only contains vertexes
and a string as a file link
(Rendering code would make it very
messy in the question, but please include it in the answer.) */
//render models.end(); here
models.pop_back();
}
}
Using a method similar to what I have above, how would I (safely) render all other actors in a single "area" while still being able to manipulate vertexes at will?
(Area is a (AxBx1) model which we will call field.fbx. This is a boundary for all actors to exist on)
The Direct3D 11 API, much like the OpenGL API, is a low-level rendering API that works in terms of resources and drawing operations on constructs containing points, lines, and triangles. It's not a high-level API that can directly load or render an model file from a 3D editor, nor does it inherently have a material/effects system.
If you are new to DirectX 11, you should consider using the DirectX Tool Kit as a good starting-point. You can't directly render from a 3DS or FBX model, but you can use either the built-in Visual Studio content pipeline for converting to a CMO or use the Samples Content Exporter to convert to SDKMESH, both of which can be loaded by DirectX Tool Kit.
Using the DirectX Tool Kit, you'd be able to use the Model class and get something basically like what you propose. See the DirectX Tool Kit tutorial, particularly the lesson Rendering a model.
For Direct3D 11 development, you should strongly consider not using the legacy DirectX SDK as it's deprecated. If you are using VS 2012 or later, you don't need it. See Where is the DirectX SDK (2015 Edition)? and The Zombie DirectX SDK.

Visual Studio c++ 2012 and shader Questions

I'm using VS c++ 2012 and Directx 10 and have encountered some problems.
I found that in vs 2012, I can add .hlsl files directly and can choose which type of shader to create, such as vertex or pixel shader. But I can only add one type of shader at a time, unlike previously in vs 2010, I could just create and load a .fx file that contains both vertex and pixel shader and the technique. With present situation, I can add separate .hlsl files but I have no idea where to put the Technique to. Also I noticed that the 2012 version cannot find D3D10CreateEffectFromFile. How does Shader work in vs 2012 version? If I just want to use a vertex shader and one pixel shader, how can I do that?
It is a long time that i don't work with directX, but i think it doesn't depend on visual studio version and even also directX. in DX10 and also DX11 you can create a fx file that contain different types of shaders along with a technique.(but in directx 11 you must include effect class in your project) but in DX11 you can also use hlsl files that i think it can contain all types of shaders, just in compiling you send name and type of your specific shader to DX11 functions and i think in DX11 this approach is prefered way.
For D3D10CreateEffectFromFile i have no idea but i think you don't include headers correctly. again i say it is long time that i don't work with DX and my answer can be incorrect.

VS2012 using 3D models dilemma

I'm having problems understanding the the usage of VS2012's 3D features in a project. I'm current building a 3D project using DirectX (Direct3D) and want display a simple 3D object (teapot) for starters. I understand the usage of the shadergraph which is of great help, but when it comes to loading an FBX model, is there an alternative to using the Autodesk FBX SDK built in or am I just stuck with it (FBXSDK)?
Generally, is there anything in VS2012 for C++ similar in nature to how XNA uses it's content pipeline to simplify loading and working with models?
You will definitely need to manage the translation from the format of your model files to the typical D3D mesh/meshpart arrangement. You can get sometimes find models in the old .x format, which corresponds to a Direct3D model. This page has some good reference for loading .x files and also links to exporters for maya and max.
OTOH If your source data is in fbx, use the fbx sdk; it's just simpler than any alternative way to get fbx data. You'll need some library for importing 3d models and although they're all limited in different ways FBX has the advantage of being supported by the widest variety of DCC apps. There are text and binary versions of the FBX format, so if you're interested in manual debugging you can use the text based version to make it easier to crosscheck your results. This sample discusses using the FBX SDK with DirectX 11 - although it is in the context of vs 2010, there may be issues moving to VS 2012.
If you go with another intermediate format you should look for one supported by the 3d tool you'll be using or the model vendor you are buying from. Collada is the most widely available interchange format, and it's based on XML so you could probably implement your own loader -- however it's also notorious for complexity and inconsistent standards so I'd avoid it unless you have a compelling reason or a big trove f Collada format files.
If your needs are very simple and don't include animation, the OBJ format is widely available and easy to implement on your own -- however it does not support animation.
is there anything in VS2012 for C++ similar in nature to how XNA uses
it's content pipeline
As far as I know, there is no such thing. You will need your own solution, as always in native C++ world =). Probably, you can make use some of the modern rendering engines: Unity, OGRE, Irrlicht, Torque, etc.
when it comes to loading an FBX model, is there an alternative to
using the Autodesk FBX SDK built in or am I just stuck with it
(FBXSDK)
As far as I know, FBX is a closed proprietary format, so you stick with FBX SDK.
Another ways (from gamedev view)
FBX format is a terribly complicated and multifunctional. Typically, you don't need FBX to draw teapot. You don't even need FBX to create a good game.
to just draw teapot you, probably, better take another simple (or not so simple) format, such as .obj, .dae or .3ds. You can load it using 3rd party library, such as assimp (which is just few lines of code) or roll out your own loader (which is not so hard either).
to draw some meaningful interactive "teapots world" you will also need to wrap them into some kind of scene: scenegraph is a common solution.
mid-size game labels typically crate their own format, converter and loader for it:
artists create models in their favorite 3D editor
then they convert it using converter: convert to custom binary .mesh format. This can be done via plugin for 3D editor or in small standalone app
in C++ app, programmers just load .mesh, deserialize to structs and classes and use it.
serious game labels develop their own content pipelines: it can include multiple custom formats (static mesh, animated mesh, etc.), loaders (to load and stream content into app), 3ds max/Maya/Blender plugins, visual scene/level editors (to make artists happy). All content is created and managed by artists, so programmers don't need any integration of content to their IDEs.
Visual studio 2012 actually has it's own model processor now.
You can add different meshes to your project(I think that it natively supports .dae, .fbx, and .obj) and it'll spit out a ".cmo" model that's simple to parse.
The directX Toolkit also has pretty good support for loading the format, so if you're already using the DXTK, then I recommend seeing if the model loader meets your requirements.