[MDX] Ripple and flickering artefacts on textured objects (fine screenshot)

This topic is 4328 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

Good day for you! We are working on a drive simulator. Please see on the sidewalk on the right bottom of screenshot. Even on small distants you can see the distortions that increases as far. Also there are flickering in dinamics. I'm using VS2003 and SampleFramework with thear default render parameters. Some info about hardware displayed in the screenshot. Yesterday to midnight I'm "attack" gamedev.net with keywords "artefacts", "distortions", "defects", "flickering" and so on. As result I'm guess the solution may be in : 1. Z-buffer 2. BackBuffer 3. PRESENT PARAMETERS: PresentationInterval (ONE or IMMEDIATE) 4. PRESENT PARAMETERS: SwapEffect 5. Device.Clear 6. may be TextureStageStates SampleFramework has incapsulated many features and as be honest now I don't khow how for example change SwapEffect. May be there is enough only one you sight to this screenshot to help me in the right way. Thx!

Share on other sites
Well, the first thing that comes to mind is the texture filtering. If you're not explicitly setting any filtering options in MDX, you'll only get point filtering. As a result, textures that are minified often look 'grainy' and may show small 'flickers' in the distance like you seem to be experiencing.

The easiest way to solve this is to use a linear texture filter. You can do this by adding the following code to your OnResetDevice method if you're using the SampleFramework:

[source lang=csharp]if (e.Device.DeviceCaps.TextureFilterCaps.SupportsMinifyLinear){	e.Device.SamplerState[0].MinFilter = TextureFilter.Linear;}if (e.Device.DeviceCaps.TextureFilterCaps.SupportsMagnifyLinear){	e.Device.SamplerState[0].MagFilter = TextureFilter.Linear;			}if (e.Device.DeviceCaps.TextureFilterCaps.SupportsMipMapLinear){	e.Device.SamplerState[0].MipFilter = TextureFilter.Linear;		}

Hope this helps & a good day to you too :)

Share on other sites
Also, if you see flickering without motion, then you are probably experiencing z-fighting. This is an artifact of having too little resolution in your Z direction. Try reducing the far clipping plane to reduce the error.

Share on other sites
Hi Maxim,
In addition to the other suggestions..
Does the texture you are using for the sidewalk contain several mip levels?
If not, try creating the texture with maximum, or at least several mip levels and see if that improves the appearance of the sidewalk.

In the past I have found that using mip mapping gives better results for "repeating" textures rendered from near to far.

HTH,
Cambo_frog

Share on other sites
Hello, remigius!
When i set MipFilter to Linear and run apps i have seen absolutely new picture!!! Thanks a lot! [smile]

It's all ok with GeForce 5200.

[Edited by - Maxim Skachkov on April 5, 2006 6:12:39 PM]

Share on other sites
Hello, Supernat02 and gamedev community!

Really!
When I testing my apps on computer with RIVA TNT2/TNT2 PRO graphic card i see "flickering without motion" on the lawn (grass). Moreover, i see the effect like "alive bog movement " of even "earthquake with 9 points on the Richter scale". Also i have find similar defects on roads and borders. But i think that the users of my simulator and inhabitants of my virtual houses should sleep easy and i intend to correct this artefact!

and

Can you help me to be in mind and stand tough? What to me to do with "earthquake artefacts" from which granite borders crack even!?

Quote:
 Original post by Supernat02Also, if you see flickering without motion, then you are probably experiencing z-fighting. This is an artifact of having too little resolution in your Z direction. Try reducing the far clipping plane to reduce the error.

Supernat02!
I have tried to reducing/increasing the far clipping plane as you have advised.

My code:
camera.SetProjectionParameters( ( float )Math.PI / 4.0f, aspectRatio, 0.01f, <b>3000.0f</b> );

Writing to Cambo_frog ...

[Edited by - Maxim Skachkov on April 5, 2006 6:10:12 PM]

