Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


Windows Phone 8: Additive blending


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
6 replies to this topic

#1 CasperW   Members   -  Reputation: 104

Like
0Likes
Like

Posted 20 February 2013 - 09:06 AM

First of all, some key info:

  • Platform: Windows Phone 8
  • API: DirectX 11
  • Language: C++/CX

I've created a 2D project for Windows Phone 8, which uses DDS textures with 8-bit alpha. I'm having issues getting additive blending working correctly. 

 

The textures have had PreMultipliedAlpha applied.

 

I've tried various combinations of settings for the BlendState, this is what I'm using currently:

 

blendDescription.AlphaToCoverageEnable = false;
blendDescription.RenderTarget[0].BlendEnable = true;
blendDescription.RenderTarget[0].SrcBlend = D3D11_BLEND_ONE;
blendDescription.RenderTarget[0].DestBlend = D3D11_BLEND_ONE;
blendDescription.RenderTarget[0].BlendOp = D3D11_BLEND_OP_ADD;
blendDescription.RenderTarget[0].SrcBlendAlpha = D3D11_BLEND_ONE;
blendDescription.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_ONE;
blendDescription.RenderTarget[0].BlendOpAlpha = D3D11_BLEND_OP_ADD;

 

The results i'm seeing are as follows:
 

  • The textures are being alpha blended correctly, but i'm not seeing an additive colour effect.
  • If I try DDS 1 textures (1 bit alpha) these work perfectly fine, but obviously 1 bit alpha is very limited.

Can anyone suggest what I might be doing wrong here?

 

Thanks

 

Casper



Sponsor:

#2 Seabolt   Members   -  Reputation: 633

Like
0Likes
Like

Posted 20 February 2013 - 09:12 AM

What blend factors are you providing?


Perception is when one imagination clashes with another

#3 CasperW   Members   -  Reputation: 104

Like
0Likes
Like

Posted 20 February 2013 - 09:21 AM

What blend factors are you providing?

 

NULL (equiv to 1, 1, 1, 1)



#4 Seabolt   Members   -  Reputation: 633

Like
0Likes
Like

Posted 20 February 2013 - 09:51 AM

Hm... This is what I do for my additive blending with my particles, but it's based on alpha, I'm not sure if it will help you.

 

	blendStateDescription.RenderTarget[0].BlendEnable = TRUE;
	blendStateDescription.RenderTarget[0].SrcBlend = D3D11_BLEND_SRC_ALPHA;
	blendStateDescription.RenderTarget[0].DestBlend = D3D11_BLEND_ONE;
	blendStateDescription.RenderTarget[0].BlendOp = D3D11_BLEND_OP_ADD;
	blendStateDescription.RenderTarget[0].SrcBlendAlpha = D3D11_BLEND_ONE;
	blendStateDescription.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_ZERO;
	blendStateDescription.RenderTarget[0].BlendOpAlpha = D3D11_BLEND_OP_ADD;
	blendStateDescription.RenderTarget[0].RenderTargetWriteMask = D3D11_COLOR_WRITE_ENABLE_ALL;
	D3DDEVICE->CreateBlendState(&blendStateDescription, &mBlendingState);

	

 

And I'm not using premultiplied alpha, but I suppose you have nothing to lose to try it haha.


Perception is when one imagination clashes with another

#5 CasperW   Members   -  Reputation: 104

Like
0Likes
Like

Posted 20 February 2013 - 10:00 AM

Thanks, SeaBolt

 

This is actually one of the combinations I have tried based on forum posts I found.

 

Unfortunately It appears to have no effect.

 

Casper



#6 CasperW   Members   -  Reputation: 104

Like
0Likes
Like

Posted 20 February 2013 - 10:15 AM

More info that may be relevant: I'm using DirectXTK's SpriteBatch framework, and i'm also rendering to deferred contexts (but all the particles i'm trying to blend are using the same context).



#7 Seabolt   Members   -  Reputation: 633

Like
0Likes
Like

Posted 20 February 2013 - 12:21 PM

Have you tried bringing it up in PIX and seeing what states are set? Maybe something more insidious is happening.


Perception is when one imagination clashes with another




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS