Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411655 Posts in 69395 Topics- by 58451 Members - Latest Member: Monkey Nuts

May 15, 2024, 01:44:09 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)Modulate blend [OpenGL & Direct3D]
Pages: [1]
Print
Author Topic: Modulate blend [OpenGL & Direct3D]  (Read 2194 times)
Oddball
Level 10
*****


David Williamson


View Profile WWW
« on: June 08, 2010, 05:07:08 AM »

I'm doing some geometry blending, and I've got all of the common blend modes sorted, but I just wanted to check with someone who knows about this kind of thing if I've got Modulate 2x blend correct. I've done this ages ago in OpenGL, but never done it in Direct3D before.
Code:
OpenGL:
glDisable GL_ALPHA_TEST
glEnable GL_BLEND
glBlendFunc GL_DST_COLOR,GL_SRC_COLOR

Direct3D:
SetRenderState D3DRS_ALPHATESTENABLE,False
SetRenderState D3DRS_ALPHABLENDENABLE,True
SetRenderState D3DRS_SRCBLEND,D3DBLEND_DESTCOLOR
SetRenderState D3DRS_DESTBLEND,D3DBLEND_SRCCOLOR

Is that correct? Also how would I go about doing Modulate 4x? As I've never done that before.
Logged

Saint
Level 3
***



View Profile WWW
« Reply #1 on: June 09, 2010, 03:16:27 AM »

Yeah, that looks correct.

As for 4x, you'll need to render an additional pass and for example use full-white geometry... Meaning after the first pass, the value will be (S*D + D*S) = 2SD, and assuming S is 1 for the second pass for full-white geometry the result would be (1 * 2SD + 2SD * 1) = 4SD. Of course, you could change the rastermode for the second pass to (DST,ONE) if you like, but you still need full-white geometry for the source element.
Logged
Oddball
Level 10
*****


David Williamson


View Profile WWW
« Reply #2 on: June 09, 2010, 02:59:19 PM »

Thanks. Everything seemed to work correctly but I wanted to check just incase. I'm not sure if two passes is an option for what I'm doing but I'll investigate further. Smiley Hand Thumbs Up Right
Logged

Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic