Page 1 of 2

Multitexturing entity - PseudoTerrain

Posted: Wed Aug 07, 2013 8:22 am
by Lexicon
Hi!

I have an entity (pseudoterrain) 5x5 vertexes and 5 associated textures. How may I do this:

0x2 vert - texture 3
0x3 vert - texture 3
1x1 vert - texture 0
1x2 vert - texture 2
1x3 vert - texture 3
2x2 vert - texture 2
3x3 vert - texture 1
3x4 vert - texture 1
etc.

Code: Select all

0-0-3-3-0
0-0-2-3-0
0-0-2-0-0
0-0-0-1-1
0-4-3-4-0
Thanks for your answers.

Re: Multitexturing entity - PseudoTerrain

Posted: Mon Aug 12, 2013 11:50 am
by Lexicon
:( No answers...

http://stalkerfangroup.ru/_fr/4/7458484.jpg

Please look... I have 3 textures on this screen: grass (green), asphalt (grey) and ground (brown, under truck). How can I made this on the mesh?

Thanks.

Re: Multitexturing entity - PseudoTerrain

Posted: Mon Aug 12, 2013 2:59 pm
by DK_PETER
Hi Lexicon.

I'm just about ready to move into this area too.
Scripting would be a good way to apply individual textures to a mesh or...
Have a look at: SetMeshMaterial(#Mesh, MaterialID [, SubMesh])

Best regards
Peter

Re: Multitexturing entity - PseudoTerrain

Posted: Mon Aug 12, 2013 4:26 pm
by Lexicon
DK_PETER wrote:Hi Lexicon.

I'm just about ready to move into this area too.
Scripting would be a good way to apply individual textures to a mesh or...
Have a look at: SetMeshMaterial(#Mesh, MaterialID [, SubMesh])

Best regards
Peter
Thank you Peter!
But how? Mesh is the plane with many vertices. How can I impose a segment of one texture over a segment of another? I want to use mesh instead of terrain.

Re: Multitexturing entity - PseudoTerrain

Posted: Mon Aug 12, 2013 4:57 pm
by DK_PETER
Lexicon wrote:
DK_PETER wrote:Hi Lexicon.

I'm just about ready to move into this area too.
Scripting would be a good way to apply individual textures to a mesh or...
Have a look at: SetMeshMaterial(#Mesh, MaterialID [, SubMesh])

Best regards
Peter
Thank you Peter!
But how? Mesh is the plane with many vertices. How can I impose a segment of one texture over a segment of another? I want to use mesh instead of terrain.
As I said. I'm fairly new at this. I'm going for one topic at a time. Olby, ApplePi or Comtois might know an easier way.
But that said: Adding multiple textures are (correct me anyone, if I'm wrong) done using AddMaterialLayer(#Material, TextureID [, Mode])
and then applied to your mesh. Whether there is a simpler method, I do not know...yet. If you want to position a material at a specific
location, then you can use the SetMeshMaterial(#Mesh, MaterialID [, SubMesh]).

Best regards
Peter

Re: Multitexturing entity - PseudoTerrain

Posted: Mon Aug 12, 2013 5:10 pm
by applePi
i prefer the easy and lazy way to such task, ie using free external programs to do the hard task, i am preparing a post for the 3D section how to use Sculptris freeware to texture a plane with 2 textures or more by simply painting the texture over the plain with a brush then exporting to obj, manipulating the *.mtl a little then using OgreAssimpConverter to convert obj to mesh. i have succeeded in doing this right now, i need to write the post and to take photo shots from Sculptris ,i hope i will finish in 2 hours

Re: Multitexturing entity - PseudoTerrain

Posted: Mon Aug 12, 2013 5:40 pm
by Lexicon
DK_PETER wrote: If you want to position a material at a specific
location, then you can use the SetMeshMaterial(#Mesh, MaterialID [, SubMesh]).
Thanks Peter. Interesting... What about a little example?
applePi wrote:i prefer the easy and lazy way to such task, ie using free external programs to do the hard task, i am preparing a post for the 3D section how to use Sculptris freeware to texture a plane with 2 textures or more by simply painting the texture over the plain with a brush then exporting to obj, manipulating the *.mtl a little then using OgreAssimpConverter to convert obj to mesh. i have succeeded in doing this right now, i need to write the post and to take photo shots from Sculptris ,i hope i will finish in 2 hours
Thanks applePi! I'll wait your post.

Re: Multitexturing entity - PseudoTerrain

Posted: Mon Aug 12, 2013 5:51 pm
by DK_PETER
Lexicon wrote:
DK_PETER wrote: If you want to position a material at a specific
location, then you can use the SetMeshMaterial(#Mesh, MaterialID [, SubMesh]).
Thanks Peter. Interesting... What about a little example?
applePi wrote:i prefer the easy and lazy way to such task, ie using free external programs to do the hard task, i am preparing a post for the 3D section how to use Sculptris freeware to texture a plane with 2 textures or more by simply painting the texture over the plain with a brush then exporting to obj, manipulating the *.mtl a little then using OgreAssimpConverter to convert obj to mesh. i have succeeded in doing this right now, i need to write the post and to take photo shots from Sculptris ,i hope i will finish in 2 hours
Thanks applePi! I'll wait your post.
@Lexicon:
There is one available in the 3D examples folder for AddMaterialLayer.pb :-)
And ApplePi has made an example here http://www.purebasic.fr/english/viewtop ... shMaterial.


@ApplePi.
Yep..That sounds interesting...Looking forward to reading your post.

Re: Multitexturing entity - PseudoTerrain

Posted: Mon Aug 12, 2013 5:57 pm
by Olby
It has been ages since I worked with low level meshes but from what I recall (at least using DirectX) you should have a specific vertex format. In DX it is called Flexible Vertex Format (FVF) http://msdn.microsoft.com/en-us/library ... 85%29.aspx. Basically it allows you to set the vertex format for the mesh. For example how many texture layers etc. it has. Then you assign different textures for each texture layer and blend them using the colour attributes of vertices. The more vertices mesh has the more detailed texture blending is possible (since it only occurs on each vertex). Like I said this is what I remember from way back. By looking at the current state of the PB-Mesh library I would say it is impossible unless you use dedicated material shaders. Although I might be wrong; it would be nice if someone could prove me wrong otherwise we don't see too many users in this section of forum. :)

Re: Multitexturing entity - PseudoTerrain

Posted: Mon Aug 12, 2013 6:12 pm
by DK_PETER
Olby wrote:It has been ages since I worked with low level meshes but from what I recall (at least using DirectX) you should have a specific vertex format. In DX it is called Flexible Vertex Format (FVF) http://msdn.microsoft.com/en-us/library ... 85%29.aspx. Basically it allows you to set the vertex format for the mesh. For example how many texture layers etc. it has. Then you assign different textures for each texture layer and blend them using the colour attributes of vertices. The more vertices mesh has the more detailed texture blending is possible (since it only occurs on each vertex). Like I said this is what I remember from way back. By looking at the current state of the PB-Mesh library I would say it is impossible unless you use dedicated material shaders. Although I might be wrong; it would be nice if someone could prove me wrong otherwise we don't see too many users in this section of forum. :)
So true..Let's hope, that it changes as PB continually gets improved on the 3D side.

Re: Multitexturing entity - PseudoTerrain

Posted: Mon Aug 12, 2013 7:03 pm
by PMV
PB already supportes the OGRE materials completely ... it is just not
reflected by the commands, but there is no need for a commend,
if you don't want to change it at runtime. Because there aren't many
people who know enough to help, you have do dig yourself into the
documentation of OGRE and play around to understand it.

http://www.ogre3d.org/docs/manual/manual_toc.html

and especially for Materials:
http://www.ogre3d.org/docs/manual/manual_14.html

As long as you just want to have multiple textures at one
mesh, you just have to use multiple texture-unites.
If you want to have special texture-mappings, you have
to know the mesh-format or more, a tool that can handle
it. Maybe blender with a export plugin? But that has nothing
to do with programming as it is pure graphic-design. So
for that i would search the ogre-forum for help :)

The reason why there aren't so many people at this area is,
because it is really complex and for PB a new feature, as
most of the functionality comes with the last main versions.
But good luck, i am glad about any one who gets some
experience there, as maybe i will need it some time. :mrgreen:
:wink:

MFG PMV

Re: Multitexturing entity - PseudoTerrain

Posted: Mon Aug 12, 2013 7:16 pm
by applePi
i have posted here http://www.purebasic.fr/english/viewtop ... 36&t=55936
some guidlines on using sculptris program to make and texture a models for purebasic the easy way

Re: Multitexturing entity - PseudoTerrain

Posted: Mon Aug 12, 2013 7:54 pm
by Comtois
you can call MeshVertexTextureCoordinate(u, v) multiple times between AddMeshVertex(x, y, z) calls to add multiple texture coordinates to a vertex.
An example here
http://www.purebasic.fr/english/viewtop ... 4&start=10

Re: Multitexturing entity - PseudoTerrain

Posted: Tue Aug 13, 2013 1:28 pm
by Lexicon
Comtois wrote:you can call MeshVertexTextureCoordinate(u, v) multiple times between AddMeshVertex(x, y, z) calls to add multiple texture coordinates to a vertex.
An example here
http://www.purebasic.fr/english/viewtop ... 4&start=10
Ok. I can colored vertices by different colors already. :) But I can't textured it by different textures. I don't understand this technology. :(

Re: Multitexturing entity - PseudoTerrain

Posted: Tue Aug 13, 2013 2:54 pm
by Comtois
Well i don't understand what you are trying to do, may be this can help ?

http://www.ogre3d.org/tikiwiki/Material ... transition