• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
vivek1may

DX12
Draw rectangle Directx 12

4 posts in this topic

Hi I started to study directx12. I don't have any knowledge on prior versions.

I am following this example program HelloWorldTriangle which rendering a triangle. I want to draw a rectangle so,

I changed

Vertex triangleVertices[] =
        {
            { { 0.0f, 0.25f * m_aspectRatio, 0.0f }, { 1.0f, 0.0f, 0.0f, 1.0f } },
            { { 0.25f, -0.25f * m_aspectRatio, 0.0f }, { 0.0f, 1.0f, 0.0f, 1.0f } },
            { { -0.25f, -0.25f * m_aspectRatio, 0.0f }, { 0.0f, 0.0f, 1.0f, 1.0f } }

        };

m_commandList->DrawInstanced(3, 1, 0, 0);

to

Vertex triangleVertices[] =
            {
                { { 0.0f, 0.25f * m_aspectRatio, 0.0f }, { 1.0f, 0.0f, 0.0f, 1.0f } },
                { { 0.25f, -0.25f * m_aspectRatio, 0.0f }, { 0.0f, 1.0f, 0.0f, 1.0f } },
                { { -0.25f, -0.3f * m_aspectRatio, 0.0f }, { 0.0f, 0.0f, 1.0f, 1.0f } },
                { { -0.25f, -0.2f * m_aspectRatio, 0.0f }, { 0.0f, 0.0f, 1.0f, 1.0f } },

            };

    m_commandList->DrawInstanced(4, 1, 0, 0);

But still draws a triangle with different angle .. Please explain what I have to change to get a rectangle.

It will be really helpful for me if you give some links or books to headstart directx12 ..

Thanks in advance ..

Hi I started to study directx12. I don't have any knowledge on prior versions.

I am following this example program HelloWorldTriangle which rendering a triangle. I want to draw a rectangle so,

I changed

Vertex triangleVertices[] =
        {
            { { 0.0f, 0.25f * m_aspectRatio, 0.0f }, { 1.0f, 0.0f, 0.0f, 1.0f } },
            { { 0.25f, -0.25f * m_aspectRatio, 0.0f }, { 0.0f, 1.0f, 0.0f, 1.0f } },
            { { -0.25f, -0.25f * m_aspectRatio, 0.0f }, { 0.0f, 0.0f, 1.0f, 1.0f } }

        };

m_commandList->DrawInstanced(3, 1, 0, 0);

to

Vertex triangleVertices[] =
            {
                { { 0.0f, 0.25f * m_aspectRatio, 0.0f }, { 1.0f, 0.0f, 0.0f, 1.0f } },
                { { 0.25f, -0.25f * m_aspectRatio, 0.0f }, { 0.0f, 1.0f, 0.0f, 1.0f } },
                { { -0.25f, -0.3f * m_aspectRatio, 0.0f }, { 0.0f, 0.0f, 1.0f, 1.0f } },
                { { -0.25f, -0.2f * m_aspectRatio, 0.0f }, { 0.0f, 0.0f, 1.0f, 1.0f } },
1

Share this post


Link to post
Share on other sites

DX12 is intended for high-investment/high-performance programming. It's is alternative to DX11 rather than a replacement. Don't make the mistake of thinking that DX12 will give you better performance out of the box; you have to understand what's going on very well in order to make the kinds of changes required to see any improvement. If you're still at this stage of the game then just use DX11 until you have a strong understanding of the pipeline and process. Otherwise you'll spend a lot of extra time just to end up with a slower program.

2

Share this post


Link to post
Share on other sites

What @Khatharr said is very true not only about DX12, but Vulkan and Metal too. All these APIs exist for exactly same purpose. What's interesting is that indeed, "naive" code written using DX12 and Vulkan will probably be outperformed by equivalent code made with use of an older API. This is because the driver does LOTS of work trying to figure out what you want to do, how you want to do and takes care about parallelism etc. With DX12 you have to take care about it yourself. So it's not only graphics programming experience you need but you need to have knowledge about memory management ( I guess you didn't get yet to the resource transitions, descriptor heaps etc. ), synchronization ( using barriers is actually DIFFICULT even for experienced programmers! ), parallelism ( threading, proper way of distributing your workload, so you're not making a CPU be a bottleneck ).

 

There's one thing everyone who tries to touch those new APIs should know. Before the driver was doing all the work, but now it's YOU who write the driver. If you're ready for that ( and many programmers indeed are! ) then do it, but otherwise get more experienced. Understand what it takes to actually write such "driver-like" code.

 

Again, I don't want to discourage anybody. It's quite opposite. Get there, become DX12/Vulkan developer! Just do it following the right path. It's bit like learning for example physics. You're not going to start from learning about relativity etc. right? :) But once you have basics, understanding more complex topics comes more natural and easier :)

