• 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
lipsryme

Rendering architecture using commands and bitmasks

6 posts in this topic

I've been going through threads and other useful pages like this http://realtimecollisiondetection.net/blog/?p=86 but there's something I'd like to get a confirmation on that I'm not going to do something wrong...

 

So how does this work in praxis...I've got my scene where I define what I want to draw and what material should be put on it...etc...

But is this already where I create the corresponding command for the render queue ?

Let's say I've defined this command and sent it (either alone or as an array of commands) to the render queue (a higher level class that processes and sorts this). For this to work don't I need to have a multiple pages long if/else branch to basically parse this information first ? How else would I translate the bitmask to their corresponding commands. E.g. I want to clear the screen, so I set my bitmask to something predefined that defines the specific action and send this command to the render queue. But now I need to process this command and see which corresponds to what.

Is this correct or is there a small thing that I'm missing that makes this a little more elegant ?

Edited by lipsryme
0

Share this post


Link to post
Share on other sites
Yeah you're basically implementing a VM. So, when you've extracted a command ID (e.g. "clear"), you then feed that value into a giant switch statement, or you use it to index an array of function pointers.
2

Share this post


Link to post
Share on other sites

I'm still having problems understanding how I would build a specific process using these commands in praxis.

E.g. defining an ID for a few API calls isn't a problem but if I wanted to make a Clear() call I'd also need to fuel it with additional information that might even be unavailable at the time the command is being made. How would I do that?

 

Then for example I'm doing post processing (would I even do that using commands?) and wanted to do bloom where there's a lot of render target swapping and temporary render targets involved...I'm curious how that would look inside the code.

My idea would be to define a method in my higher level renderer that looks something like this:

void RenderQueue()
{
   std::vector<UINT64> commands;

   foreach Entity
   {
      // Frustum Cull      

      // Create Command (Draw call)
   }

   // Create PostProcessing commands
   DoArbitaryPostEffect(commands);

   // SortCommandList

   // Send Command to low level renderer
}


void ArbitraryPostEffect(std::vector<UINT64> &commands)
{
   // Create command for setting the render target here
   commands.push_back(SetRTCommand);
   
   // Create command for setting the texture
   commands.push_back(SetSRVCommand);

   // Create command for setting the constant buffer
   commands.push_back(SetCBCommand);

   // Create command for the actual draw call using a fullscreen quad
   commands.push_back(FSQDrawCallCommand);
}

 

 

The guy in the blog (link in my post above) says he's using a single bit to know if the last part was depth or a command.

I'm having a hard time imagining how this would be sorted in a correct way.

For example in a deferred renderer I'd have a specific order of doing things.

I was thinking of having the first sort criteria (MSB) being my pass (e.g. GBuffer = 0, Lighting = 1) so it is sorted and executed in that order.

But now if I were to mix my draw calls with commands how would I still get a correct ordering of those things in the end?

Edited by lipsryme
0

Share this post


Link to post
Share on other sites

You can feed your own equality and compare functions to the STD sort algorithm, so you can implement the way it does the compare in the sort how you see fit. So that means the in the compare you could ignore that part of the key to sort on for example. And that is also what he is expressing with the fact that you sometimes want to order on depth instead of shader instance.

 

The order of post and gbuffer construction can all be dealt with in the lower level renderer all this feature allows you is a way to control how (read in what order) the render data flows through your render calls. In the DiRT series a similar technique is used in the generation of the render data, the render queue then takes this flag into account when inserting the render data into the renderqueue. After that the render just takes the queue and renders it.

Edited by NightCreature83
1

Share this post


Link to post
Share on other sites

Okay so when inserting the depth values to the bitmask how do I do that ?

If I use the object's Z value it could be negative which wouldn't work, right ?

What I need in the end is just the correct order so like [0,1,2,3,...] either front-to-back or back-to-front sorted but I'm not sure how to express that inside parts of the bitmask.

 

I'm not used to working with bitmasks...

 

 

edit: Oh I see I use the distance from the object to the camera as depth value tongue.png

Edited by lipsryme
0

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