Sign in to follow this  

1 VBO and multiple blend modes

This topic is 1101 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

Hello everyone!

 

 

I was wondering ...
When i create one big vbo then can i have different blending modes in it?
 

for example i put house in vbo and the walls will be glBlendFunc(GL_ONE, GL_ONE), glBlendEquation(GL_FUNC_ADD); and the windows will be 

glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); glBlendEquation(GL_MIN);

just really random but well you get the idea.

the one other question, am i right that if im having one vbo then vertices what are in it, i dont have to sort them near to far when using blend am i right?

Thanks!

 

Share this post


Link to post
Share on other sites

Hello everyone!
 
 
I was wondering ...
When i create one big vbo then can i have different blending modes in it?
 
for example i put house in vbo and the walls will be glBlendFunc(GL_ONE, GL_ONE), glBlendEquation(GL_FUNC_ADD); and the windows will be 
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); glBlendEquation(GL_MIN);
just really random but well you get the idea.

 
You don't put blend modes into your buffer objects. They are completely different things and are unrelated to each other. If you need different blend modes when drawing different parts of the buffer objects, then simply change blend mode before drawing.
 

the one other question, am i right that if im having one vbo then vertices what are in it, i dont have to sort them near to far when using blend am i right?

Thanks!

If the blend mode you use requires back-to-front drawing order, or any other order, then you have to sort those vertices accordingly.

Share this post


Link to post
Share on other sites

Shorting even in inside the vbo?
Oh may god, uwww that is going to give me a headache.

 

I thought that when i have one object and its transparent then its triangles won't overlap because i was told that i need to sort objects not triangles.

Share this post


Link to post
Share on other sites

Sometimes you need to just sort objects, sometimes you need to sort triangles.

 

If an object is simple, like a cube, then you can sort objects.

 

If an object is more complex then you may need to sort triangles.  Consider the example of a monster (and this guy isn't translucent but let's assume that he is for the purposes of this example):

 

ibw0lgwZYjbPcK.gif

 

Here you can see that for certain poses this guy's arm goes in front of his body.  Consider the case where you're viewing him from the front.  Then consider the case where you're viewing him from behind.  Which do you draw first: the arm or the body?

 

In practice you probably don't care.  Just take him in a single draw call and accept the fact that from certain viewing angles there are going to be visual glitches, but they're probably tolerable enough, and being able to draw fast is a reasonable tradeoff versus being able to draw with 100% accuracy.

 

The reality is that there is no solution for order-independent translucency that doesn't involve some kind of tradeoff: performance, quality, complexity, special cases, etc.  So you pick your tradeoffs and accept a loss where it's bearable.

Share this post


Link to post
Share on other sites

 

the one other question, am i right that if im having one vbo then vertices what are in it, i dont have to sort them near to far when using blend am i right?

You do not sort data in vertex buffer, you can sort draw calls issued over them. You can issue sepparate draw call per triangle primitive if you want, and sort those issues, but this is just big break over batching policy. BUT,  if you are going to perform only draw call instruction- without any state changes inbetween- you could actaly achieve not very deviating performance from a batched draw call over constant state (my own surprising experience)

 

In other words, if blending of a draw call depends on all geomtry being behind already, sort by triangle, this means you need to issue draw call per  triangle primitive only. This does not need to be a too big kill I bet, You should try ( try and profile without any sorting logic - just issue a draw per tirangle , in a draw|| function cycle, and compare to batched draw call issue) . 

Share this post


Link to post
Share on other sites

This topic is 1101 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this