Jump to content
  • Advertisement
Sign in to follow this  
MARS_999

Can I do this in GLSL without using enabling blending?

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

I would like to add foam to my water and have a rgba image that is greyscale for the rgb channels. Now is their someway I can in the FS I can do the transaprency without enabling FFP BLEND and ALPHA_TEST? And if so how would I do it? Thanks

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by phantom
what are the steps you are planning todo? (forget about if its possible or not, just how you would want todo it.. )


Well I am not sure what you are asking but I have the texture and would like to have it blend into the water as an overlay I guess so I am not sure how to go about it. I am as of now thinking of doing it this way??

using something like this

glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
but to be done in the FS

Share this post


Link to post
Share on other sites
ah right.. well, if you want to blend with pixels already in the framebuffer than you cant do it with a fp, you have to do it via the normal blend operations

Share this post


Link to post
Share on other sites
That's not helpful! :) I will need to either make a skirt or would making a second pass with the enabled glBlendFunc be ok? As of right now I am using the VS/FS to determine my points I want to do the effects on...

Share this post


Link to post
Share on other sites
The easiest way would be to render it in a single pass with the water plane itself. That way, you can do all the required blending in the fragment shader, and write the resulting RGBA to the framebuffer, possibly using alpha blending (you probably want your water to be transparent itself).

Quote:

well, if you want to blend with pixels already in the framebuffer than you cant do it with a fp

Will be possible pretty soon.

Share this post


Link to post
Share on other sites
Thanks YannL, here is what I am doing with the water though. I have a single quad that is the water plane and it has no idea where it intersects with the terrain, so in the terrain I determine based on some height value where I want my beaches and water foam to start at... Here is a screenshot. So now I want to add in foam along the coastline...

http://img320.imageshack.us/img320/9057/untitled1copy7ad.jpg

Thanks

Share this post


Link to post
Share on other sites
Quote:
Original post by Yann L
Will be possible pretty soon.


So I am assuming soon I will be able to do blending in the FS without having to use FFP? As of now I decided to make up some algorithm to determine the collsions with my water and terrain and use FFP to blend the skirt/foam. As of now the blending works, but have to code the skirt...

Share this post


Link to post
Share on other sites
You have a gray scale bitmap for the foam and a 32-bit bitmap for the water. You make the foam bitmap 16bit, one channel for the gray and one for the alpha. In the vertex shader, read the alpha and multiply it by the gray, then add it to the water color. That should give you the effect in one pass.

Share this post


Link to post
Share on other sites
Quote:
Original post by MARS_999
Quote:
Original post by Yann L
Will be possible pretty soon.


So I am assuming soon I will be able to do blending in the FS without having to use FFP? As of now I decided to make up some algorithm to determine the collsions with my water and terrain and use FFP to blend the skirt/foam. As of now the blending works, but have to code the skirt...


Thats 'soon' as in 'a couple of hardware generations' soon, current hardware will never be able todo it as the pipeline isnt arranged in the correct way to allow for FB readback into a FP.

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!