Multiple Objects in buffer

Started by
4 comments, last by VladR 10 years, 12 months ago

Im not sure the Topic Title is abstract or on the money but it's the closest I can come to articulating my problem

lets say I have a quad in the background and then I decide to load a cube atop of it.

The problem I have been having is that whatever order I load the buffers for said object, lets

say:

loadContent.Quad();

loadContent.Cube();

Since the Cube was called last it will be the only thing that will be rendered. This is all being done in perspectiveLH projection

Should I give them each their own Shaders and Buffers? That it seems would be the brute force approach. Maybe im missing something.

I tired to include them both in one draw call then I present the swap Chain, that didn't work.

So then I tried to draw object to the backBuffer then the next and then present, still with the same lingering problem.

I am positive this pertains to Z-Buffering. I set up a depth-Stencil-View.

Any help would be appreciated

I am using C++ and D3D11

-Marcus Hansen

Advertisement

It's never a good idea to start optimizing so soon for the very simple fact that you don't really know how many other effects there will be by the time the game is programmed (you think you know, but you don't, really).

Always keep a brute-force renderer (VB per each object) up-to-date and when the feature-set of the engine is finally finished, only then go about putting them to a single VB/IB, or grouping render calls by texture/shader/whatever.

There could be million reasons why you don't see the second object:

- incorrect matrices

- incorrect position of the object

- incorrect lighting

- the object is hidden by some other object

- object is outside view frustum

- object is rendered to a different RT

- .....

VladR My 3rd person action RPG on GreenLight: http://steamcommunity.com/sharedfiles/filedetails/?id=92951596

Thanks for the reply,

I think your correct, optimizations are to early a consideration for now.

The idea of Brute force approach with the VB/IB was something I was trying to avoid

but since I am working with so little I doubt it will make a difference.

Once again thank you for answering my question

You know, it may seem like it is a good idea to introduce an optimization or two, thinking you may actually save the time later.

But the first time I actually wrote the optimization render methods, it took me less than an afternoon to write one method that renders everything from a single static VB/IB and another method that renders eveything from a dynamic VB recreated based on current view frustum.

The point is, you won't save the time, since every time you'll make some adjustments to a scene, you have to deal with the early optimization too, thus prolonging the debugging, which is going to happen perhaps even hundred times before you actually get to doing the optimizations.

And, most important of all, if this VB/IB access is not actually a bottleneck, you just lost yourself a lot of time for no particular gain...

Of course, there's no better way to remember it than banging your head on the wall afterwards smile.png

VladR My 3rd person action RPG on GreenLight: http://steamcommunity.com/sharedfiles/filedetails/?id=92951596

Learning a Graphics API is no easy feat whether it be OpenGL or DirectX.

The number one Headache is simply remembering the API function calls

and knowing what combination of parameters to send to the individual functions

to obtain what your after. I'm sure a lot of that calms down a bit once you get more comfortable

with the API your using and graphics in general.

Thank Goodness for intellisense smile.png

Also I just recently made the jump from pure Java and playing with OpenGL ES 1.0

to C++, it seems syntactically their similar. But your no longer given the abstraction

and automatic Garbage Collection provided by the JVM( that could be Good thing)

Sorry I seem to have embarked on a tangent, thanks for the advice!

Ill try to stick with the multiple VB/IB's brute force approach until I become more

comfortable with DirectX

-Marcus Hansen

The number one Headache is simply remembering the API function calls

Why would you even want to remember them ? When programming, just keep the DX Docs open and do a search every time you use some fn.

It is actually dangerous to just remember the parameters. You always want to check the other behaviour of the fn that is mentioned in the docs.

The time you save by remembering the parameters is nothing compared to the time you loose when stuff stops working and it's only after you finally consult the dx docs [with the error you were given] you figure out the problem.

If you really work all the time just at the rendering layer, then you will, eventually, remember the parameters and everything else. But the renderer is usually, just about 10-15% of the total effort. So, once you are done with the low-level rendering stuff, you spent majority time at gameplay/ai/toolset anyway.

There was a time, I remembered majority of dx functions with their parameters. But fast forward 8-12 months, which I spent just with the gameplay, AI, tools and I forgot most of them. Which is a good thing.

VladR My 3rd person action RPG on GreenLight: http://steamcommunity.com/sharedfiles/filedetails/?id=92951596

This topic is closed to new replies.

Advertisement