Don't appologize for your english, it is quite good. By the way I checked the links in your signature and found they lead to spanish Lite-C sites. Are you spanish? If so, what a coincidence! I am spanish too!

Back on topic: After revising your code again carefully with your explanation I think I understand it now. Thanks!

I am now in the process of adapting it, so it can tile textures withought caring about scale or if the blocks are snapped on a grid (or abrirtarily sized med models withought having to calculate the relative size compared with a "standard" block). So there can be half-width blocks or whatever and still continue to be perfectly tiled (or even bigger more complex structures withought having to calculate what the corresponding scale is. For this i am trying to take into account normals like you do, and taking into account global position instead of modifying local UV coordinates.

It helps me alot to have your shader to work on, It is generally hard for me to get the structure of a shader right from scratch but am pretty good at modifying one.



This is an example of what I am trying to achieve, thats why I am trying to modify your code to use world coordinates instead of local UV coordinates+scale.

This is what I have so far:
Code:
float4x4 matWorld;
float4x4 matWorldViewProj;
float4 vecSkill41;

texture entSkin1;

sampler TexSampler = sampler_state
{
	Texture = <entSkin1>;
	MipFilter = Linear;
	AddressU = Wrap;
	Addressv = Wrap;
};

struct out_tiling
{
	float4 Pos    : POSITION;
	float2 Tex0   : TEXCOORD0;
};

out_tiling vs_20
(
	in float4 inPos	 : POSITION,
	in float3 inNormal : NORMAL,
	in float2 inTex0	 : TEXCOORD0
)
{
	out_tiling Out;
	
	Out.Pos = mul(inPos,matWorldViewProj);
		
	Out.Tex0.x = Out.Pos.x + (Out.Pos.y*inNormal.z);
	Out.Tex0.y = Out.Pos.z + (Out.Pos.y*inNormal.x);
	return Out;
}
	
float4 ps_20 ( out_tiling In ): COLOR
{
	return tex2D ( TexSampler, In.Tex0 );
}

technique TexTile
{
	pass one
	{
		VertexShader = compile vs_2_0 vs_20();
		PixelShader = compile ps_2_0 ps_20();			
	}		
}



One thing... If I remeber correctly, in shaders y and z axis are swappped, right? (It's been a long time since I played around with shaders)


"The more you know, the more you realize how little you know..."

I <3 HORUS
http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Number=401929&page=1