Share on other sites
Quote:
 Original post by Cambo_frogtry creating the texture with maximum, or at least several mip levels and see if that improves the appearance of the sidewalk.In the past I have found that using mip mapping gives better results for "repeating" textures rendered from near to far.HTH,Cambo_frog

Thanks, I shall try.

Share on other sites
Night ...

remigius very much helped me with smoothing texture within the limits of one object. What about smoothing or filtering for all scene?

I'd like to see the continuous curve for a marking on turn on the road. The marking and the road are different objects. The marking and the road vertices are stored in different vertex buffers with PositionNormalColored and PositionNormalTextured vertex formats аccordingly.

Is this artefact takes place because of an error of calculations on distance? Resolution 1024*768!
I have looked finished simulator of driving on Moscow streets - same defects. But my intuition whispers to me, that there is a decision. But what?
I am grateful for your attention to my questions.

Share on other sites
Well, I think your Z range between the near and far clipping planes has a lot to do with this last artifact (and possibly with the TNT2 one too), as Supernat02 also pointed out. Your near clipping plane is a bit too close and your far clipping plane seems a bit too far away, giving you a too small 'resolution' in the zbuffer, which is a probable cause of these artifacts. You might want to try if a more common range from 0.1f or 1f (near) to 1000f (far) works for you.

I can't explain this properly this early, but here is an excellent article that explains this issue in great detail [smile] It basically comes down to the advice to make the range between your near and far clipping planes as small as possible:

Quote:
 Always put zNear as far from the eye as you can tolerate.

Share on other sites
You could also try selecting a Z-buffer format with more resolution.

Make sure your device is using D3DFMT_D24S8 not D3DFMT_D16.

Share on other sites
for the last artefact you could try to enable anti-aliasing, looks just like the standard aliasing to me. Too bad I don´t know the MDX calls for enabling it.
For the z-buffer issue: If you can´t reduce the far plane any more, push the near plane as far away as you can, just as remigius posted. Doing both would be best of course.

Share on other sites
Good call. To enable antialiassing in the MDX SampleFramework, you can add the following code to its ModifyDeviceSettings method:

[source lang=csharp]// Multisample (antialiassing) types you want to support, descending in order of qualityMultiSampleType[] types = new MultiSampleType[] {		 MultiSampleType.EightSamples, 		 MultiSampleType.SixSamples, 		 MultiSampleType.FourSamples, 		 MultiSampleType.TwoSamples, 		 MultiSampleType.None 		};// Loop through the types, enabling the best one supported by your devicefor (int i = 0; i < types.Length; i++){	if (Manager.CheckDeviceMultiSampleType( 0, settings.DeviceType, settings.AdapterFormat, settings.presentParams.Windowed, types))	{						System.Diagnostics.Debug.WriteLine( String.Format("Using {0} multisampling", types ));		settings.presentParams.MultiSample = types;		break;	}}

There, now I should really go get some work done [smile] Please do post some screenshots of the final result, should be interesting for people looking for these solutions and the visual improvements one might get by using them.

Share on other sites
Hello! Hello!

I apologize, that did not answer long time. I made video by camera of the real city to simulate them.

I have solved almost all problems with graphics quality with your help. Thanks a lot!

The border crack artefact нas disappeared after setting the near clipping plane to 1.0f instead 0.1f.
Remigius's code for antialiassing working one to one (without editing). Fantastic! Special thanks!

Images -

Now we programming the rules of traffic, for example, that the infringement was fixed when the car exceeds speed or stops in not put place.

Pleasant driving ...

Share on other sites
Just keep in mind anti-aliasing isn't availble on older card (you mentioned a TNT2 somewhere). You should be good on your FX5200, but the TNT probably won't allow you to create a device if you request anti-aliasing...

Looks very good, though :).

Share on other sites
Quote:
 Original post by sirob... but the TNT probably won't allow you to create a device if you request anti-aliasing...

As for code in two posts above it works for TNT with "Using None multisampling".

remigius, Supernat02, Cambo_frog, axon, matches81 and sirob !!!
Thanks all for useful discussion and help!
[smile]

• 9
• 10
• 18
• 14
• 10