PDA

View Full Version : Scene manager implementation



EmJayJay
08-09-2015, 04:18 PM
I should have asked about this long time ago because I just wanted to hear other people's opinions. I'm thinking this with gaming in mind.

Should you divide your scene manager into smaller ones. Like something which controls animated objects and other which just holds inanimated objects. I was also thinking about splitting terrain and water into separated scene managers. Where would you draw the line for separation?

How would you split shader programs? Should if possible for multiple scene managers to use same shader program as much as possible or would it be realistic for them to have their own specialized shaders? Liquids for example might use more inputs or have different implementation.

Data format could be limited so that there would be only few VAOs in use by just using offsets for draw calls and for navigation to update them and used by different scene managers for rendering. Though if some scene manager changes buffer sizes or data placement often then that would be tricky since you would have to take tens of even hundreds of objects into account so should you also implement scene managers which don't use VAOs but just bind the buffers to use and the data format to be used on the go?

Shaders planned to use very specific data formats. For example to reduce data transfers or to just pack more data to be send for the shader you could make models, like humans for example, into 16-bit shorts since millimeter accuracy would be in my opinion accurate enough for human models when stored if you imagine 65535 as 65.535 m as maximum size (do note 32k - -32k). Normally 3 floats to describe a single vertex position could be shrunk into 3 shorts leaving another 3 shorts of data to use up before matching 3 floats in size.

I think that this would be a good idea but would this raise VAO and shader count to too high really easily without careful planning for future updates especially in mind also.