Ogre next background picture tiling issue

Discussion area about developing with Ogre-Next (2.1, 2.2 and beyond)


Lax
Gnoll
Posts: 665
Joined: Mon Aug 06, 2007 12:53 pm
Location: Saarland, Germany
x 64

Ogre next background picture tiling issue

Post by Lax »

Hi,

I'm using background images which are moving in the background, as the player does move. The pictures are created to be seamless and are tiled. If the picture ends, it will start again.

The issue is, that I observe 1 pixel column artifact. I created a screenshot and marked the area in paint:

https://lukas-kalinowski.com/Homepage/w ... 2_22_0.png

This is my hlsl shader:

Code: Select all

Texture2D backgroundMap		: register(t0);
SamplerState samplerState	: register(s0);
float speedX;
float speedY;

float4 main(float2 uv0 : TEXCOORD0) : SV_Target
{
	// Apply scroll
	uv0.x += speedX;
	uv0.y += speedY;
	return backgroundMap.Sample( samplerState, uv0 );
}

The material which is used in compositor:

Code: Select all

// HLSL shaders
fragment_program NOWABackgroundPostprocess_ps_HLSL hlsl
{
	source NOWABackgroundPostprocess_ps.hlsl
	entry_point main
	target ps_5_0 ps_4_0 ps_4_0_level_9_1 ps_4_0_level_9_3
}

// Material definition
material NOWABackgroundPostprocess
{
	technique
	{
		
	pass
	{
		// https://forums.ogre3d.org/viewtopic.php?t=23280
		// https://forums.ogre3d.org/viewtopic.php?f=2&t=82855&p=515294&hilit=material+scroll+texture#p515294
		// scene_blend modulate
		scene_blend alpha_blend
		// scene_blend add
		//lighting off
		depth_check on
		depth_write off
		
		cull_hardware none

		vertex_program_ref Ogre/Compositor/Quad_vs
		{
		}

		fragment_program_ref NOWABackgroundPostprocess_ps
		{
			param_named speedX float 0
			param_named speedY float 0
		}

		texture_unit backgroundMap
		{
			texture Sky.png
			alpha_op_ex add src_manual src_texture 0.1
			filtering			trilinear
			scale 10 10
		}
	}
}
}

Has anybody an idea, what I'm doing wrong, or is there a bug in ogre?

Best Regards
Lax

http://www.lukas-kalinowski.com/Homepage/?page_id=1631
Please support Second Earth Technic Base built of Lego bricks for Lego ideas: https://ideas.lego.com/projects/81b9bd1 ... b97b79be62

User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5476
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1358

Re: Ogre next background picture tiling issue

Post by dark_sylinc »

Usually these problems boil down to the reference texture not being as perfectly tileable as you think, or a mipmap issue.

Try disabling mipmaps when loading the texture, or use point filtering (which disables mipmapping) instead of trilinear.
Or manually setup the HlmsSamplerblock to use min=FO_LINEAR, mag=FO_LINEAR, mip=FO_NONE (which is bilinear without mipmapping).

Lax
Gnoll
Posts: 665
Joined: Mon Aug 06, 2007 12:53 pm
Location: Saarland, Germany
x 64

Re: Ogre next background picture tiling issue

Post by Lax »

Hi,

thanks for the information.
I played a bit with some values like:

Code: Select all

Ogre::HlmsSamplerblock samplerblock;
			samplerblock.mU = Ogre::TextureAddressingMode::TAM_WRAP;
			samplerblock.mV = Ogre::TextureAddressingMode::TAM_WRAP;
			samplerblock.mW = Ogre::TextureAddressingMode::TAM_WRAP;
			samplerblock.mMaxAnisotropy = 0;
			samplerblock.mMagFilter = Ogre::FO_POINT;
			samplerblock.mMinFilter = Ogre::FO_POINT;
			samplerblock.mMipFilter = Ogre::FO_NONE;
			samplerblock.setFiltering(Ogre::TextureFilterOptions::TFO_NONE);

		this->passBackground[i]->setSamplerblock(samplerblock);
		
		tex->setNumMipmaps(0);
		material->compile();

But unfortunately nothing does improve the issue. The strange thing is, sometimes, the pixel line is not visible and if I move the player a bit, then it is visible again. It seems that it has something todo in rendering timing.
Do you have further ideas?

Best Regards
Lax

http://www.lukas-kalinowski.com/Homepage/?page_id=1631
Please support Second Earth Technic Base built of Lego bricks for Lego ideas: https://ideas.lego.com/projects/81b9bd1 ... b97b79be62