How is fog done with the ETM?

foxmulder900

26-02-2008 09:01:59

I am using the ETM in my application, I added OGRES fixed functionality fog and it shows up on everything but the terrain. I am assuming fog on the terrain will have to be accomplished using shaders, if I am wrong please let me know. Otherwise what would the best way to implement simple fog on the terrain?
Thanks in advance

CABAListic

26-02-2008 10:43:54

If your material uses shaders (and assuming you're using splatting, it does), then yes, you will have to add support for fog to the shaders. Unfortunately I have never done this myself, so I can't really help you with this. But I suppose there's got to be something on the topic in the forums and out there in the internet. If you do find something useful, please let us know :)

mkiv

03-04-2008 04:44:17

Actually, I remember reading an example shader somewhere in this forum (I think earlier on in the main thread?) of someone that had done exactly that, but I haven't tried it yet. A search in these forums should bring it up.

SongOfTheWeave

03-04-2008 11:36:42

Just write a simple shader that finds the distance between the camera and the vertex in question and multiplies the distance by some scalar (i.e. "fog thickness") and applies a fog colour multiplied by that modifier.

distance = length(position - camPosition);
oColor = distance * fogThickness * fogColor;


You could probably just do this in a vertex shader (no pixel shader) with acceptable results.

milacao

23-06-2008 08:29:14

@SongOfTheWeave: Hi, the idea is good, and it "more or less" works, but has a problem: the geo-mipmapping. When the terrain is not too detailed and there are very large polygons, and close to them a mountain or valley with lots of triangles, there appear weird things. So I think it would be better to get the fragment depth in the pixel shader (no need for vertex shader?) and according to that, apply the fog value. I've tried this, but my problem is that I'm always getting near 0 values. I suppose they are due to the fact that the Z buffer is [0, 1] instead of [near, far], so I'd have to unproject it to get the proper depth value, wouldn't I?

milacao

24-06-2008 16:23:53

I got to work the colouring of the terrain from the fragment shader without using a pixel shader for fog, but I still cannot get terrain disappearing, as it would be the effect of the fog... I hope someone can help with the thread I opened on this issue...

http://www.ogre3d.org/phpBB2/viewtopic.php?t=42390

SongOfTheWeave

01-07-2008 03:24:39

@SongOfTheWeave: Hi, the idea is good, and it "more or less" works, but has a problem: the geo-mipmapping. When the terrain is not too detailed and there are very large polygons, and close to them a mountain or valley with lots of triangles, there appear weird things. So I think it would be better to get the fragment depth in the pixel shader (no need for vertex shader?) and according to that, apply the fog value. I've tried this, but my problem is that I'm always getting near 0 values. I suppose they are due to the fact that the Z buffer is [0, 1] instead of [near, far], so I'd have to unproject it to get the proper depth value, wouldn't I?

You can do this in a vertex shader, and even if you do it in a frag shader you should compensate for the LOD using the same vert position modification that appears in the ETM example splatting vertex program.

Using this program your fog pass should be set to
scene_blend alpha_blend
as the "fog amount" is stored in the alpha channel of the returned colour.

Here's my fog shader (I use only a vertex program):

void ETFog_VS
(
float4 position : POSITION,
float delta : BLENDWEIGHT,

uniform float4x4 worldViewProj,
uniform float morphFactor,
uniform float4 fogColour,
uniform float4 fogParams,
uniform float3 camPos,

out float4 oPosition : POSITION,
out float4 oColor : COLOR
)
{
// These lines are the LOD adjustment, morph factor is a
// parameter that is auto-updated by ETM
position.y = position.y + (delta.x * morphFactor);
oPosition = mul(worldViewProj, position);

float dist = length(position - camPos);
float fogAmount = max((dist - fogParams.y) * fogParams.w, 0);
oColor = float4(fogColour.rgb, fogAmount);
}


.program script entry
vertex_program ET/Programs/VSFog cg
{
source ETFog.cg
entry_point ETFog_VS
profiles vs_1_1 arbvp1

default_params
{
param_named_auto morphFactor custom 77
param_named_auto worldViewProj worldviewproj_matrix
param_named_auto fogColour fog_colour
param_named_auto fogParams fog_params
param_named_auto camPos camera_position_object_space
}
}

milacao

01-07-2008 08:36:56

Thanks! I'll try it as soon as possible and let you know :-)

milacao

13-09-2008 18:36:49

Hi again :-),
I had to left this issue, but I've come back. Thanks, SongOfTheWeave, I've tried your shader, but I only get weird things, like a grey ground, and some polys not being shaded at all... Perhaps I'm not setting properly the pass. I add this pass the last in the best technique in my material file:

pass
{
scene_blend alpha_blend
vertex_program_ref ET/Programs/VSFog
{
}
}


I think I'm not fully understanding how ETM materials work...
Any suggestion?
Thank you very much in advance.

SongOfTheWeave

14-09-2008 04:38:35

include:

lighting off

on the pass as well as the scene blend method.

----

If that's not it, I'd have to see what it's doing to give you any insight.

milacao

14-09-2008 07:42:36