0

Share this post


Link to post
Share on other sites

I feel like there should be more of an emphasis in general on the fact that DirectX 12 and Vulkan are not APIs you want to dive into unless you actually have a need for them, or if you're planning on specifically refining your graphics engine development skills.

 

Starting with D3D12/Vulkan without any exposure to previous APIs just sets you up for a very very bad time with very bad results in the end (as mentioned above). Building a fully featured D3D12 engine which can outperform an established D3D11 engine is a complex task even for seasoned engineers.

1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

  • Similar Content

    • By hiya83
      Hi, I tried searching for this but either I failed or couldn't find anything. I know there's D11/D12 interop and there are extensions for GL/D11 (though not very efficient). I was wondering if there's any Vulkan/D11 or Vulkan/D12 interop?
      Thanks!
    • By VietNN
      Hi everyone,
      I am new to DX12, I download sample project from MSDN and it can run and draw triangles successfully.
      But when I create new project and copy code from MSDN sample (Hello Triangles Project). I do not know why it could not render anything to screen except clearing the screen with blue color.
      Could you have a look at my code to see what problem is... I got stuck here for 2 days.
       
      TestD3D12.7z
    • By piluve
      Hey guys,
      I started working on a port from dx11 to dx12. The first thing, was to setup everything to work with Dx11On12. Right now I've got that done. Basically, the render frame goes as follows:
       
      D3D12Prepare(); // setups the command list and command allocators (as well as basic clear and set render targets) GetWrappedResources(); // Dx11on12 step to adquire resources Render(); // Basically all the Dx11 rendering code etc D3D12End(); // On D3D12Prepare we left the command list opened so we can add aditional // commands, now close and execute it ReleaseWrappedResources(); Flush(); // Flush all the dx11 code Dx12Sync(); // Wait for fence Dx12Present();  
      That setup is working and I changed some commands inside Render() from dx11 to dx12. (Basic stuff like setviewport)
      I want to start porting more stuff inside the Render(), for example, we have a simple method to draw a quad (without vertex or index buffers, we use the vertex_id inside the shader).
      Basically, it should translate to this:
       
      mCmdList->IASetPrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP); mCmdList->DrawInstanced(4, 1, 0, 0); But even that simple piece of code is just not working. I would like to get some advice from someone that has done a similar process (using dx11on12), what are the limitations, things that wont work etc
      My main concern right now, is that if I want to start setting up commands that touch the IA, I would have to also create the PSO, root signatures etc etc.
       
      Thanks.
       
       
       
    • By AxeGuywithanAxe
      So I wanted to ask a question pertaining to rendering thread architecture. I currently know of two main designs.
      One approach is where visibility , drawcall logic, and gpu submission are all done on the rendering thread and render related game data is sent to the rendering thread at the end of the frame. 
      The second approach is where the sole responsibility of the rendering thread is to send gpu commands to the api. Engine abstacted Command Buffers will be generated in parallel or on the game thread, and sent to the rendering thread to be translated into gpu commands.
      I know that Engines such as Unreal Engine use the first approach, while Unity / Source use the second approach , and Cryengine uses a hybrid of both. I wanted to see if anyone could give some advice, I know some of the benefits of both approaches , but wanted to get more incite on the architecture.
    • By nbertoa
      Hi, community.
      BRE is a rendering framework or engine (under development) which purpose is to have a codebase on which develop techniques related to computer graphics and also to apply the stuff I learn about DirectX 12. I just write a series of articles about its architecture, problems, limitations, techniques, passes, scene format, etc.
      Its main page is located at https://nbertoa.wordpress.com/bre/
      You can access the different articles I wrote about it in the following list
      BRE ARCHITECTURE SERIES PART 1 - OVERVIEW
      BRE ARCHITECTURE SERIES PART 2 - MANAGERS
      BRE ARCHITECTURE SERIES PART 3 - HELPERS
      BRE ARCHITECTURE SERIES PART 4 - SCENE FORMAT
      BRE ARCHITECTURE SERIES PART 5 - SCENE GENERATION
      BRE ARCHITECTURE SERIES PART 6 - RENDER MANAGER AND COMMAND LIST EXECUTOR
      BRE ARCHITECTURE SERIES PART 7 - GEOMETRY PASS
      BRE ARCHITECTURE SERIES PART 8 - ENVIRONMENT LIGHT PASS
      BRE ARCHITECTURE SERIES PART 9 - SKYBOX PASS
      BRE ARCHITECTURE SERIES PART 10 - TONE MAPPING PASS AND POST PROCESS PASS
      BRE ARCHITECTURE SERIES PART 11 - AMBIENT OCCLUSION PASS
      My intention is to share my knowledge and also receive feedback/improvements.
      Thanks! And hope you find it useful
  • Popular Now