Multitexturing entity - PseudoTerrain

Everything related to 3D programming
User avatar
Lexicon
User
User
Posts: 98
Joined: Mon Jul 22, 2013 6:16 am
Contact:

Multitexturing entity - PseudoTerrain

Post 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.
PureBasic 5.11 | WinXP | 2GB RAM | GForce GT240
User avatar
Lexicon
User
User
Posts: 98
Joined: Mon Jul 22, 2013 6:16 am
Contact:

Re: Multitexturing entity - PseudoTerrain

Post 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.
PureBasic 5.11 | WinXP | 2GB RAM | GForce GT240
User avatar
DK_PETER
Addict
Addict
Posts: 904
Joined: Sat Feb 19, 2011 10:06 am
Location: Denmark
Contact:

Re: Multitexturing entity - PseudoTerrain

Post 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
Current configurations:
Ubuntu 20.04/64 bit - Window 10 64 bit
Intel 6800K, GeForce Gtx 1060, 32 gb ram.
Amd Ryzen 9 5950X, GeForce 3070, 128 gb ram.
User avatar
Lexicon
User
User
Posts: 98
Joined: Mon Jul 22, 2013 6:16 am
Contact:

Re: Multitexturing entity - PseudoTerrain

Post 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.
PureBasic 5.11 | WinXP | 2GB RAM | GForce GT240
User avatar
DK_PETER
Addict
Addict
Posts: 904
Joined: Sat Feb 19, 2011 10:06 am
Location: Denmark
Contact:

Re: Multitexturing entity - PseudoTerrain

Post 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
Current configurations:
Ubuntu 20.04/64 bit - Window 10 64 bit
Intel 6800K, GeForce Gtx 1060, 32 gb ram.
Amd Ryzen 9 5950X, GeForce 3070, 128 gb ram.
applePi
Addict
Addict
Posts: 1404
Joined: Sun Jun 25, 2006 7:28 pm

Re: Multitexturing entity - PseudoTerrain

Post 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
User avatar
Lexicon
User
User
Posts: 98
Joined: Mon Jul 22, 2013 6:16 am
Contact:

Re: Multitexturing entity - PseudoTerrain

Post 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.
PureBasic 5.11 | WinXP | 2GB RAM | GForce GT240
User avatar
DK_PETER
Addict
Addict
Posts: 904
Joined: Sat Feb 19, 2011 10:06 am
Location: Denmark
Contact:

Re: Multitexturing entity - PseudoTerrain

Post 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.
Current configurations:
Ubuntu 20.04/64 bit - Window 10 64 bit
Intel 6800K, GeForce Gtx 1060, 32 gb ram.
Amd Ryzen 9 5950X, GeForce 3070, 128 gb ram.
Olby
Enthusiast
Enthusiast
Posts: 461
Joined: Mon Jan 12, 2009 10:33 am
Contact:

Re: Multitexturing entity - PseudoTerrain

Post 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. :)
Intel Core i7 Quad 2.3 Ghz, 8GB RAM, GeForce GT 630M 2GB, Windows 10 (x64)
User avatar
DK_PETER
Addict
Addict
Posts: 904
Joined: Sat Feb 19, 2011 10:06 am
Location: Denmark
Contact:

Re: Multitexturing entity - PseudoTerrain

Post 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.
Current configurations:
Ubuntu 20.04/64 bit - Window 10 64 bit
Intel 6800K, GeForce Gtx 1060, 32 gb ram.
Amd Ryzen 9 5950X, GeForce 3070, 128 gb ram.
PMV
Enthusiast
Enthusiast
Posts: 727
Joined: Sat Feb 24, 2007 3:15 pm
Location: Germany

Re: Multitexturing entity - PseudoTerrain

Post 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
applePi
Addict
Addict
Posts: 1404
Joined: Sun Jun 25, 2006 7:28 pm

Re: Multitexturing entity - PseudoTerrain

Post 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
User avatar
Comtois
Addict
Addict
Posts: 1432
Joined: Tue Aug 19, 2003 11:36 am
Location: Doubs - France

Re: Multitexturing entity - PseudoTerrain

Post 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
Please correct my english
http://purebasic.developpez.com/
User avatar
Lexicon
User
User
Posts: 98
Joined: Mon Jul 22, 2013 6:16 am
Contact:

Re: Multitexturing entity - PseudoTerrain

Post 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. :(
PureBasic 5.11 | WinXP | 2GB RAM | GForce GT240
User avatar
Comtois
Addict
Addict
Posts: 1432
Joined: Tue Aug 19, 2003 11:36 am
Location: Doubs - France

Re: Multitexturing entity - PseudoTerrain

Post 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
Please correct my english
http://purebasic.developpez.com/
Post Reply