Game Development Community

How to draw 2D bitmap with NO aliasing

by Steven Durham · in Torque X 2D · 10/26/2008 (8:44 pm) · 2 replies

Beginner question.

I'm creating GUIBitmaps and other items and the bitmaps are always smoothed -- but I really want the jagged pixel edges. This happens even if I don't scale the bitmaps.

What variables do I set where to make the bitmap appear on the screen exactly as it would in the visual studio editor (for example)?

I think the TorqueX engine is doing me some favors I'd like to turn off.

This might be related to something getting scaled but I haven't figured out where.

#1
11/16/2008 (1:38 am)
This all boils down to Torque/Content/effects/SimpleEffect.fx, which is the shader used to draw pretty much anything you create in TXB.

Within that shader, in sampler2D baseSamplerTexture, you have the Min, Mag, and Mip filters (controlling when the texture is shrunk, expanded, and used with varying levels of detail respectively). These are set to Linear by default, but if you set them to Point (or POINT if you want to match the capitalization of CopyTextureSampler), then you'll get the jaggedy pixels on anything that uses SimpleMaterial.

If you want more detail about what's going on than that, you'll either want to learn about .fx (HLSL, GPU programming, DirectX shaders, are all good search terms), or dig through the engine starting at SimpleMaterial.cs.
#2
12/25/2008 (12:39 am)
To further belabor this point, I wrote an advanced tutorial that touches briefly on this. More than you need to simply keep the aliasing, but it goes into the principles behind what's going on here:

http://tdn.garagegames.com/wiki/TorqueX/CustomMaterials