Jump to content
  • Advertisement
Sign in to follow this  
BloodLust666

Dilemma: VBOs or per-polygon rendering

This topic is 3986 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

After learning about VBOs and getting them into my engine. I started to look into the stencil buffer to add cool effects like shadows and reflections, BUT it appears they are for specific polygons I need to know about... How will I be able to incorporate VBOs while being the stencil buffer for certian faces.

Share this post


Link to post
Share on other sites
Advertisement
Most stenciling algorithms don't require writing a different stencil value for each polygon. Rather, you'd write the same stencil value for all polygons in a batch, or else use the stencil increment/decrement functionality and associated onfail/onpass tests (as in the case of shadow volumes).

There should be no reason you need to render one poly at a time to achieve any of the standard "next-gen" (or really current-gen) effects. Your performance will likely suffer pretty badly without using VBOs.

Share this post


Link to post
Share on other sites
well, one example that I saw for a tiled floor with ever other tile being reflective is how would i tell those polygons to draw into the stencil and the others not. I would have to make two different objects: one with ONLY the reflective tiles and one with ONLY the non-reflective tiles. right? would that be the best approach for that instance?

otherwise I do see the idea is rendering an entire object into the stencil buffer and not specific polygons

Share this post


Link to post
Share on other sites
Yes, generally you'd separate your "materials" into different batches (i.e., different draw calls). So, in your example, your two tiles actually have different materials; one of them has the property of being reflective, the other doesn't. So you'd have two VBOs along with two materials (which is another can of worms).

Share this post


Link to post
Share on other sites
oh wow! I just had a great idea. I actually do have my own "material" object for each group to be rendered with that material and i can simply add a flag for reflection :) THANKS!

Share this post


Link to post
Share on other sites
Quote:
Original post by emeyex
So you'd have two VBOs along with two materials (which is another can of worms).
No, no, no.
A common misconception about VBO is that they somehow correspond to a material. It's not quite like it.
There's no reason (besides easiness of implementation) to have a VBO per material.
In fact, it's a quite suboptimal way, unless every material hits several hundred thousands vertices (which is unlikely in development apps).
The VBO can be used as a opaque blob, containing multiple materials. A buffer offset or (even better) some index and alignment alchemy will allow to have multiple vertex formats in the same VBO.

Said that, this is probably a unnecessary optimization nowadays however let's not forget that VBO allows to mix and match vertex formats at least for the sake of knowing it!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!