Skip to main content
GameDev.net gamedev.net
🔒 Locked

Texture Flickering

Started by Endemoniada Mar 7, 2008 at 11:00 PM 2 replies 700+ views
Original Post
Endemoniada
Endemoniada
Hi guys, I made a skybox and render it with a star texture (all black with grey single pixel random dots), the 'stars' flicker when I rotate. If I use a solid color texture it's perfectly fine with no flicker. I use these settings: SetSamplerState(0,D3DSAMP_MINFILTER,D3DTEXF_LINEAR); SetSamplerState(0,D3DSAMP_MAGFILTER,D3DTEXF_LINEAR); SetSamplerState(0,D3DSAMP_MIPFILTER,D3DTEXF_LINEAR); SetTextureStageState(0,D3DTSS_COLOROP,D3DTOP_MODULATE); SetTextureStageState(0,D3DTSS_COLORARG1,D3DTA_TEXTURE); SetTextureStageState(0,D3DTSS_COLORARG2,D3DTA_DIFFUSE); SetTextureStageState(0,D3DTSS_ALPHAOP,D3DTOP_DISABLE); What should I do ? I'd leave it because it looks cool but when you're not rotating they don't flicker so it's not consistent. Thanks.
Buckeye
Buckeye
If the skybox is any distance away from the eyepoint, a single pixel in a texture may or may not be rendered. You're not seeing the sky texture full size so one screen pixel covers several (or perhaps many) texture pixels. If the center of the screen pixel projects to a texture pixel that's just a few texture pixels away from your "star," the star doesn't get fully rendered. It's only going to contribute a small fraction to the color of the screen pixel.

Unfortunately you'll have to make bigger stars or a bigger sky texture to increase the probability that the stars will get mapped to a screen pixel consistently.

Another possibility is to try rotating the skybox a very small amount back-and-forth all the time to see if will flicker all the time.
Please don't PM me with questions. Post them in the forums for everyone's benefit, and I can embarrass myself publicly. You don't forget how to play when you grow old; you grow old when you forget how to play.
Kaloux
Kaloux
You can also use :
d3dDevice->DrawPrimitive( D3DPT_POINTLIST, ..., ... );
That way you're sure it will be rendered (though I never used it...)
Endemoniada
Endemoniada
Thanks a lot for the explanation, I thought I was maybe doing something wrong.

I found that if I apply a slight Gaussian Blur to my textures it minimizes the flickering quite a bit.

I like the idea of a very slight rotation to cause them to always flicker, I'm going to give that a shot; I never would have thought of doing that.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.