Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Texture doesn't repeat on mesh?

Author
Message
Da_Rhyno
15
Years of Service
User Offline
Joined: 25th May 2011
Location:
Posted: 30th Oct 2011 06:46
Hi everyone!

I'm trying to understand why this isn't working... It should repeat the texture over and over again on the mesh, but it's not for some odd reason.

Any help would be appreciated, thanks!

Rudolpho
20
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 30th Oct 2011 09:57
The default UV coordinates of the built-in primitives are 0..1 on both axises, resulting in the texture being wrapped around the object exactly once.
You can change that using either the vertexdata functions, or by converting the mesh to a memblock, editing the UV bytes and re-creating the mesh from that.

For what you want it would be the easiest to just scale the texture (scale object texture), which will simply repeat the texture to tile as many times in the U and V directions as you tell it (using a 0 < value < 1 for the scaling will result in the texture being only partially displayed on the plain, and negative values will tile the texture in a mirrored fashion).


"Why do programmers get Halloween and Christmas mixed up?"
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 30th Oct 2011 15:07
Quote: "It should repeat the texture over and over again on the mesh, but it's not for some odd reason."


Why should it?

Use Rudolpho's suggestion.
Da_Rhyno
15
Years of Service
User Offline
Joined: 25th May 2011
Location:
Posted: 30th Oct 2011 19:46
Thanks!

This is what got me confused, under the help file for the command "SET OBJECT TEXTURE", in the description:

Quote: "Setting the Texture Wrap Mode to zero will use the default wrap mode which repeat the pattern of the texture over and over"
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 30th Oct 2011 20:09
Yes, that is confusing.

What it means is that if your coordinates exceed 1 or are below 0 then the texture just repeats. For example, if your UV coordinates on a simple plain range from 0 to 2 instead of the usual 0 to 1 then you will get two copies of the texture, from 0 to 3 will give you three copies etc. There are other optionsas described in the help file. For example, with "clamping" then numbers in excess of 1 are held, i.e. clamped at 1 and numbers below zero are held at zero. Mirroring is another option.
Da_Rhyno
15
Years of Service
User Offline
Joined: 25th May 2011
Location:
Posted: 31st Oct 2011 05:31
Thanks... That really clarifies things up quite a bit.

Login to post a reply

Server time is: 2026-07-10 16:33:46
Your offset time is: 2026-07-10 16:33:46