Sign in to follow this  
afsajghfd

about scaling and antialiasing

Recommended Posts

afsajghfd    100
Hi all, some weeks ago i'm quite sure that i have seen a function to scale, but starting from one point instead of scale all the matrix (not symmetrically like Matrix.scale). someone knows the name of this method ? =( and my second cuestion :) does someone knows how to add antialiasing to a mesh ? thanks in advance

Share this post


Link to post
Share on other sites
MJP    19786
Which API and language are you using? It looks like you're talking about either Managed DX or XNA.

I'm not really sure what you're looking for in your first question. If you're looking to create a matrix that will scale vertices outward from a point, you can do something like this:


scaleMatrix = Matrix.Translate(-scalePoint) * Matrix.Scale(scale)



As for anti-aliasing, to enable multi-sampling you need to specify that you want your back-buffer and z-buffer to be multi-sampled. You typically do this by specifing a multi-sample amount in your parameters when you create the D3D device.

Share this post


Link to post
Share on other sites
afsajghfd    100
thanks for your answers, i'm using dx9 i forgot to say :P

i try multisample and it works fine :)
but i think the value it depends of the graphic card ?
i have a NVIDIA GeForce 7300 LE and just works till four Samples
so i'm wondering how can i get the max value of every graphic card
using dx to be more generic ?

Share this post


Link to post
Share on other sites
MJP    19786
Quote:
Original post by afsajghfd
thanks for your answers, i'm using dx9 i forgot to say :P

i try multisample and it works fine :)
but i think the value it depends of the graphic card ?
i have a NVIDIA GeForce 7300 LE and just works till four Samples
so i'm wondering how can i get the max value of every graphic card
using dx to be more generic ?


It will depend on not only the device, but what surface format you're rendering to . You can check what's available at runtime using IDirect3D9::CheckDeviceMultiSampleType .

Share this post


Link to post
Share on other sites
Try something like this (written for Managed DirectX but you could adapt it to whatever you are using):


MultiSampleType[] types = new MultiSampleType[]
{
MultiSampleType.SixteenSamples,
MultiSampleType.EightSamples,
MultiSampleType.SixSamples,
MultiSampleType.FourSamples,
MultiSampleType.TwoSamples,
MultiSampleType.None
};

// Choose best multisampling type
for (int i = 0; i < types.Length; i++)
{
if (Microsft.DirectX.Direct3D.Manager.CheckDeviceMultiSampleType(0,
Microsoft.DirectX.Direct3D.DeviceType.Hardware,
Format.A8R8G8B8, false, types[i]))
{
presentParams.MultiSample = types[i];
break;
}
}



Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this