TX Filtering/Quality Issue
by Christian Rousselle · in Torque X 2D · 07/13/2008 (3:52 pm) · 6 replies
Hi,
I have a problem with TX and filtering/sampling. The first screenshot shows TX with linear sampling (default in SimpleEffect.fx) - in this case the graphics (background/ship) look blurry.

The second screenshot shows the same scene with point filtering (changed MipFilter, MinFilter, MagFilter to POINT in SimpleEffect). This looks better. The problem is that when the ship is rotated is gets pixelated.

The third screenshot shows the same scene with TGB. This is what I want to achive in TX.

Does anybody know how to achive this effect? I know I can set the background to POINT and only the ship to LINEAR but I would like to have the ship crips too.
Thanks.
I have a problem with TX and filtering/sampling. The first screenshot shows TX with linear sampling (default in SimpleEffect.fx) - in this case the graphics (background/ship) look blurry.

The second screenshot shows the same scene with point filtering (changed MipFilter, MinFilter, MagFilter to POINT in SimpleEffect). This looks better. The problem is that when the ship is rotated is gets pixelated.

The third screenshot shows the same scene with TGB. This is what I want to achive in TX.

Does anybody know how to achive this effect? I know I can set the background to POINT and only the ship to LINEAR but I would like to have the ship crips too.
Thanks.
#2
06/30/2009 (7:33 pm)
So...for those of us without the source code...is there any way to implement this fix for blurriness?
#4
In the code I posted above I used a resolution of 1024x768. You have to adjust this to the resolution you use. The best way would be to pass the current resolution to the shader.
07/02/2009 (2:03 pm)
Hi. I am not 100% sure but I think it should be possible for people without the source to write their own shader and change/create the material.In the code I posted above I used a resolution of 1024x768. You have to adjust this to the resolution you use. The best way would be to pass the current resolution to the shader.
#5
07/03/2009 (2:35 am)
I know the EULA says no sharing of source code to non-pro licensors, but does a simple shader count? I would like to just get this shader file and make the quick fix. If not, is it possible to get some info on the needed data bindings to write a replacement simple shader? Can someone from GG chime in? My game is using a lot of sprites, and I would like them as sharp as possible, even at the expense of some anti-aliasing. Thanks.
#6
05/26/2011 (12:45 am)
FYI for new TX users, this has been fixed in CEV4. I have verified this solution does indeed work (for any of your non CEV projects).
Torque Owner Christian Rousselle
Default Studio Name
VSOutput SimpleVS(VSInput input) { VSOutput output; output.position = mul(input.position, worldViewProjection); output.texCoord.x = input.texCoord.x + 0.5 / 1024; output.texCoord.y = input.texCoord.y + 0.5 / 768; output.color = input.color; output.color.a *= opacity; return output; }The above assumes a resolution of 1024x768 but the current resolution should be passed to the shader.
I do not suspect that somebody knows how to tell TXB to accept customer materials? When I create a customer material and replace it in the scenes XML file it works and is used when starting from Visual C#.
<Materials> <MyMaterial name="Level_01_01Material" type="MyNameSpace.Materials.MyMaterial"> <TextureFilename>data/images/World_01/Level_01/Level_01_01.png</TextureFilename> <IsTranslucent>false</IsTranslucent> <IsAdditive>false</IsAdditive> </MyMaterial> </Materials>But when I load the scene and save it again in TXB it is replaced by SimpleMaterial:
<Materials> <SimpleMaterial name="Level_01_01Material" type="GarageGames.Torque.Materials.SimpleMaterial"> <TextureFilename>data/images/World_01/Level_01/Level_01_01.png</TextureFilename> <IsTranslucent>false</IsTranslucent> <IsAdditive>false</IsAdditive> </SimpleMaterial> </Materials>