CreateMesh mirror texture when shared vertex with other faces

Everything related to 3D programming
User avatar
minimy
Enthusiast
Enthusiast
Posts: 619
Joined: Mon Jul 08, 2013 8:43 pm
Location: off world

CreateMesh mirror texture when shared vertex with other faces

Post by minimy »

Hello, Is there a way to correctly put textures on a mesh created with CreateMesh()?
Let me explain, when you create a mesh and share the vertices with other faces, the faces are rotated or mirrored.

Code: Select all

__v1 __v2 __v3
__|-----|------|
__| face1 | face2 |
v4 |----- |------|v6
__| face3| face4 |
__|-----|------|
__v7 __v8 __v9
face1(v1,v2,v5,v4)
face2(v2,v3,v6,v5)
Here face1 and face2 share v2 and v5, in face2 the texture is the mirror of face1.

How can I avoid this?
If is using material, some body can put an example, please.

Thanks for help!
If translation=Error: reply="Sorry, Im Spanish": Endif
pjay
Enthusiast
Enthusiast
Posts: 252
Joined: Thu Mar 30, 2006 11:14 am

Re: CreateMesh mirror texture when shared vertex with other faces

Post by pjay »

Your vertices should be unique for each face if each vertex has different texture co'ordinates.
User avatar
minimy
Enthusiast
Enthusiast
Posts: 619
Joined: Mon Jul 08, 2013 8:43 pm
Location: off world

Re: CreateMesh mirror texture when shared vertex with other faces

Post by minimy »

pjay wrote: Wed Mar 06, 2024 4:34 pm Your vertices should be unique for each face if each vertex has different texture co'ordinates.
Hi pjay, thanks for help.
Then the way is AddSubMesh()... but if i use this way to make for example a terrain the speed in fps down from 480 fps in a decent matrix of (256x256) to 38 in a small matrix of (64x64)... i hope must exist a better way to do it.
How you can see is a great diference of speed.

I think the 'trick' will be in material, but i no control still. Im testing with many materials triying to find the good combination.

Any way, thanks for your help.
If translation=Error: reply="Sorry, Im Spanish": Endif
User avatar
pf shadoko
Enthusiast
Enthusiast
Posts: 386
Joined: Thu Jul 09, 2015 9:07 am

Re: CreateMesh mirror texture when shared vertex with other faces

Post by pf shadoko »

I'm not sure what you mean.
texture coordinates (UV) are not limited between 0 and 1
if you want it to repeat itself:

UV:
0,0---1,0---2,0
0,1---1,1---2,1
0,2---1,2---2,2
Post Reply