Jump to content

  • Log In with Google      Sign In   
  • Create Account


Weird Fog where there should be none?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
7 replies to this topic

#1 Bastich-666   Members   -  Reputation: 103

Like
0Likes
Like

Posted 11 September 2012 - 03:39 PM

I hope someone can help with this as I've been looking for it for about a week now and its starting to drive me a bit potty :-( Its a very very strange problem. Basically I have a landscape which is made up from a number of large 1km x 1km tiles. The problem is that one tile (not a consistent tile, so not model related) fogs to black without me trying or wanting it to do this. The only fogging I am using is to blend the horizon to avoid any sharp edges and thats to grey not black. I have removed all fancy shading effects and it still does it? I've even removed the fogging code from my shader file. This still didn't help. As a final test I overwrote my blinn phong shader with a flat lit one which basically only does a texture lookup. Just to confirm that its being used I have rigged it to always have 100% red component. As expected all my geometry has a red tinge to it. However the problem still persists (red not black not of course).

So does anyone have any ideas how a shader with no fogging capabilities still manages it???

James

Attached Thumbnails

  • Screen 0 Dump 003.jpg
  • Screen 0 Dump 004.jpg


Sponsor:

#2 PhillipHamlyn   Members   -  Reputation: 454

Like
0Likes
Like

Posted 12 September 2012 - 12:54 AM

At first glace, when I've seen this on my landscape, I've suspected my normals to be badly defined for that tile.

#3 Bastich-666   Members   -  Reputation: 103

Like
0Likes
Like

Posted 12 September 2012 - 02:29 AM

Unfortunately I have ruled out the normal's as the problem changes tile. I can influence the problem by altering the order they are loaded into memory from the scene script or by increasing / decreasing the amount of memory I allocate to the PSSM system. By altering the PSSM memory usage via a script the same EXE with the same data files produces the same problem but in a different place?!?!?

I am still at a complete lose as of to how the above problem can even exists when running through a shader as simple as this:

float4x4 worldViewProjectionMatrix;
texture colorMapTexture;

sampler2D colorMap = sampler_state
{
Texture = <colorMapTexture>;
MagFilter = Linear;
MinFilter = Anisotropic;
MipFilter = Linear;
MaxAnisotropy = 16;
};


struct VS_INPUT
{
float3 position : POSITION;
float2 texCoord : TEXCOORD0;
};


struct VS_OUTPUT
{
float4 position : POSITION;
float2 texCoord : TEXCOORD0;
};


VS_OUTPUT VS_Full_Lit(VS_INPUT IN)
{
VS_OUTPUT OUT;

OUT.position = mul(float4(IN.position, 1.0f), worldViewProjectionMatrix);
OUT.texCoord = IN.texCoord;

return OUT;
}


float4 PS_Full_Lit(VS_OUTPUT IN) : COLOR
{
float4 color = tex2D(colorMap, IN.texCoord);

color[0]=1.0f;
return color;
}


technique Full_Lit
{

pass
{
VertexShader = compile vs_2_0 VS_Full_Lit();

PixelShader = compile ps_2_0 PS_Full_Lit();
}
}


I can see another day of banging my head against a wall :-(

#4 kauna   Crossbones+   -  Reputation: 2279

Like
0Likes
Like

Posted 12 September 2012 - 07:08 AM

Hi,

have you checked that your mipmap generation is correct?

You can easily test this by disabling mip mapping in the effect file. It may be that the mip maps contain just black color which will result fade to black when the 0 level texture is blended to the different mip maps.

Cheers!

#5 Bastich-666   Members   -  Reputation: 103

Like
0Likes
Like

Posted 12 September 2012 - 10:51 AM

Hello, thanks for the mip map suggestion. Unfortunately it does not appear to be that ether. The textures at the minute are all 2048 x 2048 jpg files, I've not got round to DDSing them etc yet. I use the following code to load the textures:

D3DXCreateTextureFromFileEx( device, source, D3DX_DEFAULT, D3DX_DEFAULT, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, D3DPOOL_MANAGED, D3DX_DEFAULT, D3DX_DEFAULT, 0, NULL, NULL, &texture )

I've tried forcing 0 mip map layers but it makes no difference :-(

#6 Nik02   Crossbones+   -  Reputation: 2728

Like
0Likes
Like

Posted 12 September 2012 - 11:17 AM

MipLevels [in]
UINT
Number of mip levels requested. If this value is zero or D3DX_DEFAULT, a complete mipmap chain is created. If D3DX_FROM_FILE, the size will be taken exactly as it is in the file, and the call will fail if this violates device capabilities.


Note that the first surface of the texture is a mip level too.

Niko Suni


#7 Bastich-666   Members   -  Reputation: 103

Like
0Likes
Like

Posted 12 September 2012 - 01:36 PM

Thanks kauna for suggesting mip maps and thanks also to Nik02 for helping me realize that I had not actually disabled the auto generation of mip maps. As soon as I set it to D3DX_FROM_FILE it all started to work correctly. This explains the error perfectly :-)

The only slightly worrying thing is that it means that the auto generation is not reliable. I say this as I have been using this system for a long time and never ever seen this before. This has been a gigantic pain to find but its done now. Looks like I will be implementing my own mip map generator again. Time to resurrect part of my old dx7 system. The only other solution is to use DDS Converter to make all my textures / mip maps. Shame it doesn't seem to work on anything above XP.

Thanks again for all the help. I did think I was loosing the plot a few times.

Any recommendations on DDS texture generators???

#8 Nik02   Crossbones+   -  Reputation: 2728

Like
0Likes
Like

Posted 13 September 2012 - 12:37 AM

This may throw off your driver:

MinFilter = Anisotropic;
MipFilter = Linear;

Try to set the mip filter to anisotropic, and min filter to linear.

Niko Suni





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS