Sign in to follow this  
psycoding

what does texture clamping mean ?

Recommended Posts

psycoding    100
Hello, The last days, I tried to load a md2 model exported from cinema 4d xl in my engine, but in the upper half of the walls of the room, there was no texture. In the readme of the c4d to md2 exporter there was a remark that the texture should be loaded using the 16+32 texture clamping option. Now what does that mean, or.. what do I have to do in my renderer to get these missing textures visible ? Is it a option in cinema 4d xl (I didn't fin anything) or is it something I have to do with the texture coordinates of my md2 model ? I already tread them as tiles (u=u1 mod 1024, v=v1 mod 1024); thanks in advance Here is a picture of the problem : http://www.autories.de/images/Radiosity_60000Tri_AA_CB_VL.jpg on the left wall you can see the missing texture

Share this post


Link to post
Share on other sites
Viik    252
In case you dont know - clamping is a one of the possible ways to adress texture when specified texture coordinates are out of [0..1] range. For example when tiling is used, texture will be repeated, when you use clamping the last texel closest to boundary will be used. For example if your texture has a thin black line on the right end of the texture, black color will be returned for "horizontal" texture coordinate that is greater than 1. I see on screeshot that texture is not missing, the border texels are simply stretched up to the ceiling.
It can be that during export all texture coordinates of your model was set strictly to [0..1] range. You need to fix this using some other modeling tool or manually by reading every vertex and assigning new texture coordinate, in simpliest case based on world position.

Share this post


Link to post
Share on other sites
matches81    474
as Viik said, clamping is one of a few ways to address textures.
When you use that mode to address a texture, every U- or V-coordinate greater than 1 will be interpreted as 1, every coordinate less than 0 will be interpreted as 0, i.e. the coordinates are clamped to [0,1].
That results in the texture's borders being stretched outwards.

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