Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualShawn619

Posted 31 May 2013 - 02:26 AM

I want the alpha on the windows of my car(alpha=0.3, every other part of car alpha=1.0(no transparency)) to blend properly with my shader lighting.

 

It looks to me like when your shader lighting is enabled, it is interfering with the alpha output. I don't know where you're getting the 0.3 transparency for windows and 1.0 transparency for car from (uniform, texture or vertex colour), but I think your shader's lighting code is accidentally modifying it.

 

An alternative (or perhaps additional) fix is to disable blending when you're rendering the opaque part of the car. And as phil_t says, you want to render the opaque parts first. You probably also want to disable back face culling on your transparent parts (at least for this particular model)

 

I think you guys are correct, and the windows now look somewhat-realistic, right? (forgive me for the low-poly count)

 

mszl2h.jpg

 

However, I am paying for it, because my FPS dramatically lowers (70-80%). Can I optimize this for better performance in any way, or is this the price I pay for transparent windows?

 

This is what I changed to get it running but with a FPS dramatically lowered, in Pseudo/OGL code:

From

 

for(all triangles){
    draw triangle
}

To

 

for(all triangles){
   
    if(triangles' alpha component IS opaque){
        draw triangle
    }else{
        glDisable(GL_BLEND);
        draw triangle
        glEnable(GL_BLEND);
    }
    draw triangle
}

#3Shawn619

Posted 31 May 2013 - 02:25 AM

I want the alpha on the windows of my car(alpha=0.3, every other part of car alpha=1.0(no transparency)) to blend properly with my shader lighting.

 

It looks to me like when your shader lighting is enabled, it is interfering with the alpha output. I don't know where you're getting the 0.3 transparency for windows and 1.0 transparency for car from (uniform, texture or vertex colour), but I think your shader's lighting code is accidentally modifying it.

 

An alternative (or perhaps additional) fix is to disable blending when you're rendering the opaque part of the car. And as phil_t says, you want to render the opaque parts first. You probably also want to disable back face culling on your transparent parts (at least for this particular model)

 

I think you guys were correct, and the windows now look somewhat-realistic, right? (forgive me for the low-poly count)

 

mszl2h.jpg

 

However, I am paying for it, because my FPS dramatically lowers (70-80%). Can I optimize this for better performance in any way, or is this the price I pay for transparent windows?

 

This is what I changed to get it running but with a FPS dramatically lowered, in Pseudo/OGL code:

From

 

for(all triangles){
    draw triangle
}

To

 

for(all triangles){
   
    if(triangles' alpha component IS opaque){
        draw triangle
    }else{
        glDisable(GL_BLEND);
        draw triangle
        glEnable(GL_BLEND);
    }
    draw triangle
}

#2Shawn619

Posted 31 May 2013 - 02:25 AM

I want the alpha on the windows of my car(alpha=0.3, every other part of car alpha=1.0(no transparency)) to blend properly with my shader lighting.

 

It looks to me like when your shader lighting is enabled, it is interfering with the alpha output. I don't know where you're getting the 0.3 transparency for windows and 1.0 transparency for car from (uniform, texture or vertex colour), but I think your shader's lighting code is accidentally modifying it.

 

An alternative (or perhaps additional) fix is to disable blending when you're rendering the opaque part of the car. And as phil_t says, you want to render the opaque parts first. You probably also want to disable back face culling on your transparent parts (at least for this particular model)

 

I think you guys were correct, and the windows now look somewhat-realistic, right? (forgive me for the low-poly count)

 

mszl2h.jpg

 

However, I am paying for it, because my FPS dramatically lowers (70-80%). Can I optimize this for better performance in any way, or is this the price I pay for transparent windows?

 

This is what I changed to get it running but with a FPS dramatically lowered, in Pseudo/OGL code:

From

 

for(all triangles){
    draw triangle
}

To

 

for(all triangles){
   
    if(triangles' alpha component IS opaque){
        draw triangle
    }else{
        glDisable(GL_BLEND);
        draw triangle
        glEnable(GL_BLEND);
    }
    draw triangle
}

#1Shawn619

Posted 31 May 2013 - 02:25 AM

I want the alpha on the windows of my car(alpha=0.3, every other part of car alpha=1.0(no transparency)) to blend properly with my shader lighting.

 

It looks to me like when your shader lighting is enabled, it is interfering with the alpha output. I don't know where you're getting the 0.3 transparency for windows and 1.0 transparency for car from (uniform, texture or vertex colour), but I think your shader's lighting code is accidentally modifying it.

 

An alternative (or perhaps additional) fix is to disable blending when you're rendering the opaque part of the car. And as phil_t says, you want to render the opaque parts first. You probably also want to disable back face culling on your transparent parts (at least for this particular model)

 

I think you guys were correct, and the windows now look somewhat-realistic, right? (forgive me for the low-poly count)

 

mszl2h.jpg

 

However, I am paying for it, because my FPS dramatically lowers (70-80%). Can I optimize this for better performance in any way, or is this the price I pay for transparent windows?

 

This is what I changed to get it running but with a FPS dramatically lowered, in Pseudo/OGL code:

From

for(all triangles){
    draw triangle
}

To

for(all triangles){
   
    if(triangles' alpha component IS opaque){
        draw triangle
    }else{
    glDisable(GL_BLEND);
        draw triangle
    glEnable(GL_BLEND);
    }
    draw triangle
}

PARTNERS