Sign in to follow this  
Angi_g

Texture Wrapping points

Recommended Posts

Angi_g    122
Hey guys I have seen in a few games lately (eg. devil may cry 4) that the texture library's are mainly consisting of texture sheets for level geometry. one of the fascinating things I found though was that the texture sheets (textures with around 5 or so elements that could be used in thousands of ways) had their texture elements in a tiled texture without new polygon creation eg: there is an area of the texture sheet that uses some roof tiles, they can crop the rest of the image then wrap the roof tiles like a single image, kind of like a independent texture I know you can change the dimensions of the texture in the sampler, but I was wondering if there is a type of crop function in the sampler (using VS/PS version 3) Thanks heaps! Angus

Share this post


Link to post
Share on other sites
MJP    19753
There's nothing you could do with sampler states or anything like that...you could do it manually in the shader I suppose using some fmods.

I would imagine that the DMC4 guys just explicitly wrap the UV's in the level geometry.

Share this post


Link to post
Share on other sites
Angi_g    122
thanks for the quick responses

MJP: whats a shader Fmod, whenever I hear Fmod I think of the sound engine, Google thinks that too. I am cool with manually hard-coding Coords and stuff as it will only be used in once special instance

majek: I have no idea how you would do that. to me tex2D goes something like this

texture
sampler
tex2d
????
profit!

Share this post


Link to post
Share on other sites
Angi_g    122
Thanks heaps MJP! fmod does the trick
there was a few troubles implementing it, like the edges of the texture had horrible artifacts, but its easily resolvable by turning off mip lvls
I make all object's in max, but it has that LAME z-up system, which makes UV invert the Y coord sometimes (Wierd Eh) I fixed it by inverting the fmod

Also, for the UV coordinates I did something like this

//X-YMul & X-YAdd are globals
float XCrop = -fmod(IN.UV.x,FcropX); //fmod is inverted due to 3ds max z-up sys
float YCrop = -fmod(IN.UV.y,FcropY);
float2 Tex = float2(XCrop,YCrop);
Tex *= float2(XMul,YMul); //Scale
Tex += float2(XAdd,YAdd); //Offset

so I have found its best to set your crop weights first, then set the UV scale and offset later

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