3d model with more than one texture
3d model with more than one texture
in bb3d its possible to load textures per surface.
it is possible to do this with the ogre format?
i,e, i have a level in any format(b3d, 3ds whatever) and i would apply 3 textures seperate to the mesh.
is there a way without shader to apply the textures per surface(or groups)?
one texture per mesh isn´t really good.
it is possible to do this with the ogre format?
i,e, i have a level in any format(b3d, 3ds whatever) and i would apply 3 textures seperate to the mesh.
is there a way without shader to apply the textures per surface(or groups)?
one texture per mesh isn´t really good.
Re: 3d model with more than one texture
You can use http://www.purebasic.com/documentation/ ... layer.html or use a material script. OGRE format does support more than one texture per mesh.
Re: 3d model with more than one texture
i can add several textures per mesh with that function?
and....thats the more important question....is it possible to add more than only .mesh format to pb?
btw. what kind of material script?is there any example?
i have a .b3d level with some textures.
how can i load this into pb?
and....thats the more important question....is it possible to add more than only .mesh format to pb?
btw. what kind of material script?is there any example?
i have a .b3d level with some textures.
how can i load this into pb?
Re: 3d model with more than one texture
if a level have ground, walls...whatever i should save each of them seperate?(select only what i would save-in modeller)
its one way but not really good....
i use ultimate unwrap 3d for texture adding....
with assimp to convert?or are there another tool for doing this?
why it is not possible to integrate a loader for some model formats with textures in pb?
its one way but not really good....
i use ultimate unwrap 3d for texture adding....
with assimp to convert?or are there another tool for doing this?
why it is not possible to integrate a loader for some model formats with textures in pb?
Re: 3d model with more than one texture
Because OGRE only supports it's own .mesh format. If you want anything else just write it yourself. B3D is a very basic/straightforward file format- easy to write a custom importer. This should get you going.N_Gnom wrote:if a level have ground, walls...whatever i should save each of them seperate?(select only what i would save-in modeller)
its one way but not really good....
i use ultimate unwrap 3d for texture adding....
with assimp to convert?or are there another tool for doing this?
why it is not possible to integrate a loader for some model formats with textures in pb?
Intel Core i7 Quad 2.3 Ghz, 8GB RAM, GeForce GT 630M 2GB, Windows 10 (x64)
Re: 3d model with more than one texture
You can have multiple texture-units per material (as many as the graphiccard supports)N_Gnom wrote:in bb3d its possible to load textures per surface.
it is possible to do this with the ogre format?
i,e, i have a level in any format(b3d, 3ds whatever) and i would apply 3 textures seperate to the mesh.
is there a way without shader to apply the textures per surface(or groups)?
one texture per mesh isn´t really good.
And if this question is the same meaning as your question in the german forum:
Every texture-unit can be set to a specific text-coordination-set, if the mesh has more then one.
material script texture-unit attribute "tex_coord_set":
http://www.ogre3d.org/docs/manual/manua ... rd_005fset
So, you can use different textures on different positions with one single mesh.
MFG PMV
Re: 3d model with more than one texture
@alexis: i know what you think...but if i have ten parts of a mesh i have to seperate all 10 parts of it...and convert it seperatly, load it seperatly...handly it seperatly...thats not the best way...
in b3d format there is no need of this....
there are surfaces and to every surface i can add a texture...
with another file format i.e. 3ds there are groups and that is the same problem....
btw. is here nobody who use models with more than one texture per model?
in b3d format there is no need of this....
there are surfaces and to every surface i can add a texture...
with another file format i.e. 3ds there are groups and that is the same problem....
btw. is here nobody who use models with more than one texture per model?
Re: 3d model with more than one texture
You can check the OGRE forum for such information.
Maybe you will find a step-by-step tut or something
similar.
In this case, you will have to use a 3D-Model-Software,
that is able to create multiple texture-coordinate-sets
and an exporter to get a OGRE mesh from that. If
you get this to be done, the exporter will probably
create the material-script for you and you will just
have to load it from the right path
MFG PMV
Maybe you will find a step-by-step tut or something
similar.
In this case, you will have to use a 3D-Model-Software,
that is able to create multiple texture-coordinate-sets
and an exporter to get a OGRE mesh from that. If
you get this to be done, the exporter will probably
create the material-script for you and you will just
have to load it from the right path
MFG PMV
Re: 3d model with more than one texture
thats no way for me....
i don´t want to have ever only workarounds....
i don´t want to have ever only workarounds....
Re: 3d model with more than one texture
yes, look at sinbad(examples/3D/DATA/Packs/Sinbad.zip (used in character.pb example) or this exampleN_Gnom wrote:btw. is here nobody who use models with more than one texture per model?
Code: Select all
#CameraSpeed = 1
IncludeFile "Screen3DRequester.pb"
Define.f KeyX, KeyY, MouseX, MouseY
Define.f x, y, z, nx, ny, nz, u, v
Define.l Co
Define.w t1, t2, t3
If InitEngine3D()
Add3DArchive("Data/Textures", #PB_3DArchive_FileSystem)
InitSprite()
InitKeyboard()
InitMouse()
If Screen3DRequester()
; Create a pyramid, manually.. See the DataSection, for more precisions
;
Restore Pyramid
CreateMesh(0, #PB_Mesh_TriangleList)
;Base
For i = 0 To 3
Read.f x : Read.f y : Read.f z
Read.l Co
Read.f u : Read.f v
MeshVertexPosition(x, y, z)
MeshVertexNormal(0, 0, 0)
MeshVertexColor(Co)
MeshVertexTextureCoordinate(u, v)
Next
For i = 0 To 1
Read.w t1 : Read.w t2 : Read.w t3
MeshFace(t1, t2, t3)
Next
;Side
For k=0 To 3
AddSubMesh(#PB_Mesh_TriangleList)
For i = 0 To 2
Read.f x : Read.f y : Read.f z
Read.l Co
Read.f u : Read.f v
MeshVertexPosition(x, y, z)
MeshVertexNormal(0, 0, 0)
MeshVertexColor(Co)
MeshVertexTextureCoordinate(u, v)
Next i
Read.w t1 : Read.w t2 : Read.w t3
MeshFace(t1, t2, t3)
Next
FinishMesh(#True)
NormalizeMesh(0)
UpdateMeshBoundingBox(0)
CreateMaterial(0, LoadTexture(0, "Geebee2.bmp"))
CreateMaterial(1, LoadTexture(1, "Grass.jpg"))
CreateMaterial(2, LoadTexture(2, "caisse.png"))
CreateMaterial(3, LoadTexture(3, "Wood.jpg"))
CreateMaterial(4, LoadTexture(4, "RustySteel.jpg"))
SetMeshMaterial(0, MaterialID(0), 0)
SetMeshMaterial(0, MaterialID(1), 1)
SetMeshMaterial(0, MaterialID(2), 2)
SetMeshMaterial(0, MaterialID(3), 3)
SetMeshMaterial(0, MaterialID(4), 4)
CreateEntity(0, MeshID(0), #PB_Material_None)
ScaleEntity(0, 400, 200, 400)
CreateCamera(0, 0, 0, 100, 100)
MoveCamera(0, 0, 0, 1000, #PB_Absolute)
AmbientColor(RGB(255, 255, 255))
Repeat
Screen3DEvents()
If ExamineMouse()
MouseX = -MouseDeltaX() * #CameraSpeed * 0.05
MouseY = -MouseDeltaY() * #CameraSpeed * 0.05
EndIf
If ExamineKeyboard()
If KeyboardPushed(#PB_Key_Left)
KeyX = -#CameraSpeed
ElseIf KeyboardPushed(#PB_Key_Right)
KeyX = #CameraSpeed
Else
KeyX = 0
EndIf
If KeyboardPushed(#PB_Key_Up)
KeyY = -#CameraSpeed
ElseIf KeyboardPushed(#PB_Key_Down)
KeyY = #CameraSpeed
Else
KeyY = 0
EndIf
EndIf
RotateEntity(0, 1, 1, 1, #PB_Relative)
RotateCamera(0, MouseY, MouseX, 0, #PB_Relative)
MoveCamera (0, KeyX, 0, KeyY)
RenderWorld()
Screen3DStats()
FlipBuffers()
Until KeyboardPushed(#PB_Key_Escape) Or Quit = 1
EndIf
Else
MessageRequester("Error", "The 3D Engine can't be initialized", 0)
EndIf
End
DataSection
Pyramid:
;Base
Data.f -0.5,-0.5,0.5 ; position
Data.l $FFFFFF ; color
Data.f 0,0 ; UVCoordinate
Data.f 0.5,-0.5,0.5 ; position
Data.l $FFFFFF ; color
Data.f 0,1 ; UVCoordinate
Data.f 0.5,-0.5,-0.5 ; position
Data.l $FFFFFF ; color
Data.f 1,1 ; UVCoordinate
Data.f -0.5,-0.5,-0.5 ; position
Data.l $FFFFFF ; color
Data.f 1,0 ; UVCoordinate
Data.w 2,1,0 ; Face
Data.w 0,3,2 ; Face
;-Front
Data.f 0.5,-0.5,0.5 ; position
Data.l $FFFFFF ; color
Data.f 1,0 ; UVCoordinate
Data.f 0.0,0.5,0.0
Data.l $FFFFFF
Data.f 0.5,0.5
Data.f -0.5,-0.5,0.5
Data.l $FFFFFF
Data.f 0,0
Data.w 0,1,2 ; Face
;-Back
Data.f -0.5,-0.5,-0.5
Data.l $FFFFFF
Data.f 0,1
Data.f 0.0,0.5,0.0
Data.l $FFFFFF
Data.f 0.5,0.5
Data.f 0.5,-0.5,-0.5
Data.l $FFFFFF
Data.f 1,1
Data.w 0,1,2
;-Left
Data.f -0.5,-0.5,0.5
Data.l $FFFFFF
Data.f 0,0
Data.f 0.0,0.5,0.0
Data.l $FFFFFF
Data.f 0.5,0.5
Data.f -0.5,-0.5,-0.5
Data.l $FFFFFF
Data.f 0,1
Data.w 0,1,2
;-Right
Data.f 0.5,-0.5,-0.5
Data.l $FFFFFF
Data.f 1,1
Data.f 0.0,0.5,0.0
Data.l $FFFFFF
Data.f 0.5,0.5
Data.f 0.5,-0.5,0.5
Data.l $FFFFFF
Data.f 1,0
Data.w 0,1,2
EndDataSectionPlease correct my english
http://purebasic.developpez.com/
http://purebasic.developpez.com/
Re: 3d model with more than one texture
Code: Select all
CreateMaterial(0, LoadTexture(0, "Geebee2.bmp"))
CreateMaterial(1, LoadTexture(1, "Grass.jpg"))
CreateMaterial(2, LoadTexture(2, "caisse.png"))
CreateMaterial(3, LoadTexture(3, "Wood.jpg"))
CreateMaterial(4, LoadTexture(4, "RustySteel.jpg"))
SetMeshMaterial(0, MaterialID(0), 0)
SetMeshMaterial(0, MaterialID(1), 1)
SetMeshMaterial(0, MaterialID(2), 2)
SetMeshMaterial(0, MaterialID(3), 3)
SetMeshMaterial(0, MaterialID(4), 4)sorry for this nerd questions but i found nothing about the MaterialID(x) in the code.
edit: are the material numbers the numbers of different faces in a mesh?
so i could make a mesh, apply textures in ultimate unwrap 3d to the surfaces, convert and save it to any format.
convert the model to .ogre format, load it in pb and add the textures with a code like above.
correct???
Re: 3d model with more than one texture
N_Gnom wrote:Code: Select all
edit: are the material numbers the numbers of different faces in a mesh? [/quote] No, the number in [b]MaterialID()[/b] is the handle of a material. You use this command to receive the ID of that material to be used in commands. [b]SetMeshMaterial(#Mesh, MaterialID(#Material), #SubMesh)[/b]. I'll break down this command a bit. [b]#Mesh[/b] is the handle of your mesh that you wish to assign the material to. [b]MaterialID(#Material)[/b] collects the ID of the material you wish to use. [b]#SubMesh[/b] is an optional parameter. If your model has a submesh you can assign a material to just that submesh. In the example Comtois provided he created a pyramid with 5 submeshes. One for each side of the shape. The [b]#SubMesh[/b] handles for them were set to 0-4 same as the materials. So, he assigned a separate material to each SubMesh using the handles of the materials and submeshes. Not sure if that all made since. So, let me know if I need to explain myself better. [quote]so i could make a mesh, apply textures in ultimate unwrap 3d to the surfaces, convert and save it to any format. convert the model to .ogre format, load it in pb and add the textures with a code like above. correct???[/quote] Not quite. In order to use the code above you will need to create submeshes in your modeling software. One submesh for each texture. If you don't want to do it that way. You could also use [b]AddMaterialLayer(#Material, TextureID [, Mode])[/b] like Fred suggested. [b]EDIT:[/b] Is there a reason you can't use one texture for the entire model? I personally combine all of my textures into one. Then by using UV coordinates I assign which part of the model gets which part of the texture combination.
-
IdeasVacuum
- Always Here

- Posts: 6426
- Joined: Fri Oct 23, 2009 2:33 am
- Location: Wales, UK
- Contact:
Re: 3d model with more than one texture
This might be of some use: B3D import
The code only supports the import of one texture, but you may be able to improve it.
The code only supports the import of one texture, but you may be able to improve it.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
If it sounds simple, you have not grasped the complexity.
Re: 3d model with more than one texture
@samuel: yes i need more textures for one mesh, because i.e. if you have a detailed level i need more than only one texture.
some models are done and have more than one material.
@ideasvacuum: thanks but i don´t know what i have to do to add multiple textures support
--> b3d to ogre mesh+material (ogreassimpconverter)
loading created mesh
Parse3DScripts()
CreateEntity with flag #PB_Material_None
works for me.i´ll test it with more models
some models are done and have more than one material.
@ideasvacuum: thanks but i don´t know what i have to do to add multiple textures support
--> b3d to ogre mesh+material (ogreassimpconverter)
loading created mesh
Parse3DScripts()
CreateEntity with flag #PB_Material_None
works for me.i´ll test it with more models
Re: 3d model with more than one texture
Working with a 3D-Model-Software is not a workaround,N_Gnom wrote:thats no way for me....
i don´t want to have ever only workarounds....
that is the way to create 3d-models. It seems more
as a workaround, what you are trying
But as the models are already finished, you will have
to convert it in a way, where you doesn't lose
information. Loading it into a 3D-Model-Software and
then using a export-plugin is just one way.
Maybe that will help you by understanding how
OGRE works: a material in OGRE is nothing else
as the definition of the look from a mesh. Where
the mesh itself defines where the faces will be,
the material defines, how this faces will be shown.
That includes lightning (colors), shadows, textures, aso.
Additinal, a material itself has a few levels of information,
where the texture-unit (the texture itself) is the highest
and last level. So, to have multiple textures in a OGRE
material, you only have to define multiple texture-unites.
A material itself is not more as a text-file in a specific
format, a material-script. This script is read when
you call Parse3DScripts() from PB. All material-commends
from PB are just manipulating the material the same way,
as it would be by changing a material-script.
docu: http://www.ogre3d.org/docs/manual/manua ... al-Scripts
MFG PMV