:( That didn't resolve the problem. Here you have a screenshot of what happens:

[url=http://img230.imageshack.us/img230/9813/etmfogfo7.th.jpg]http://img230.imageshack.us/img230/9813/etmfogfo7.th.jpg

Thanks.

SongOfTheWeave

14-09-2008 08:31:42

:( That didn't resolve the problem. Here you have a screenshot of what happens:

[url=http://img230.imageshack.us/img230/9813/etmfogfo7.th.jpg]http://img230.imageshack.us/img230/9813/etmfogfo7.th.jpg

Thanks.


That's interesting. Have you checked your ogre log for errors? That's always the first thing to do.

milacao

14-09-2008 08:36:38

Yep... nothing... at least I don't see anything. There are some exceptions relating to other materials, but don't have to do with ETM. This is the log file:

09:32:54: Creating resource group General
09:32:54: Creating resource group Internal
09:32:54: Creating resource group Autodetect
09:32:54: SceneManagerFactory for type 'DefaultSceneManager' registered.
09:32:54: Registering ResourceManager for type Material
09:32:54: Registering ResourceManager for type Mesh
09:32:54: Registering ResourceManager for type Skeleton
09:32:54: MovableObjectFactory for type 'ParticleSystem' registered.
09:32:54: OverlayElementFactory for type Panel registered.
09:32:54: OverlayElementFactory for type BorderPanel registered.
09:32:54: OverlayElementFactory for type TextArea registered.
09:32:54: Registering ResourceManager for type Font
09:32:54: ArchiveFactory for archive type FileSystem registered.
09:32:54: ArchiveFactory for archive type Zip registered.
09:32:54: FreeImage version: 3.10.0
09:32:54: This program uses FreeImage, a free, open source image library supporting all common bitmap formats. See http://freeimage.sourceforge.net for details
09:32:54: Supported formats: bmp,ico,jpg,jif,jpeg,jpe,jng,koa,iff,lbm,mng,pbm,pbm,pcd,pcx,pgm,pgm,png,ppm,ppm,ras,tga,targa,tif,tiff,wap,wbmp,wbm,psd,cut,xbm,xpm,gif,hdr,g3,sgi,exr,j2k,j2c,jp2
09:32:54: DDS codec registering
09:32:54: Registering ResourceManager for type HighLevelGpuProgram
09:32:54: Registering ResourceManager for type Compositor
09:32:54: MovableObjectFactory for type 'Entity' registered.
09:32:54: MovableObjectFactory for type 'Light' registered.
09:32:54: MovableObjectFactory for type 'BillboardSet' registered.
09:32:54: MovableObjectFactory for type 'ManualObject' registered.
09:32:54: MovableObjectFactory for type 'BillboardChain' registered.
09:32:54: MovableObjectFactory for type 'RibbonTrail' registered.
09:32:54: Loading library .\RenderSystem_Direct3D9
09:32:54: Installing plugin: D3D9 RenderSystem
09:32:54: D3D9 : Direct3D9 Rendering Subsystem created.
09:32:54: D3D9: Driver Detection Starts
09:32:54: D3D9: Driver Detection Ends
09:32:54: Plugin successfully installed
09:32:54: Loading library .\RenderSystem_GL
09:32:54: Installing plugin: GL RenderSystem
09:32:54: OpenGL Rendering Subsystem created.
09:32:55: Plugin successfully installed
09:32:55: Loading library .\Plugin_ParticleFX
09:32:55: Installing plugin: ParticleFX
09:32:55: Particle Emitter Type 'Point' registered
09:32:55: Particle Emitter Type 'Box' registered
09:32:55: Particle Emitter Type 'Ellipsoid' registered
09:32:55: Particle Emitter Type 'Cylinder' registered
09:32:55: Particle Emitter Type 'Ring' registered
09:32:55: Particle Emitter Type 'HollowEllipsoid' registered
09:32:55: Particle Affector Type 'LinearForce' registered
09:32:55: Particle Affector Type 'ColourFader' registered
09:32:55: Particle Affector Type 'ColourFader2' registered
09:32:55: Particle Affector Type 'ColourImage' registered
09:32:55: Particle Affector Type 'ColourInterpolator' registered
09:32:55: Particle Affector Type 'Scaler' registered
09:32:55: Particle Affector Type 'Rotator' registered
09:32:55: Particle Affector Type 'DirectionRandomiser' registered
09:32:55: Particle Affector Type 'DeflectorPlane' registered
09:32:55: Plugin successfully installed
09:32:55: Loading library .\Plugin_BSPSceneManager
09:32:55: Installing plugin: BSP Scene Manager
09:32:55: Plugin successfully installed
09:32:55: Loading library .\Plugin_OctreeSceneManager
09:32:55: Installing plugin: Octree & Terrain Scene Manager
09:32:55: Plugin successfully installed
09:32:55: Loading library .\Plugin_CgProgramManager
09:32:55: Installing plugin: Cg Program Manager
09:32:55: Plugin successfully installed
09:32:55: *-*-* OGRE Initialising
09:32:55: *-*-* Version 1.4.6 (Eihort)
09:32:55: Creating resource group Bootstrap
09:32:55: Added resource location '../resources/ogre/packs/OgreCore.zip' of type 'Zip' to resource group 'Bootstrap'
09:32:55: Creating resource group ET
09:32:55: Added resource location '../resources/ET' of type 'FileSystem' to resource group 'ET'
09:32:55: Added resource location '../resources/ogre/fonts' of type 'FileSystem' to resource group 'General'
09:32:55: Added resource location '../resources/ogre/textures' of type 'FileSystem' to resource group 'General'
09:32:55: Added resource location '../resources/ogre/models' of type 'FileSystem' to resource group 'General'
09:32:55: Added resource location '../resources/ogre/materials' of type 'FileSystem' to resource group 'General'
09:32:55: Added resource location '../resources/ogre/gui' of type 'FileSystem' to resource group 'General'
09:32:55: Added resource location '../resources' of type 'FileSystem' to resource group 'General'
09:32:55: Added resource location '../resources/textures' of type 'FileSystem' to resource group 'General'
09:32:55: Added resource location '../resources/gui' of type 'FileSystem' to resource group 'General'
09:32:55: Added resource location '../resources/PrivateA' of type 'FileSystem' to resource group 'General'
09:32:55: Added resource location '../resources/PrivateB' of type 'FileSystem' to resource group 'General'
09:32:55: Added resource location '../resources/CJ' of type 'FileSystem' to resource group 'General'
09:32:55: Added resource location '../resources/Lieutenant' of type 'FileSystem' to resource group 'General'
09:32:55: Added resource location '../resources/Robot' of type 'FileSystem' to resource group 'General'
09:32:55: Added resource location '../resources/props' of type 'FileSystem' to resource group 'General'
09:32:55: Added resource location '../resources/Hitstars' of type 'FileSystem' to resource group 'General'
09:32:55: Added resource location '../resources/Casas' of type 'FileSystem' to resource group 'General'
09:32:55: Added resource location '../resources/scripts' of type 'FileSystem' to resource group 'General'
09:32:55: Added resource location '../resources/ogre/packs/cubemapsJS.zip' of type 'Zip' to resource group 'General'
09:32:55: Creating resource group LUA
09:32:55: Added resource location '../resources/ai' of type 'FileSystem' to resource group 'LUA'
09:32:55: Added resource location '../resources/trees' of type 'FileSystem' to resource group 'LUA'
09:32:55: D3D9 : RenderSystem Option: Allow NVPerfHUD = No
09:32:55: D3D9 : RenderSystem Option: Anti aliasing = None
09:32:55: D3D9 : RenderSystem Option: Floating-point mode = Fastest
09:32:55: D3D9 : RenderSystem Option: Full Screen = No
09:32:55: D3D9 : RenderSystem Option: Rendering Device = NVIDIA GeForce 8600M GT
09:32:55: D3D9 : RenderSystem Option: VSync = No
09:32:55: D3D9 : RenderSystem Option: Video Mode = 1024 x 768 @ 32-bit colour
09:32:55: CPU Identifier & Features
09:32:55: -------------------------
09:32:55: * CPU ID: GenuineIntel: Intel(R) Core(TM)2 Duo CPU T7300 @ 2.00GHz
09:32:55: * SSE: yes
09:32:55: * SSE2: yes
09:32:55: * SSE3: yes
09:32:55: * MMX: yes
09:32:55: * MMXEXT: yes
09:32:55: * 3DNOW: no
09:32:55: * 3DNOWEXT: no
09:32:55: * CMOV: yes
09:32:55: * TSC: yes
09:32:55: * FPU: yes
09:32:55: * PRO: yes
09:32:55: * HT: no
09:32:55: -------------------------
09:32:55: *** Starting Win32GL Subsystem ***
09:32:55: GLRenderSystem::createRenderWindow "Chicken Jiménez", 1920x1200 fullscreen miscParams: externalWindowHandle=2625470
09:32:55: GL_VERSION = 2.1.1
09:32:55: GL_VENDOR = NVIDIA Corporation
09:32:55: GL_RENDERER = GeForce 8600M GT/PCI/SSE2
09:32:55: GL_EXTENSIONS = GL_ARB_color_buffer_float GL_ARB_depth_texture GL_ARB_draw_buffers GL_ARB_fragment_program GL_ARB_fragment_program_shadow GL_ARB_fragment_shader GL_ARB_half_float_pixel GL_ARB_imaging GL_ARB_multisample GL_ARB_multitexture GL_ARB_occlusion_query GL_ARB_pixel_buffer_object GL_ARB_point_parameters GL_ARB_point_sprite GL_ARB_shadow GL_ARB_shader_objects GL_ARB_shading_language_100 GL_ARB_texture_border_clamp GL_ARB_texture_compression GL_ARB_texture_cube_map GL_ARB_texture_env_add GL_ARB_texture_env_combine GL_ARB_texture_env_dot3 GL_ARB_texture_float GL_ARB_texture_mirrored_repeat GL_ARB_texture_non_power_of_two GL_ARB_texture_rectangle GL_ARB_transpose_matrix GL_ARB_vertex_buffer_object GL_ARB_vertex_program GL_ARB_vertex_shader GL_ARB_window_pos GL_ATI_draw_buffers GL_ATI_texture_float GL_ATI_texture_mirror_once GL_S3_s3tc GL_EXT_texture_env_add GL_EXT_abgr GL_EXT_bgra GL_EXT_blend_color GL_EXT_blend_equation_separate GL_EXT_blend_func_separate GL_EXT_blend_minmax GL_EXT_blend_subtract GL_EXT_compiled_vertex_array GL_EXT_Cg_shader GL_EXT_bindable_uniform GL_EXT_depth_bounds_test GL_EXT_draw_buffers2 GL_EXT_draw_instanced GL_EXT_draw_range_elements GL_EXT_fog_coord GL_EXT_framebuffer_blit GL_EXT_framebuffer_multisample GL_EXT_framebuffer_object GL_EXTX_framebuffer_mixed_formats GL_EXT_framebuffer_sRGB GL_EXT_geometry_shader4 GL_EXT_gpu_program_parameters GL_EXT_gpu_shader4 GL_EXT_multi_draw_arrays GL_EXT_packed_depth_stencil GL_EXT_packed_float GL_EXT_packed_pixels GL_EXT_pixel_buffer_object GL_EXT_point_parameters GL_EXT_rescale_normal GL_EXT_secondary_color GL_EXT_separate_specular_color GL_EXT_shadow_funcs GL_EXT_stencil_two_side GL_EXT_stencil_wrap GL_EXT_texture3D GL_EXT_texture_array GL_EXT_texture_buffer_object GL_EXT_texture_compression_latc GL_EXT_texture_compression_rgtc GL_EXT_texture_compression_s3tc GL_EXT_texture_cube_map GL_EXT_texture_edge_clamp GL_EXT_texture_env_combine GL_EXT_texture_env_dot3 GL_EXT_texture_filter_anisotropic GL_EXT_texture_integer GL_EXT_texture_lod GL_EXT_texture_lod_bias GL_EXT_texture_mirror_clamp GL_EXT_texture_object GL_EXT_texture_sRGB GL_EXT_texture_shared_exponent GL_EXT_timer_query GL_EXT_vertex_array GL_IBM_rasterpos_clip GL_IBM_texture_mirrored_repeat GL_KTX_buffer_region GL_NV_blend_square GL_NV_copy_depth_to_color GL_NV_depth_buffer_float GL_NV_depth_clamp GL_NV_fence GL_NV_float_buffer GL_NV_fog_distance GL_NV_fragment_program GL_NV_fragment_program_option GL_NV_fragment_program2 GL_NV_framebuffer_multisample_coverage GL_NV_geometry_shader4 GL_NV_gpu_program4 GL_NV_half_float GL_NV_light_max_exponent GL_NV_multisample_filter_hint GL_NV_occlusion_query GL_NV_packed_depth_stencil GL_NV_parameter_buffer_object GL_NV_pixel_data_range GL_NV_point_sprite GL_NV_primitive_restart GL_NV_register_combiners GL_NV_register_combiners2 GL_NV_texgen_reflection GL_NV_texture_compression_vtc GL_NV_texture_env_combine4 GL_NV_texture_expand_normal GL_NV_texture_rectangle GL_NV_texture_shader GL_NV_texture_shader2 GL_NV_texture_shader3 GL_NV_transform_feedback GL_NV_vertex_array_range GL_NV_vertex_array_range2 GL_NV_vertex_program GL_NV_vertex_program1_1 GL_NV_vertex_program2 GL_NV_vertex_program2_option GL_NV_vertex_program3 GL_NVX_conditional_render GL_SGIS_generate_mipmap GL_SGIS_texture_lod GL_SGIX_depth_texture GL_SGIX_shadow GL_SUN_slice_accum GL_WIN_swap_hint WGL_EXT_swap_control
09:32:55: Supported WGL extensions: WGL_ARB_buffer_region WGL_ARB_extensions_string WGL_ARB_make_current_read WGL_ARB_multisample WGL_ARB_pbuffer WGL_ARB_pixel_format WGL_ARB_pixel_format_float WGL_ARB_render_texture WGL_ATI_pixel_format_float WGL_EXT_extensions_string WGL_EXT_framebuffer_sRGB WGL_EXT_pixel_format_packed_float WGL_EXT_swap_control WGL_NV_float_buffer WGL_NV_render_depth_texture WGL_NV_render_texture_rectangle
09:32:55: ***************************
09:32:55: *** GL Renderer Started ***
09:32:55: ***************************
09:32:55: Registering ResourceManager for type GpuProgram
09:32:55: GLSL support detected
09:32:55: GL: Using GL_EXT_framebuffer_object for rendering to textures (best)
09:32:55: FBO PF_UNKNOWN depth/stencil support: D16S0 D24S0 D32S0 Packed-D24S8
09:32:55: FBO PF_L8 depth/stencil support: D0S0 D16S0 D24S0 D32S0 Packed-D24S8
09:32:55: FBO PF_A8 depth/stencil support: D0S0 D16S0 D24S0 D32S0 Packed-D24S8
09:32:55: FBO PF_A4L4 depth/stencil support: D0S0 D16S0 D24S0 D32S0 Packed-D24S8
09:32:55: FBO PF_BYTE_LA depth/stencil support: D0S0 D16S0 D24S0 D32S0 Packed-D24S8
09:32:55: FBO PF_R5G6B5 depth/stencil support: D0S0 D16S0 D24S0 D32S0 Packed-D24S8
09:32:55: FBO PF_B5G6R5 depth/stencil support: D0S0 D16S0 D24S0 D32S0 Packed-D24S8
09:32:55: FBO PF_A1R5G5B5 depth/stencil support: D0S0 D16S0 D24S0 D32S0 Packed-D24S8
09:32:56: FBO PF_R8G8B8 depth/stencil support: D0S0 D16S0 D24S0 D32S0 Packed-D24S8
09:32:56: FBO PF_B8G8R8 depth/stencil support: D0S0 D16S0 D24S0 D32S0 Packed-D24S8
09:32:56: FBO PF_A8R8G8B8 depth/stencil support: D0S0 D16S0 D24S0 D32S0 Packed-D24S8
09:32:56: FBO PF_B8G8R8A8 depth/stencil support: D0S0 D16S0 D24S0 D32S0 Packed-D24S8
09:32:56: FBO PF_A2R10G10B10 depth/stencil support: D0S0 D16S0 D24S0 D32S0 Packed-D24S8
09:32:56: FBO PF_A2B10G10R10 depth/stencil support: D0S0 D16S0 D24S0 D32S0 Packed-D24S8
09:32:56: FBO PF_FLOAT16_RGB depth/stencil support: D0S0 D16S0 D24S0 D32S0 Packed-D24S8
09:32:56: FBO PF_FLOAT16_RGBA depth/stencil support: D0S0 D16S0 D24S0 D32S0 Packed-D24S8
09:32:56: FBO PF_FLOAT32_RGB depth/stencil support: D0S0 D16S0 D24S0 D32S0 Packed-D24S8
09:32:56: FBO PF_FLOAT32_RGBA depth/stencil support: D0S0 D16S0 D24S0 D32S0 Packed-D24S8
09:32:56: FBO PF_X8R8G8B8 depth/stencil support: D0S0 D16S0 D24S0 D32S0 Packed-D24S8
09:32:56: FBO PF_X8B8G8R8 depth/stencil support: D0S0 D16S0 D24S0 D32S0 Packed-D24S8
09:32:56: FBO PF_SHORT_RGBA depth/stencil support: D0S0 D16S0 D24S0 D32S0 Packed-D24S8
09:32:56: FBO PF_R3G3B2 depth/stencil support: D0S0 D16S0 D24S0 D32S0 Packed-D24S8
09:32:56: FBO PF_FLOAT16_R depth/stencil support: D0S0 D16S0 D24S0 D32S0 Packed-D24S8
09:32:56: FBO PF_FLOAT32_R depth/stencil support: D0S0 D16S0 D24S0 D32S0 Packed-D24S8
09:32:56: FBO PF_FLOAT16_GR depth/stencil support: D0S0 D16S0 D24S0 D32S0 Packed-D24S8
09:32:56: FBO PF_FLOAT32_GR depth/stencil support: D0S0 D16S0 D24S0 D32S0 Packed-D24S8
09:32:57: FBO PF_SHORT_RGB depth/stencil support: D0S0 D16S0 D24S0 D32S0 Packed-D24S8
09:32:57: [GL] : Valid FBO targets PF_UNKNOWN PF_L8 PF_A8 PF_A4L4 PF_BYTE_LA PF_R5G6B5 PF_B5G6R5 PF_A1R5G5B5 PF_R8G8B8 PF_B8G8R8 PF_A8R8G8B8 PF_B8G8R8A8 PF_A2R10G10B10 PF_A2B10G10R10 PF_FLOAT16_RGB PF_FLOAT16_RGBA PF_FLOAT32_RGB PF_FLOAT32_RGBA PF_X8R8G8B8 PF_X8B8G8R8 PF_SHORT_RGBA PF_R3G3B2 PF_FLOAT16_R PF_FLOAT32_R PF_FLOAT16_GR PF_FLOAT32_GR PF_SHORT_RGB
09:32:57: RenderSystem capabilities
09:32:57: -------------------------
09:32:57: * Hardware generation of mipmaps: yes
09:32:57: * Texture blending: yes
09:32:57: * Anisotropic texture filtering: yes
09:32:57: * Dot product texture operation: yes
09:32:57: * Cube mapping: yes
09:32:57: * Hardware stencil buffer: yes
09:32:57: - Stencil depth: 8
09:32:57: - Two sided stencil support: yes
09:32:57: - Wrap stencil values: yes
09:32:57: * Hardware vertex / index buffers: yes
09:32:57: * Vertex programs: yes
09:32:57: - Max vertex program version: vp40
09:32:57: * Fragment programs: yes
09:32:57: - Max fragment program version: fp40
09:32:57: * Texture Compression: yes
09:32:57: - DXT: yes
09:32:57: - VTC: yes
09:32:57: * Scissor Rectangle: yes
09:32:57: * Hardware Occlusion Query: yes
09:32:57: * User clip planes: yes
09:32:57: * VET_UBYTE4 vertex element type: yes
09:32:57: * Infinite far plane projection: yes
09:32:57: * Hardware render-to-texture: yes
09:32:57: * Floating point textures: yes
09:32:57: * Non-power-of-two textures: yes
09:32:57: * Volume textures: yes
09:32:57: * Multiple Render Targets: 8
09:32:57: * Point Sprites: yes
09:32:57: * Extended point parameters: yes
09:32:57: * Max Point Size: 63.375
09:32:57: * Vertex texture fetch: yes
09:32:57: - Max vertex textures: 32
09:32:57: - Vertex textures shared: yes
09:32:57: Registering ResourceManager for type Texture
09:32:57: ResourceBackgroundQueue - threading disabled
09:32:57: Particle Renderer Type 'billboard' registered
09:32:57: SceneManagerFactory for type 'BspSceneManager' registered.
09:32:57: Registering ResourceManager for type BspLevel
09:32:57: SceneManagerFactory for type 'OctreeSceneManager' registered.
09:32:57: SceneManagerFactory for type 'TerrainSceneManager' registered.
09:32:57: Parsing scripts for resource group Autodetect
09:32:57: Finished parsing scripts for resource group Autodetect
09:32:57: Parsing scripts for resource group Bootstrap
09:32:57: Parsing script OgreCore.material
09:32:57: Parsing script OgreProfiler.material
09:32:57: Parsing script Ogre.fontdef
09:32:57: Parsing script OgreDebugPanel.overlay
09:32:57: Texture: New_Ogre_Border_Center.png: Loading 1 faces(PF_A8R8G8B8,256x128x1) with 5 hardware generated mipmaps from Image. Internal format is PF_A8R8G8B8,256x128x1.
09:32:57: Texture: New_Ogre_Border.png: Loading 1 faces(PF_A8R8G8B8,256x256x1) with 5 hardware generated mipmaps from Image. Internal format is PF_A8R8G8B8,256x256x1.
09:32:57: Texture: New_Ogre_Border_Break.png: Loading 1 faces(PF_A8R8G8B8,32x32x1) with 5 hardware generated mipmaps from Image. Internal format is PF_A8R8G8B8,32x32x1.
09:32:57: Font BlueHighwayusing texture size 512x512
09:32:57: Info: Freetype returned null for character 127 in font BlueHighway
09:32:57: Info: Freetype returned null for character 128 in font BlueHighway
09:32:57: Info: Freetype returned null for character 129 in font BlueHighway
09:32:57: Info: Freetype returned null for character 130 in font BlueHighway
09:32:57: Info: Freetype returned null for character 131 in font BlueHighway
09:32:57: Info: Freetype returned null for character 132 in font BlueHighway
09:32:57: Info: Freetype returned null for character 133 in font BlueHighway
09:32:57: Info: Freetype returned null for character 134 in font BlueHighway
09:32:57: Info: Freetype returned null for character 135 in font BlueHighway
09:32:57: Info: Freetype returned null for character 136 in font BlueHighway
09:32:57: Info: Freetype returned null for character 137 in font BlueHighway
09:32:57: Info: Freetype returned null for character 138 in font BlueHighway
09:32:57: Info: Freetype returned null for character 139 in font BlueHighway
09:32:57: Info: Freetype returned null for character 140 in font BlueHighway
09:32:57: Info: Freetype returned null for character 141 in font BlueHighway
09:32:57: Info: Freetype returned null for character 142 in font BlueHighway
09:32:57: Info: Freetype returned null for character 143 in font BlueHighway
09:32:57: Info: Freetype returned null for character 144 in font BlueHighway
09:32:57: Info: Freetype returned null for character 145 in font BlueHighway
09:32:57: Info: Freetype returned null for character 146 in font BlueHighway
09:32:57: Info: Freetype returned null for character 147 in font BlueHighway
09:32:57: Info: Freetype returned null for character 148 in font BlueHighway
09:32:57: Info: Freetype returned null for character 149 in font BlueHighway
09:32:57: Info: Freetype returned null for character 150 in font BlueHighway
09:32:57: Info: Freetype returned null for character 151 in font BlueHighway
09:32:57: Info: Freetype returned null for character 152 in font BlueHighway
09:32:57: Info: Freetype returned null for character 153 in font BlueHighway
09:32:57: Info: Freetype returned null for character 154 in font BlueHighway
09:32:57: Info: Freetype returned null for character 155 in font BlueHighway
09:32:57: Info: Freetype returned null for character 156 in font BlueHighway
09:32:57: Info: Freetype returned null for character 157 in font BlueHighway
09:32:57: Info: Freetype returned null for character 158 in font BlueHighway
09:32:57: Info: Freetype returned null for character 159 in font BlueHighway
09:32:57: Info: Freetype returned null for character 160 in font BlueHighway
09:32:57: Texture: BlueHighwayTexture: Loading 1 faces(PF_BYTE_LA,512x512x1) with hardware generated mipmaps from Image. Internal format is PF_BYTE_LA,512x512x1.
09:32:57: Texture: ogretext.png: Loading 1 faces(PF_A8R8G8B8,256x128x1) with 5 hardware generated mipmaps from Image. Internal format is PF_A8R8G8B8,256x128x1.
09:32:57: Parsing script OgreLoadingPanel.overlay
09:32:57: Finished parsing scripts for resource group Bootstrap
09:32:57: Parsing scripts for resource group ET
09:32:57: Parsing script ETShader.program
09:32:57: Parsing script ETTerrain.material
09:32:57: Finished parsing scripts for resource group ET
09:32:57: Parsing scripts for resource group General
09:32:57: Parsing script Example.material
09:32:57: Error in material Examples/MorningSkyBox at line 212 of Example.material: Invalid vertex_program_ref entry - vertex program Ogre/BasicVertexPrograms/AmbientOneTexture has not been defined.
09:32:57: OGRE EXCEPTION(6:FileNotFoundException): Cannot locate resource hdr.cg in resource group General or any other group. in ResourceGroupManager::openResource at ..\src\OgreResourceGroupManager.cpp (line 604)
09:32:57: High-level program Examples/MorningSkyBoxHDRfp encountered an error during loading and is thus not supported.
OGRE EXCEPTION(6:FileNotFoundException): Cannot locate resource hdr.cg in resource group General or any other group. in ResourceGroupManager::openResource at ..\src\OgreResourceGroupManager.cpp (line 604)
09:32:57: OGRE EXCEPTION(6:FileNotFoundException): Cannot locate resource hdr.cg in resource group General or any other group. in ResourceGroupManager::openResource at ..\src\OgreResourceGroupManager.cpp (line 604)
09:32:57: High-level program Examples/MorningCubeMapHDRfp encountered an error during loading and is thus not supported.
OGRE EXCEPTION(6:FileNotFoundException): Cannot locate resource hdr.cg in resource group General or any other group. in ResourceGroupManager::openResource at ..\src\OgreResourceGroupManager.cpp (line 604)
09:32:57: Error in material Examples/CloudySky at line 307 of Example.material: Unrecognised command: #Overrides
09:32:57: Error in material Examples/CloudySky at line 308 of Example.material: Unrecognised command: #fog_override
09:32:57: Error in material Examples/Robot at line 700 of Example.material: Invalid vertex_program_ref entry - vertex program Ogre/HardwareSkinningOneWeight has not been defined.
09:32:57: Error in material Examples/Robot at line 712 of Example.material: Invalid shadow_caster_vertex_program_ref entry - vertex program Ogre/HardwareSkinningOneWeightShadowCaster has not been defined.
09:32:57: OGRE EXCEPTION(6:FileNotFoundException): Cannot locate resource Grass.cg in resource group General or any other group. in ResourceGroupManager::openResource at ..\src\OgreResourceGroupManager.cpp (line 604)
09:32:57: High-level program Examples/GrassWaverVp encountered an error during loading and is thus not supported.
OGRE EXCEPTION(6:FileNotFoundException): Cannot locate resource Grass.cg in resource group General or any other group. in ResourceGroupManager::openResource at ..\src\OgreResourceGroupManager.cpp (line 604)
09:32:57: Error in material Examples/HardwareMorphAnimation at line 847 of Example.material: Invalid vertex_program_ref entry - vertex program Ogre/HardwareMorphAnimation has not been defined.
09:32:57: Error in material Examples/HardwarePoseAnimation at line 882 of Example.material: Invalid vertex_program_ref entry - vertex program Ogre/HardwarePoseAnimation has not been defined.
09:32:57: Error in material jaiqua at line 990 of Example.material: Invalid vertex_program_ref entry - vertex program Ogre/HardwareSkinningTwoWeights has not been defined.
09:32:57: Error in material jaiqua at line 995 of Example.material: Invalid shadow_caster_vertex_program_ref entry - vertex program Ogre/HardwareSkinningTwoWeightsShadowCaster has not been defined.
09:32:57: Parsing script Ogre.material
09:32:57: Parsing script frustum.material
09:32:57: Parsing script hitstars.material
09:32:57: Parsing script LensFlare.material
09:32:57: Parsing script lifebar.material
09:32:57: Parsing script particles.material
09:32:57: Parsing script water.material
09:32:57: Error in material Water/WaterPlane at line 18 of water.material: Bad env_map attribute, valid parameters are 'off', 'spherical', 'planar', 'cubic_reflection' and 'cubic_normal'.
09:32:57: Error in material Water/WaterFall at line 38 of water.material: Bad env_map attribute, valid parameters are 'off', 'spherical', 'planar', 'cubic_reflection' and 'cubic_normal'.
09:32:57: Parsing script grass.material
09:32:57: Parsing script privateA.material
09:32:57: Parsing script privateB.material
09:32:57: Parsing script CJ.material
09:32:57: Parsing script LT.material
09:32:57: Parsing script robot.material
09:32:57: Parsing script axe01_mat.material
09:32:57: Parsing script bed01_mat.material
09:32:57: Parsing script box01_mat.material
09:32:57: Parsing script Bush01_mat.material
09:32:57: Parsing script candelabrum01_mat.material
09:32:57: Parsing script chair04_mat.material
09:32:57: Parsing script chisel01_mat.material
09:32:57: Parsing script Cuartel.material
09:32:57: Parsing script Cupboard04_mat.material
09:32:57: Parsing script dish01_mat.material
09:32:57: Parsing script fountain01_mat.material
09:32:57: Parsing script frame01_mat.material
09:32:57: Parsing script glass01_mat.material
09:32:57: Parsing script granary01_mat.material
09:32:57: Parsing script roller01_mat.material
09:32:57: Parsing script table04_mat.material
09:32:57: Parsing script Tree01_mat.material
09:32:57: Parsing script winebag01_mat.material
09:32:57: Parsing script House_01.material
09:32:57: Parsing script House_02.material
09:32:57: Parsing script House_03.material
09:32:57: Parsing script House_04.material
09:32:57: Parsing script depthmap.material
09:32:57: GLSL compiling: Chicken/FragmentSampler
09:32:57: GLSL compiled : Chicken/FragmentSampler
09:32:57: GLSL compiling: Chicken/FragmentDepthMap
09:32:57: GLSL compiled : Chicken/FragmentDepthMap
09:32:57: Parsing script skybox.material
09:32:57: Error in material Chicken/CloudySky at line 16 of skybox.material: Unrecognised command: #Overrides
09:32:57: Error in material Chicken/CloudySky at line 17 of skybox.material: Unrecognised command: #fog_override
09:32:57: Parsing script swordEffects.material
09:32:57: Parsing script depthmap.compositor
09:32:57: Parsing script sample.fontdef
09:32:57: Parsing script ChickenParticles.particle
09:32:57: Parsing script ChickenWaterfall.particle
09:32:57: Parsing script DebugPanel.overlay
09:32:57: Parsing script Help.overlay
09:32:57: Finished parsing scripts for resource group General
09:32:57: Parsing scripts for resource group Internal
09:32:57: Finished parsing scripts for resource group Internal
09:32:57: Parsing scripts for resource group LUA
09:32:57: Parsing script 3d-diggers_fir.material
09:32:57: Parsing script farn1.mesh.material
09:32:57: Parsing script farn2.mesh.material
09:32:57: Parsing script plant1.mesh.material
09:32:57: Parsing script plant2.mesh.material
09:32:57: Parsing script shrooms.material
09:32:57: Parsing script skybox.material
09:32:57: Parsing script tree.material
09:32:57: Finished parsing scripts for resource group LUA
09:32:57: Texture: AquaLook.png: Loading 1 faces(PF_A8R8G8B8,512x512x1) with hardware generated mipmaps from Image. Internal format is PF_A8R8G8B8,512x512x1.
09:32:57: Texture: editorMenu.png: Loading 1 faces(PF_A8R8G8B8,400x300x1) with hardware generated mipmaps from Image. Internal format is PF_A8R8G8B8,400x300x1.
09:32:57: Texture: flare.png: Loading 1 faces(PF_R8G8B8,256x256x1) with hardware generated mipmaps from Image. Internal format is PF_X8R8G8B8,256x256x1.
09:32:57: Texture: Intro.png: Loading 1 faces(PF_A8R8G8B8,1024x768x1) with hardware generated mipmaps from Image. Internal format is PF_A8R8G8B8,1024x768x1.
09:32:57: Texture: MenuItems.png: Loading 1 faces(PF_A8R8G8B8,512x512x1) with hardware generated mipmaps from Image. Internal format is PF_A8R8G8B8,512x512x1.
09:32:57: Texture: ../ET/ETminimap.png: Loading 1 faces(PF_R8G8B8,512x512x1) with hardware generated mipmaps from Image. Internal format is PF_X8R8G8B8,512x512x1.
09:32:57: Texture: objects.png: Loading 1 faces(PF_A8R8G8B8,512x512x1) with hardware generated mipmaps from Image. Internal format is PF_A8R8G8B8,512x512x1.
09:32:57: Texture: menuIntro.png: Loading 1 faces(PF_A8R8G8B8,640x640x1) with hardware generated mipmaps from Image. Internal format is PF_A8R8G8B8,640x640x1.
09:32:57: Texture: menuGameOver.png: Loading 1 faces(PF_A8R8G8B8,640x480x1) with hardware generated mipmaps from Image. Internal format is PF_A8R8G8B8,640x480x1.
09:32:57: Texture: menuPlay.png: Loading 1 faces(PF_A8R8G8B8,1024x1024x1) with hardware generated mipmaps from Image. Internal format is PF_A8R8G8B8,1024x1024x1.
09:32:57: Texture: menuLoading.png: Loading 1 faces(PF_A8R8G8B8,640x640x1) with hardware generated mipmaps from Image. Internal format is PF_A8R8G8B8,640x640x1.
09:32:58: Creating viewport on target 'Chicken Jiménez', rendering from camera 'CameraGOD0', relative dimensions L: 0.00 T: 0.00 W: 1.00 H: 1.00 ZOrder: 0

SongOfTheWeave

14-09-2008 08:58:33

Nothing is jumping out at me as the cause...

Anything I've thought of that would cause something like this would show up in the log as a CG compile warning/error or a material warning/error.

I would highly recommend cleaning out those other material errors, especially ones for stuff you're not using, so that you can find and address relevant errors more easily. But that (probably) won't solve the problem at hand.

Just to rule out the obvious, does your terrain render properly if you comment out the fog pass? It's a stupid test, but worth doing in case you've modified something unrelated that's unexpectedly causing problems.

Did you put the .program file entry in properly? (If this was wrong it should put an error in the log, even if it was just a parameter error... so it shouldn't be this, unless I missed the error in with all those other errors.)

I suppose you could paste your program file and your terrain material since I don't know where else to look.

SongOfTheWeave

14-09-2008 09:08:13

Actually, at different camera angles do you ever get the artifacts you see to look like a grid of.. I think they're hexagons? (or some shape like that) IIRC it's most clear when you look down on the terrain from some distance. Try zooming in and out to see if you can get it to look like that. It would be especially prominent on a semi-flat terrain (rolling hills rather than sharp mountains.)

If you can get that it's an LoD issue and somehow the parameters to the vertex program aren't getting set right.

EDIT: Another thing to check is that your fog parameters are set in a manner that makes sense or you might end up with everything solid fog. Though that wouldn't cause the thing that looks like z-fighting/tearing that you're getting

milacao

14-09-2008 09:33:50

:shock:

I'm stupid... I'm not sure, because I removed everything related to fog, but now I've done again the steps, it works! LoL the only thing is that related to de LOD: new polygons don't appear in a smooth way, and edges are clearly visible. Can any of the shader parameters affect this behaviour and correct it? Wouldn't it be better to use a pixel shader?

Thanks again!

SongOfTheWeave

14-09-2008 20:58:04

The line that modifies the y component of position in the fog shader is the same LoD correction that is used in CABAListic's splatting shaders that are included with ETM. As long as all the parameters are the same it shouldn't exhibit LoD issues, and I haven't noticed any on my side (haven't looked for them extensively though).

Doing the camera to point distance calculation in the vertex shader seems to look good enough for me. If a polygon was very long (i.e. the distance to the camera was much different at one point on the polygon then at another) you would see smoother fog if you did the distance calculation in the pixel shader, but since the polygons in ETM terrain are smallish (at a distance where fog is apparent) I don't see any visible benefit moving the calculation to the pixel shader.

milacao

18-09-2008 08:42:36

Aha, I understand... I'll try it this weekend and let you know.
Thanks!