Hi guys.
I'm trying to create a modern rendering system, trying being the keyword. I want to make something that is API independent and data driven. All my research points me in the direction of using render lists. I can somewhat comprehend what is entailed, but ownership confuses the crud out of me. I'm a tools programmer, graphics is something i'm aware of but i can't remember the last time i wrote a shader. Please bare with me as some of this is going to be described a bit higher level than i would like to.
So i have a GameObject which contains a RendererComponent. The RendererComponent owns a RenderCommand and a Material. The material contains a shader, and all the variables (textures, matrices etc…) that the shader needs. The RenderComponent is responsible for filling out the RenderCommand based on it's material.
[source lang="cpp"]class RenderCommand {
Independent VBO;
u32 numTriangles;
u32 numVerts;
// topology?
// kvp for shader values?
// Blend mode
};[/source]
Obviously i want rendering to batch based on MaterialState rather than having to make one draw call for each object.
To achieve batching i have each camera own a list of RenderCommands, this is of course filled with objects visible after all sorts of culling.
After the render commands have been queued up, sort them based on material, and material properties to avoid state changes where possible.
The game Renderer has an ExecuteRenderCommand function, that takes a render command as an argument. Lets assume the implementation (OpenGL, vs DirectX) is loaded from a dll.
Finally submit the RenderCommands to the Renderers ExecuteRenderCommand function
First question, Am i even in the ballpark with this? I was not able to find any information on making a data driven renderer with RenderCommands.
Are there any good articles / books / online resources on the topic?
I'm also thinking about making RenderCommand abstract and subclassing it to VBORenderCommand, DisplayListRenderCommand, etc… Enabling some higher level system to choose which command to use based on the device the code is running on. Any objections to this? Maybe a better approach?
Should i abstract RenderCommand away from the RenderComponent? Something like
[source lang="cpp"]foreach(gameObject in visibleObjects)
camera.renderCommands.add(gameObject->renderComponent->FillCommand(new RenderCommand()));[/source]
where FillCommand returns the argument that was passed in?
All of the above code is assuming that i'm going to be passing pointers to VBO's around. Is there any instance where making a new VBO and copying over the source data would be benefitial?
Again, i'm a tools programmer, so this is all new to me, sorry if the questions are dumb.
Thanks so much for taking the time!
Design of a modern data driven renderer
Look at this post http://www.gamedev.net/topic/630029-data-driven-renderer/ .
This is a lot of work, why are you doing this?
GameObject->RendererComponent->RenderCommand->Material->(textures, matrices etc...)?
Model your system after the collada file format, this will make it easier for you to import data later.
This is a lot of work, why are you doing this?
GameObject->RendererComponent->RenderCommand->Material->(textures, matrices etc...)?
Model your system after the collada file format, this will make it easier for you to import data later.
This is a very long thread from last year, but might be of interest: http://www.gamedev.net/topic/604899-frostbite-rendering-architecture-question/
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement