Sign in to follow this  
xria

blendfunc(dst_color, one_minus_dst_alpha) in multitexturing?

Recommended Posts

xria    100
I am writing a multitexture renderer, and at the moment am trying to convert all of the more used blendfunc calls into texture_env_combine equations. The one I am stuck on is blendfunc(gl_dst_color, one_minus_dst_alpha). I am wondering if this is even possible using tex_env_combine? blendfunc(gl_dst_color, one_minus_dst_alpha) breaks down to the equation: (src_color * dst_color) + (dst_color * one_minus_dst_alpha) it could be rewritten as: dst_color * (src_color + one_minus_dst_alpha) using glTexenvi() we are restricted to the following functions: REPLACE Arg0 MODULATE Arg0 * Arg1 ADD Arg0 + Arg1 ADD_SIGNED_ARB Arg0 + Arg1 - 0.5 INTERPOLATE_ARB Arg0 * (Arg2) + Arg1 * (1-Arg2) SUBTRACT_ARB Arg0 - Arg1 No matter which way I look at it, I can't fit the above equation into terms that work with any of glTexenvi's capabilities. Going with the rewritten equation, it would require a modulation of src_color and one_minus_dst_alpha, and then an ADD of the result of that modulation and dst_color. I have just begun using the tex_env_combine extensions, so I dont' know everything about them, but is there any way to stack operations like this? to say....do a modulation and store it somehow, an then use the result as an argument to an addition?

Share this post


Link to post
Share on other sites
WarAmp    750
You can set up a texture_env_combine equation per texture stage.

so you can do the ADD in texture unit 0 and then do the multiply with GL_PREVIOUS in texture unit 1.

You may need the env_crossbar extension, but afaik, its supported everywhere env_combine is.

Share this post


Link to post
Share on other sites

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