Archived

This topic is now archived and is closed to further replies.

Applying texture to part of an object?

This topic is 4946 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have a vertex buffer and index buffer for a surface, i want to apply multiple textures to this surface. But one texture I only want to apply to part of the surface, is it possible to somehow specify that no texture is needed in certain areas? What i am doing at the moment is that i have a large area around in my texture which is black so it appears no texture is being applied in the areas i don't want it to. This works fine for me, however it seems to be causing problems on other people's computers. Perhaps there is a smater way of doing this? But as far as i can tell, you have to specify u/v coordinates and its not possible to specify no texture instead of u/v coords. Here is a screenshot to illustrate the problem. I only want to apply the big swirly texture in certain areas: [edited by - SpaceDude on May 30, 2004 9:13:27 PM]

Share this post


Link to post
Share on other sites
I think the easiest way to do that is simply give the triangles that don't use the second texture some "black" texture coords. Fill one of the corners of the texture with black, and use it to texture every triangle that is not using the 2nd texture. This can be easily done in a modelling program.

Anyway, in a single mesh, you cannot specify to use a texture only in certain areas. I mean if you have two texture coordinates per vertex, every vertex must have them, and if you set two textures every triangle will use them both.

[edited by - Arcibald Wearlot on May 31, 2004 5:16:13 AM]

Share this post


Link to post
Share on other sites
quote:
Original post by Arcibald Wearlot
I think the easiest way to do that is simply give the triangles that don''t use the second texture some "black" texture coords. Fill one of the corners of the texture with black, and use it to texture every triangle that is not using the 2nd texture.


thats what i''m doing atm... but its not good, because if you skip from say coordinates 1,1 to 0,0 then it will draw everything that is accross the texture if you see what i mean..

Share this post


Link to post
Share on other sites
quote:
Original post by f8k8
Why not just disable texturing when drawing the non-textured triangles?



How would i do that? i mean, its not like opengl where i have a loop going through each triangle and rendering them one at a time. I just pass an index buffer and vertex buffer...

Humm.. i guess the only way is to split my index buffer into two, one containing the triangles that need texturing and the other containing the triangles that don't need it... ok that sounds like the best option. Thanks.

[edited by - SpaceDude on June 1, 2004 9:05:40 AM]

Share this post


Link to post
Share on other sites
I would suggest sorting your faces by textures and then creating vertex buffers according to what textures you have.

______________________________________

what we do in life, echoes in eternity

[edited by - Lokken on June 1, 2004 1:43:07 PM]

Share this post


Link to post
Share on other sites