Original Post
I post this here because it might be a little advanced for any of the current weeks but the DirectX / XNA forum has twice ignored this concern completely.
This is a dilema I have been fighting against for a few months now, after many times of writing shader drawing loops, creating hand picked associations between my graphic objects and the shader that renders them, and trying to push that into a multi viewport framework (of my own), I am officially stuck.
Here is my structure, my graphics system has a list of viewports, at least one that represents the full game window and acts as default.
first remark is that two viewports may be viewing the same world or not, in a split screen for instance, they both see the same world, but when used to render the contents of an interface window, its not the same world as other viewports would be seeing.
Within these viewports there may be many different graphic settings in place for objects that are rendered by different shaders, so I decided to batch graphic objects together by certain critical aspects of their render states to minimize graphic card settings modification, so I created Batches, which handle the shader and the settings for any graphic object associated to them and then draw them all in one batch.
For an object to be visible in a viewport, the batch in charge of its rendering is associated to that viewport, this creates a very powerful structure but its hard to initialize.
Nevermind space partitioning and potentially visible sets, I already solved that issue.
My issue is, how to determine from content (not hardcoded in code, but rather on the data asset loaded along with textures and models that represent a given object) which batch and view should a just loaded graphic object be assigned to.
Also I've always wondered what is really more efficient, rendering the viewports onto a texture and storing it, to later render those textures in the proper order and disposition, or to just change viewports and render directly in each to screen which is what I'm currently doing...
Any ideas?
This is a dilema I have been fighting against for a few months now, after many times of writing shader drawing loops, creating hand picked associations between my graphic objects and the shader that renders them, and trying to push that into a multi viewport framework (of my own), I am officially stuck.
Here is my structure, my graphics system has a list of viewports, at least one that represents the full game window and acts as default.
first remark is that two viewports may be viewing the same world or not, in a split screen for instance, they both see the same world, but when used to render the contents of an interface window, its not the same world as other viewports would be seeing.
Within these viewports there may be many different graphic settings in place for objects that are rendered by different shaders, so I decided to batch graphic objects together by certain critical aspects of their render states to minimize graphic card settings modification, so I created Batches, which handle the shader and the settings for any graphic object associated to them and then draw them all in one batch.
For an object to be visible in a viewport, the batch in charge of its rendering is associated to that viewport, this creates a very powerful structure but its hard to initialize.
Nevermind space partitioning and potentially visible sets, I already solved that issue.
My issue is, how to determine from content (not hardcoded in code, but rather on the data asset loaded along with textures and models that represent a given object) which batch and view should a just loaded graphic object be assigned to.
Also I've always wondered what is really more efficient, rendering the viewports onto a texture and storing it, to later render those textures in the proper order and disposition, or to just change viewports and render directly in each to screen which is what I'm currently doing...
Any ideas?