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