Terrain disappearing at certain camera angles

Posted By: Stansmedia

Terrain disappearing at certain camera angles - 05/12/14 02:45

My terrain will randomly disappear when my cameras orientation and position is in certain places or angles. Could this mean there is a problem with my terrain? Too big?
Posted By: Stansmedia

Re: Terrain disappearing at certain camera angles - 05/12/14 02:57

I should also mention im using the "fx_modelTex3Nm" 3 texture terrain shader with normal mapping. Having a look in wireframe, its not that the terrain is disappearing, but the lights are randomly loosing there influence on the textures. But even with the shader off, same thing.
Posted By: sivan

Re: Terrain disappearing at certain camera angles - 05/12/14 07:25

the light problem can ccme from the fact Sun is always the last dynamic light out of the 8 available, and this shader uses only the 1st 3 as I remember. you can define the actual number of light affecting a terrain chunk by iLights.

I had disappearing terrain only 2 times: 1) when scaled a terrain of a wmb level after, and 2) when applied a clipped or not check.
Posted By: Stansmedia

Re: Terrain disappearing at certain camera angles - 05/12/14 08:02

Weird thing: If 3 lights aren't on it at all times, it disappears too smirk
Posted By: sivan

Re: Terrain disappearing at certain camera angles - 05/12/14 08:34

the demo works fine with less ligths but that uses a model not a terrain...

I know PASS_SOLID is set for the material, but try it to replace the last line of calcLightFalloff in the shader with return(float4(0,0,0,1)); to not to be transparent but intransparent black. you can also add an AlphaTestEnable = false; to both "pass one"-s in the end. moreover I don't know why ZWriteEnable is needed there.
Posted By: oliver2s

Re: Terrain disappearing at certain camera angles - 05/12/14 21:58

Are your level bounds big enough? Set this after level load:
Code:
level_ent.min_x=-500000;
level_ent.min_y=-500000;
level_ent.min_z=-500000;
level_ent.max_x=500000;
level_ent.max_y=500000;
level_ent.max_z=500000;

Posted By: Stansmedia

Re: Terrain disappearing at certain camera angles - 05/15/14 02:01

Well, it stays lit as long as the two dynamic lights are shining on it. I have the sun turned off so I think that irritating it.. It doesn't want to react to spotlights tho, just renders as omni. Has anybody implemented spotlights into it? Or is it not easy/possible.
Posted By: sivan

Re: Terrain disappearing at certain camera angles - 05/15/14 12:51

imo it's only for point lights, spots are a bit more difficult, but sorry I've never used them only saw e.g. in the Sponza demo (find in Showcase section).
Posted By: Stansmedia

Re: Terrain disappearing at certain camera angles - 05/16/14 00:23

That sponza shader is awesome. It blows my mind that these resources are buried in here.
Posted By: DLively

Re: Terrain disappearing at certain camera angles - 05/16/14 01:32

camera.clip_far = 500000; is an an alternate idea for Oliver2's suggestion laugh Although it seems to be a shader issue wink
Posted By: sivan

Re: Terrain disappearing at certain camera angles - 05/16/14 06:45

but very far clipping distance makes rendering expensive, I never use more than 15000 for an open scene, because of vegetation and buildings...
© 2023 lite-C Forums