Sign in to follow this  
Bastich-666

Weird Fog where there should be none?

Recommended Posts

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

Share this post


Link to post
Share on other sites
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:

[i]float4x4 worldViewProjectionMatrix;[/i]
[i]texture colorMapTexture;[/i]

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

[i]struct VS_INPUT
{
float3 position : POSITION;
float2 texCoord : TEXCOORD0;
};[/i]

[i]struct VS_OUTPUT
{
float4 position : POSITION;
float2 texCoord : TEXCOORD0;
};[/i]

[i]VS_OUTPUT VS_Full_Lit(VS_INPUT IN)
{
VS_OUTPUT OUT;[/i]
[i] OUT.position = mul(float4(IN.position, 1.0f), worldViewProjectionMatrix);
OUT.texCoord = IN.texCoord;[/i]
[i] return OUT;
}[/i]

[i]float4 PS_Full_Lit(VS_OUTPUT IN) : COLOR
{
float4 color = tex2D(colorMap, IN.texCoord);[/i]
[i] color[0]=1.0f;[/i]
[i] return color;
}[/i]

[i]technique Full_Lit
{[/i]
[i] pass[/i]
[i] {
VertexShader = compile vs_2_0 VS_Full_Lit();[/i]
[i] PixelShader = compile ps_2_0 PS_Full_Lit();
}
}[/i]

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

Share this post


Link to post
Share on other sites
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!

Share this post


Link to post
Share on other sites
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 :-(

Share this post


Link to post
Share on other sites
[font=courier new,courier,monospace]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.[/font]

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

Share this post


Link to post
Share on other sites
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???

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