Page 1 of 2
AddMaterialLayer()
Posted: Tue Jul 01, 2025 5:03 am
by Distorted Pixel
Hi,
I am using PureBasic 6.21 LTS
I am trying to get two textures on my mesh. It came with both of them. One is the stadium seats and the other is the field.
Step one:
I loaded the object I got from turbosquid website into Blender and exported it out to
.obj format
Step two:
I ran the object through AssimpConverter
Step three:
I ran the following code in PB and got this: (If I run the AddMaterialLayer() command in the code it is worse than without it.)
https://drive.proton.me/urls/QV5NNPQ7ER#L4P3QMsLumPj
If I unremark the AddMaterialLayer() command in the code I get this:
https://drive.proton.me/urls/SWA4ZXH1GG#rhgY7DIpVOdF
But it is supposed to look like this. (
this image is rendered from Blender)
https://drive.proton.me/urls/6A5MXRZFSC#yfEs1cmxA76u
Code: Select all
UsePNGImageDecoder()
InitEngine3D()
InitSprite()
OpenWindow(0, 0, 0, 1200, 800, "European Football Simulator", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
OpenWindowedScreen(WindowID(0), 0, 0, 1200, 800, 0, 0, #PB_Screen_WaitSynchronization)
Add3DArchive("C:\Users\Brian\Documents\PUREBASIC PROJECTS\3D Programs\3Dfield\Media", #PB_3DArchive_FileSystem)
CreateLight(0,RGB(15, 15, 15), 0, 100, -10, #PB_Light_Directional)
;DisableLightShadows(0, #False)
LoadTexture(0, "Stadium_blue.png")
LoadTexture(1, "Stadium_field.png")
LoadMesh(0, "StadiumNew_obj.mesh")
;LoadMesh(1, "GoalNets_3ds.mesh")
CreateMaterial(0, TextureID(0))
;CreateMaterial(1, TextureID(1))
;AddMaterialLayer(0, TextureID(1))
CreateEntity(0, MeshID(0), MaterialID(0));, 0, 0, 0, 0)
RotateEntity(0, 10, -45, 0, #PB_Absolute)
CreateCamera(0, 0, 0, 100, 100)
MoveCamera(0, 0, 10, 25, #PB_Absolute | #PB_Local) ; absolute + local positive Z coordinate moves camera backwards
CameraLookAt(0, 0, 0, 0)
Repeat
RenderWorld()
FlipBuffers()
Until WaitWindowEvent(1) = #PB_Event_CloseWindow
Am I doing something wrong of forgetting something? I'm still new with 3D stuff in PureBasic
Re: AddMaterialLayer()
Posted: Tue Jul 01, 2025 6:59 am
by miso
I guess your model has 2 or more submeshes. That way not a new layer that you need, but two material for each texture. You can set it with SetEntityMaterial(#Entity,MateialID,SubEntity)
I did not try this, so if it does not work with submeshes, than this is a missing feature. Please tell me, what was the result.
Re: AddMaterialLayer()
Posted: Tue Jul 01, 2025 3:38 pm
by Distorted Pixel
miso wrote: Tue Jul 01, 2025 6:59 am
I guess your model has 2 or more submeshes. That way not a new layer that you need, but two material for each texture. You can set it with SetEntityMaterial(#Entity,MateialID,SubEntity)
I did not try this, so if it does not work with submeshes, than this is a missing feature. Please tell me, what was the result.
I ran the object through AppGameKit Studio using the command GetObjectNumMeshes() and it says there is only one mesh.
https://drive.proton.me/urls/6GCAV045MM#XXZwxw8PfcDc
Re: AddMaterialLayer()
Posted: Tue Jul 01, 2025 3:47 pm
by miso
And what does pb say? (Just to be sure.)
Re: AddMaterialLayer()
Posted: Tue Jul 01, 2025 4:07 pm
by Distorted Pixel
miso wrote: Tue Jul 01, 2025 3:47 pm
And what does pb say? (Just to be sure.)
Wow, is says: 31
[Edit:] This is what the material file has in it:
Code: Select all
material StadiumNew_obj#0
{
technique
{
pass
{
ambient 1 1 1 1
diffuse 1 1 1 1
specular 1 1 1 1
texture_unit
{
texture Stadium_blue.png
}
}
}
}
material StadiumNew_obj#2
{
technique
{
pass
{
ambient 1 1 1 1
diffuse 1 1 1 1
specular 1 1 1 1
texture_unit
{
texture Stadium_field.png
}
}
}
}
material StadiumNew_obj#0
{
technique
{
pass
{
ambient 1 1 1 1
diffuse 1 1 1 1
specular 1 1 1 1
texture_unit
{
texture Stadium_blue.png
}
}
}
}
material StadiumNew_obj#0
{
technique
{
pass
{
ambient 1 1 1 1
diffuse 1 1 1 1
specular 1 1 1 1
texture_unit
{
texture Stadium_blue.png
}
}
}
}
material StadiumNew_obj#1
{
technique
{
pass
{
ambient 1 1 1 1
diffuse 0.8 0.8 0.8 1
specular 1 1 1 1
}
}
}
material StadiumNew_obj#1
{
technique
{
pass
{
ambient 1 1 1 1
diffuse 0.8 0.8 0.8 1
specular 1 1 1 1
}
}
}
material StadiumNew_obj#0
{
technique
{
pass
{
ambient 1 1 1 1
diffuse 1 1 1 1
specular 1 1 1 1
texture_unit
{
texture Stadium_blue.png
}
}
}
}
material StadiumNew_obj#0
{
technique
{
pass
{
ambient 1 1 1 1
diffuse 1 1 1 1
specular 1 1 1 1
texture_unit
{
texture Stadium_blue.png
}
}
}
}
material StadiumNew_obj#0
{
technique
{
pass
{
ambient 1 1 1 1
diffuse 1 1 1 1
specular 1 1 1 1
texture_unit
{
texture Stadium_blue.png
}
}
}
}
material StadiumNew_obj#1
{
technique
{
pass
{
ambient 1 1 1 1
diffuse 0.8 0.8 0.8 1
specular 1 1 1 1
}
}
}
material StadiumNew_obj#1
{
technique
{
pass
{
ambient 1 1 1 1
diffuse 0.8 0.8 0.8 1
specular 1 1 1 1
}
}
}
material StadiumNew_obj#1
{
technique
{
pass
{
ambient 1 1 1 1
diffuse 0.8 0.8 0.8 1
specular 1 1 1 1
}
}
}
material StadiumNew_obj#1
{
technique
{
pass
{
ambient 1 1 1 1
diffuse 0.8 0.8 0.8 1
specular 1 1 1 1
}
}
}
material StadiumNew_obj#0
{
technique
{
pass
{
ambient 1 1 1 1
diffuse 1 1 1 1
specular 1 1 1 1
texture_unit
{
texture Stadium_blue.png
}
}
}
}
material StadiumNew_obj#0
{
technique
{
pass
{
ambient 1 1 1 1
diffuse 1 1 1 1
specular 1 1 1 1
texture_unit
{
texture Stadium_blue.png
}
}
}
}
material StadiumNew_obj#0
{
technique
{
pass
{
ambient 1 1 1 1
diffuse 1 1 1 1
specular 1 1 1 1
texture_unit
{
texture Stadium_blue.png
}
}
}
}
material StadiumNew_obj#0
{
technique
{
pass
{
ambient 1 1 1 1
diffuse 1 1 1 1
specular 1 1 1 1
texture_unit
{
texture Stadium_blue.png
}
}
}
}
material StadiumNew_obj#0
{
technique
{
pass
{
ambient 1 1 1 1
diffuse 1 1 1 1
specular 1 1 1 1
texture_unit
{
texture Stadium_blue.png
}
}
}
}
material StadiumNew_obj#0
{
technique
{
pass
{
ambient 1 1 1 1
diffuse 1 1 1 1
specular 1 1 1 1
texture_unit
{
texture Stadium_blue.png
}
}
}
}
material StadiumNew_obj#0
{
technique
{
pass
{
ambient 1 1 1 1
diffuse 1 1 1 1
specular 1 1 1 1
texture_unit
{
texture Stadium_blue.png
}
}
}
}
material StadiumNew_obj#0
{
technique
{
pass
{
ambient 1 1 1 1
diffuse 1 1 1 1
specular 1 1 1 1
texture_unit
{
texture Stadium_blue.png
}
}
}
}
material StadiumNew_obj#0
{
technique
{
pass
{
ambient 1 1 1 1
diffuse 1 1 1 1
specular 1 1 1 1
texture_unit
{
texture Stadium_blue.png
}
}
}
}
material StadiumNew_obj#0
{
technique
{
pass
{
ambient 1 1 1 1
diffuse 1 1 1 1
specular 1 1 1 1
texture_unit
{
texture Stadium_blue.png
}
}
}
}
material StadiumNew_obj#0
{
technique
{
pass
{
ambient 1 1 1 1
diffuse 1 1 1 1
specular 1 1 1 1
texture_unit
{
texture Stadium_blue.png
}
}
}
}
material StadiumNew_obj#0
{
technique
{
pass
{
ambient 1 1 1 1
diffuse 1 1 1 1
specular 1 1 1 1
texture_unit
{
texture Stadium_blue.png
}
}
}
}
material StadiumNew_obj#0
{
technique
{
pass
{
ambient 1 1 1 1
diffuse 1 1 1 1
specular 1 1 1 1
texture_unit
{
texture Stadium_blue.png
}
}
}
}
material StadiumNew_obj#0
{
technique
{
pass
{
ambient 1 1 1 1
diffuse 1 1 1 1
specular 1 1 1 1
texture_unit
{
texture Stadium_blue.png
}
}
}
}
material StadiumNew_obj#0
{
technique
{
pass
{
ambient 1 1 1 1
diffuse 1 1 1 1
specular 1 1 1 1
texture_unit
{
texture Stadium_blue.png
}
}
}
}
material StadiumNew_obj#0
{
technique
{
pass
{
ambient 1 1 1 1
diffuse 1 1 1 1
specular 1 1 1 1
texture_unit
{
texture Stadium_blue.png
}
}
}
}
material StadiumNew_obj#0
{
technique
{
pass
{
ambient 1 1 1 1
diffuse 1 1 1 1
specular 1 1 1 1
texture_unit
{
texture Stadium_blue.png
}
}
}
}
material StadiumNew_obj#0
{
technique
{
pass
{
ambient 1 1 1 1
diffuse 1 1 1 1
specular 1 1 1 1
texture_unit
{
texture Stadium_blue.png
}
}
}
}
Re: AddMaterialLayer()
Posted: Tue Jul 01, 2025 4:56 pm
by miso
If you use the GetScriptMaterial() command, it should texture your model just right with that material file. If you want to manually add them, use the different materials for the submeshes. (As I said, I did not test this, but I assume that should also work.)
Re: AddMaterialLayer()
Posted: Tue Jul 01, 2025 6:45 pm
by Distorted Pixel
miso wrote: Tue Jul 01, 2025 4:56 pm
If you use the GetScriptMaterial() command, it should texture your model just right with that material file. If you want to manually add them, use the different materials for the submeshes. (As I said, I did not test this, but I assume that should also work.)
I am getting somewhere, but I don't know how to add all the information in the
material file into one
entity, if that is what I have.
I will keep working on it, but any suggestions would be appreciated.
I loaded the object(
fbx format) into Blender again and exported to dae format this time and converted it with AssimpConverter to get new files to work with.
The following code gives it a yellow look to everything.
https://drive.proton.me/urls/SPWN1FSPE4#PTmgOfkkvRGC
Current code:
Code: Select all
InitEngine3D()
InitSprite()
OpenWindow(0, 0, 0, 1200, 800, "European Football Simulator", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
OpenWindowedScreen(WindowID(0), 0, 0, 1200, 800, 0, 0, #PB_Screen_WaitSynchronization)
Add3DArchive("C:\Users\Brian\Documents\PUREBASIC PROJECTS\3D Programs\3Dfield\Media", #PB_3DArchive_FileSystem)
Parse3DScripts()
CreateLight(0,RGB(55, 55, 55), 0, 400, -10, #PB_Light_Directional)
; LoadTexture(0, "Stadium_blue.png")
; LoadTexture(1, "Stadium_field.png")
LoadMesh(0, "Stadium_dae.mesh")
Result = GetScriptMaterial(#PB_Any, "Stadium_dae#0")
;Result = GetScriptMaterial(#PB_Any, "Stadium_dae#2")
Debug Result
CreateEntity(0, MeshID(0), MaterialID(Result))
RotateEntity(0, 10, -45, 0, #PB_Absolute)
CreateCamera(0, 0, 0, 100, 100)
MoveCamera(0, 0, 10, 25, #PB_Absolute | #PB_Local) ; absolute + local positive Z coordinate moves camera backwards
CameraLookAt(0, 0, 0, 0)
Repeat
RenderWorld()
FlipBuffers()
Until WaitWindowEvent(1) = #PB_Event_CloseWindow
Re: AddMaterialLayer()
Posted: Tue Jul 01, 2025 8:04 pm
by miso
I don't see any problems with that code by looking at it. (besides the event handling, but that does not cause problems with the visuals)
For the record, I tested to texture submeshes with multiple textures, and it worked fine. I used threedsliders monkey model, as it has the eyes as a submesh.
Can't really tell, whats the problem here. Try this code. I don't have the resources, so I never ran this (so I hope I did not make mistakes). Be sure to check the paths, filenames. Ogre is case sensitive for capital letters. (I hope the material file has the submeshes in order) Use it with your original export, the one that has the material script file corresponding to the one you posted here.
Code: Select all
InitEngine3D()
InitSprite()
OpenWindow(0, 0, 0, 1200, 800, "European Football Simulator", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
OpenWindowedScreen(WindowID(0), 0, 0, 1200, 800, 0, 0, #PB_Screen_WaitSynchronization)
Add3DArchive("C:\Users\Brian\Documents\PUREBASIC PROJECTS\3D Programs\3Dfield\Media", #PB_3DArchive_FileSystem)
Parse3DScripts()
CreateLight(0,RGB(55, 55, 55), 0, 400, -10, #PB_Light_Directional)
LoadTexture(0, "Stadium_blue.png")
LoadTexture(1, "Stadium_field.png")
bluemat=CreateMaterial(#PB_Any,TextureID(0))
fieldmat=CreateMaterial(#PB_Any,TextureID(1))
defmat = CreateMaterial(#PB_Any,0)
LoadMesh(0, "Stadium_dae.mesh")
CreateEntity(0, MeshID(0), #PB_Material_None)
For x = 0 To 30
Select x
Case 1
tmat = fieldmat
Case 4
tmat = defmat
Case 5
tmat = defmat
Case 9
tmat = defmat
Case 10
tmat = defmat
Case 11
tmat = defmat
Case 12
tmat = defmat
Default
tmat = bluemat
EndSelect
SetEntityMaterial(0,MaterialID(tmat),x)
Next x
RotateEntity(0, 10, -45, 0, #PB_Absolute)
CreateCamera(0, 0, 0, 100, 100)
MoveCamera(0, 0, 10, 25, #PB_Absolute | #PB_Local) ; absolute + local positive Z coordinate moves camera backwards
CameraLookAt(0, 0, 0, 0)
Repeat
Repeat : event=WindowEvent() : If event = #PB_Event_CloseWindow : End : EndIf :Until Not event
RenderWorld()
FlipBuffers()
Delay(1)
ForEver
Re: AddMaterialLayer()
Posted: Wed Jul 02, 2025 12:49 am
by Distorted Pixel
miso wrote: Tue Jul 01, 2025 8:04 pm
I don't see any problems with that code by looking at it. (besides the event handling, but that does not cause problems with the visuals)
For the record, I tested to texture submeshes with multiple textures, and it worked fine. I used threedsliders monkey model, as it has the eyes as a submesh.
Can't really tell, whats the problem here. Try this code. I don't have the resources, so I never ran this (so I hope I did not make mistakes). Be sure to check the paths, filenames. Ogre is case sensitive for capital letters. (I hope the material file has the submeshes in order) Use it with your original export, the one that has the material script file corresponding to the one you posted here.
Code: Select all
InitEngine3D()
InitSprite()
OpenWindow(0, 0, 0, 1200, 800, "European Football Simulator", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
OpenWindowedScreen(WindowID(0), 0, 0, 1200, 800, 0, 0, #PB_Screen_WaitSynchronization)
Add3DArchive("C:\Users\Brian\Documents\PUREBASIC PROJECTS\3D Programs\3Dfield\Media", #PB_3DArchive_FileSystem)
Parse3DScripts()
CreateLight(0,RGB(55, 55, 55), 0, 400, -10, #PB_Light_Directional)
LoadTexture(0, "Stadium_blue.png")
LoadTexture(1, "Stadium_field.png")
bluemat=CreateMaterial(#PB_Any,TextureID(0))
fieldmat=CreateMaterial(#PB_Any,TextureID(1))
defmat = CreateMaterial(#PB_Any,0)
LoadMesh(0, "Stadium_dae.mesh")
CreateEntity(0, MeshID(0), #PB_Material_None)
For x = 0 To 30
Select x
Case 1
tmat = fieldmat
Case 4
tmat = defmat
Case 5
tmat = defmat
Case 9
tmat = defmat
Case 10
tmat = defmat
Case 11
tmat = defmat
Case 12
tmat = defmat
Default
tmat = bluemat
EndSelect
SetEntityMaterial(0,MaterialID(tmat),x)
Next x
RotateEntity(0, 10, -45, 0, #PB_Absolute)
CreateCamera(0, 0, 0, 100, 100)
MoveCamera(0, 0, 10, 25, #PB_Absolute | #PB_Local) ; absolute + local positive Z coordinate moves camera backwards
CameraLookAt(0, 0, 0, 0)
Repeat
Repeat : event=WindowEvent() : If event = #PB_Event_CloseWindow : End : EndIf :Until Not event
RenderWorld()
FlipBuffers()
Delay(1)
ForEver
Thank you
miso, I really am going to study this hard and learn from it.
The above code works perfectly with the original
mesh and
material files. I did change it just slightly for the view.
https://drive.proton.me/urls/F1V5XPX204#sHgs095kDp7E
Code: Select all
InitEngine3D()
InitSprite()
OpenWindow(0, 0, 0, 1200, 800, "European Football Simulator", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
OpenWindowedScreen(WindowID(0), 0, 0, 1200, 800, 0, 0, #PB_Screen_WaitSynchronization)
Add3DArchive("C:\Users\Brian\Documents\PUREBASIC PROJECTS\3D Programs\3Dfield\Media", #PB_3DArchive_FileSystem)
Parse3DScripts()
CreateLight(0,RGB(55, 55, 55), 0, 400, -10, #PB_Light_Directional)
LoadTexture(0, "Stadium_blue.png")
LoadTexture(1, "Stadium_field.png")
bluemat=CreateMaterial(#PB_Any,TextureID(0))
fieldmat=CreateMaterial(#PB_Any,TextureID(1))
defmat = CreateMaterial(#PB_Any,0)
LoadMesh(0, "StadiumNew_obj.mesh")
CreateEntity(0, MeshID(0), #PB_Material_None)
For x = 0 To 30
Select x
Case 1
tmat = fieldmat
Case 4
tmat = defmat
Case 5
tmat = defmat
Case 9
tmat = defmat
Case 10
tmat = defmat
Case 11
tmat = defmat
Case 12
tmat = defmat
Default
tmat = bluemat
EndSelect
SetEntityMaterial(0,MaterialID(tmat),x)
Next x
RotateEntity(0, 6, 45, 0, #PB_Absolute)
CreateCamera(0, 0, 0, 100, 100)
MoveCamera(0, 0, 20, 40, #PB_Absolute | #PB_Local) ; absolute + local positive Z coordinate moves camera backwards
CameraRange(0,0.1, 1000)
CameraLookAt(0, 0, 0, 0)
Repeat
Repeat : event=WindowEvent() : If event = #PB_Event_CloseWindow : End : EndIf :Until Not event
RenderWorld()
FlipBuffers()
Delay(1)
ForEver
Re: AddMaterialLayer()
Posted: Wed Jul 02, 2025 3:47 am
by Distorted Pixel
@miso
I'm trying to learn from the code you wrote. What is the purpose of the cases not being 1, 2, 3, 4 etc.. Instead you have 1, 4, 5, 9, 10, 11, 12 and default. How did you figure that it needed to be that way and what is it for? I do know why the For x = 0 To 30 is there, it is for the 1 main mesh and the 30 submeshes. I just don't understand why the cases are like they are.
[Edit:] Oh, the tmat = fieldmat is creating a material for each mesh/submesh, but I don't unstand why the cases are as such.
Code: Select all
For x = 0 To 30
Select x
Case 1
tmat = fieldmat
Case 4
tmat = defmat
Case 5
tmat = defmat
Case 9
tmat = defmat
Case 10
tmat = defmat
Case 11
tmat = defmat
Case 12
tmat = defmat
Default
tmat = bluemat
EndSelect
SetEntityMaterial(0,MaterialID(tmat),x)
Next x
Re: AddMaterialLayer()
Posted: Wed Jul 02, 2025 6:03 am
by miso
I will try to explain. You said your model has 31 subentities, then posted the material file. The material file had the info how to texture the 31 submeshes in order. The numbering of submeshes/subentities starts with 0 (up to 30 with this model). I made an iteration. The case numbers are hardcoded, I counted the items myself in your material file. Most has the bluemat texture, so that I made to be default, the remaining cases I select manually.
I would not be able to do this without seeing your material file, I choosed the cases by reading/counting texture/submesh info it contains.
It has only 3 materials:
Code: Select all
bluemat=CreateMaterial(#PB_Any,TextureID(0))
fieldmat=CreateMaterial(#PB_Any,TextureID(1))
defmat = CreateMaterial(#PB_Any,0)
tmat is just 1 of the 3 possibilities.
Re: AddMaterialLayer()
Posted: Wed Jul 02, 2025 4:18 pm
by Distorted Pixel
miso wrote: Wed Jul 02, 2025 6:03 am
I will try to explain. You said your model has 31 subentities, then posted the material file. The material file had the info how to texture the 31 submeshes in order. The numbering of submeshes/subentities starts with 0 (up to 30 with this model). I made an iteration. The case numbers are hardcoded, I counted the items myself in your material file. Most has the bluemat texture, so that I made to be default, the remaining cases I select manually.
I would not be able to do this without seeing your material file, I choosed the cases by reading/counting texture/submesh info it contains.
It has only 3 materials:
Code: Select all
bluemat=CreateMaterial(#PB_Any,TextureID(0))
fieldmat=CreateMaterial(#PB_Any,TextureID(1))
defmat = CreateMaterial(#PB_Any,0)
tmat is just 1 of the 3 possibilities.
Thank you very much for explaining. It is a huge help for me. I understand most of what you have said here. The one thing (why/how you chose the case numbers you did) I still need to figure out. I know it was because of what you found in the material file. I will take an in depth look at the material file and see if I can figure it out myself. If I can't figure it out, I will post back here. I really want to understand the 3D side of the Orge 3D engine because that is what interests me most with PureBasic.
I do see that in the case numbers, the top and bottom ones are different than the middle ones as far as the content of them.
Re: AddMaterialLayer()
Posted: Wed Jul 02, 2025 5:03 pm
by miso
(why/how you chose the case numbers you did)
I think I can tell this in an easy way. If you open the material file, there will be 31 record in it. The first is the submesh number 0 (used in the cases), the second is the number 1 etc.
If the record contains texturename, I apply the submesh/subentity the material with it's texture, if not, I apply #pb material none. (the mesh color will be shown that way.)
Re: AddMaterialLayer()
Posted: Wed Jul 02, 2025 5:39 pm
by Distorted Pixel
miso wrote: Wed Jul 02, 2025 5:03 pm
(why/how you chose the case numbers you did)
I think I can tell this in an easy way. If you open the material file, there will be 31 record in it. The first is the submesh number 0 (used in the cases), the second is the number 1 etc.
If the record contains texturename, I apply the submesh/subentity the material with it's texture, if not, I apply #pb material none. (the mesh color will be shown that way.)
Does the object number in the material file mean anything? In the example portion of the material file, this is the first 3 entries.
First one says
obj#0 at the end
second one says
obj#2 at the end
Third one says
obj#0 at the end again
Example:
Code: Select all
material StadiumNew_obj#0
{
technique
{
pass
{
ambient 1 1 1 1
diffuse 1 1 1 1
specular 1 1 1 1
texture_unit
{
texture Stadium_blue.png
}
}
}
}
material StadiumNew_obj#2
{
technique
{
pass
{
ambient 1 1 1 1
diffuse 1 1 1 1
specular 1 1 1 1
texture_unit
{
texture Stadium_field.png
}
}
}
}
material StadiumNew_obj#0
{
technique
{
pass
{
ambient 1 1 1 1
diffuse 1 1 1 1
specular 1 1 1 1
texture_unit
{
texture Stadium_blue.png
}
}
}
}
If the record contains texturename, I apply the submesh/subentity the material with it's texture, if not, I apply #pb material none. (the mesh color will be shown that way.)
So... are you saying anything with a texture is a submesh/subentity? If it does not have a texture, it is a main mesh/entity or default mesh/entity? If so, I understand that, but I still don't know why the actual case numbers where chosen (Case 1, Case 4, Case 5, Case 9, Case 10, Case 11, Case 12). I counted certain things in the material file thinking that certain entries that where the same added up to a given case number, but no. Arg! I got to get this lol
Re: AddMaterialLayer()
Posted: Wed Jul 02, 2025 5:50 pm
by miso
There is no main mesh. A mesh is composed of submeshes, and it has at least 1. All the 31 item is a submesh in your model. Some of them are textured, some of them are not. (but they have color in their mesh data, and they are visible. Those just do not need a textured material.)
The material name should not concern you when using pb.
Case 1 is the 2'nd in the material file. Case 4 is the 5'th. (I did not recheck, but if you find something off with the cases, it might be because I made a mistake somewhere, that isn't visible)
Case default is everything else that is not presented.