about scaling and antialiasing

Started by
4 comments, last by Chaotic_Attractor 15 years, 12 months ago
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
Advertisement
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.
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 ?
D3DCAPS9 caps;device->GetDeviceCaps(&caps);


Read in documentation to understand what parameters read.
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 .
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 typefor (int i = 0; i < types.Length; i++){   if (Microsft.DirectX.Direct3D.Manager.CheckDeviceMultiSampleType(0,        Microsoft.DirectX.Direct3D.DeviceType.Hardware,                        Format.A8R8G8B8, false, types))   {      presentParams.MultiSample = types;      break;   }}
Strength without justice is no vice; justice without strength is no virtue.

This topic is closed to new replies.

Advertisement