If you look at the HLSL shader from previous versions of SpriteBatch, you will notice the Xbox implementation used a complex vertex shader. This meant that, while it was common to use SpriteBatch with a custom pixel shader, customizing the vertex shader was excessively difficult.

This makes it trivial to use SpriteBatch with custom vertex shaders. You can even combine SpriteBatch with BasicEffect! This code configures BasicEffect to replicate the default SpriteBatch coordinate system:

When using custom shaders for the sprite batch, do we have to take care of the half pixel/texel centering? I remember reading that the SpriteBatch took care of this automatically, but not sure if it was in the application or in the vertex shader.

> What's the difference between Effect.CommitChange and EffectPass.Apply. Is there somthing like SetShaderConstant()

There is no Effect.CommitChanges or SetShaderConstant API in Game Studio 4.0.

EffectPass.Apply is always used any time you want to set shader parameters onto the device.

Aaron Schultz

15 Aug 2010 1:40 PM

Thank you Shawn and team. The XNA font system is pretty locked down, so this finally gives a relatively simple way to draw text billboards. Speaking of fonts, any chance you guys could bake in support for loading non-installed fonts off the disk within the Font Descriptor processor using the PrivateFontCollection API? Or at least provide a way to inject a system Font object (that we can load ourselves) into the processor? In a lab environment (like at school), it can be difficult/impossible to use non-standard fonts because we don't have the privs to install them. The XNA font system in the pipeline is all internal sealed classes, so short of duplicating the XNA internals out using reflector there is no easy way to do this.

Markus

22 Sep 2010 11:58 AM

Hello there,

could anyone point me to a example off how too use spritebatch with own effect (basiceffect) to draw in 3d scene?