XNA SpriteBatch and BasicEffect incompatible?

I would like to control the ambient light for 2D rendering, represented by a set of graphic images on a global scale. I understand that I can do this by mixing the color passed to SpriteBatch.Draw, but I would rather do it globally.

The BasicEffect font captures the lighting style of the consistent function in XNA for simple scenes.

Is the BasicEffect shader incompatible with SpriteBatch? Has anyone got these collaborative works?

+3
source share
4 answers

Yes, they are incompatible.

, spritebatch sas quad. , xna, , spritebatch.

0

, . BasicEffect SpriteBatch - , XNA .

/ . .

: blogs.msdn.com

+2

, " " . SpriteBatch , "DepthStencilState" "BlendState" . , spriteBatch.End.

GraphicsDevice.DepthStencilState = DepthStencilState.Default;

spriteBatch DepthStencilState None 3D- . . :

GraphicsDevice.BlendState = BlendState.Opaque;
GraphicsDevice.SamplerStates[0] = SamplerState.LinearWrap;
+2

, , , , , .

0

Source: https://habr.com/ru/post/1713501/


All Articles