texture dont working ...

Advanced game related topics
User avatar
skinkairewalker
Enthusiast
Enthusiast
Posts: 627
Joined: Fri Dec 04, 2015 9:26 pm

texture dont working ...

Post by skinkairewalker »

hi everyone ^^

someone know why texture dont working ?

link of my test > http://coldbasic.com.br/shared/texture_not_working.zip
User avatar
DK_PETER
Addict
Addict
Posts: 898
Joined: Sat Feb 19, 2011 10:06 am
Location: Denmark
Contact:

Re: texture dont working ...

Post by DK_PETER »

Hey

It looks like your mesh might be missing UV texture coordinates.
The material and texture is just fine.

Here is a small test.

material script:

Code: Select all

material mat
{
   technique
   {
      pass
      {
         scene_blend add
         depth_write off

         texture_unit
         {
            texture bg.png
         }
      }
   }
}
Code:

Code: Select all

UsePNGImageDecoder()
InitEngine3D()
InitSprite()

If OpenWindow(1,0,0,600,600,"Testing mesh model",#PB_Window_SystemMenu)
  
  OpenWindowedScreen(WindowID(1),0,0,600,600,1,0,0)
  
  Add3DArchive(".", #PB_3DArchive_FileSystem)
  
  Parse3DScripts()
  
  CreateCamera(0, 0, 0, 100, 100)
  CreateLight(0, $FFFFFF, 20, 0, 25)
  LightLookAt(0, 0, 0, 0)
  MoveCamera(0, 0, 0, 140)
  
  CreateCube(0, 30) ;<--Create a cube to test with
  ;LoadMesh(0,"staca.mesh")  ;<--- I think the mesh is wrong. UV texture coordinates.
  ;LoadTexture(0, "bg.png")
  GetScriptMaterial(0, "mat")
  CreateEntity(0, MeshID(0), MaterialID(0))
  
  Repeat  
    
    event  = WindowEvent()
    RotateEntity(0, 0.2, 0.4, 0.6, #PB_Relative)
    RenderWorld()
    FlipBuffers() 
    
  Until event = #PB_Event_CloseWindow
  
EndIf  
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
skinkairewalker
Enthusiast
Enthusiast
Posts: 627
Joined: Fri Dec 04, 2015 9:26 pm

Re: texture dont working ...

Post by skinkairewalker »

DK_PETER wrote:Hey

It looks like your mesh might be missing UV texture coordinates.
The material and texture is just fine.

Here is a small test.

material script:

Code: Select all

material mat
{
   technique
   {
      pass
      {
         scene_blend add
         depth_write off

         texture_unit
         {
            texture bg.png
         }
      }
   }
}
Code:

Code: Select all

UsePNGImageDecoder()
InitEngine3D()
InitSprite()

If OpenWindow(1,0,0,600,600,"Testing mesh model",#PB_Window_SystemMenu)
  
  OpenWindowedScreen(WindowID(1),0,0,600,600,1,0,0)
  
  Add3DArchive(".", #PB_3DArchive_FileSystem)
  
  Parse3DScripts()
  
  CreateCamera(0, 0, 0, 100, 100)
  CreateLight(0, $FFFFFF, 20, 0, 25)
  LightLookAt(0, 0, 0, 0)
  MoveCamera(0, 0, 0, 140)
  
  CreateCube(0, 30) ;<--Create a cube to test with
  ;LoadMesh(0,"staca.mesh")  ;<--- I think the mesh is wrong. UV texture coordinates.
  ;LoadTexture(0, "bg.png")
  GetScriptMaterial(0, "mat")
  CreateEntity(0, MeshID(0), MaterialID(0))
  
  Repeat  
    
    event  = WindowEvent()
    RotateEntity(0, 0.2, 0.4, 0.6, #PB_Relative)
    RenderWorld()
    FlipBuffers() 
    
  Until event = #PB_Event_CloseWindow
  
EndIf  
thanks by you answer DK_PETER ^^


let me do another ask !

how do i can add texture.png and material.material in same model with " PB CODE " ?

example >

Code: Select all

 LoadMesh(0,"Body.mesh")  ;<--- My 3D model
  LoadTexture(1, "Body_.png") <--- My 3D model texture 
  CreateMaterial(0,TextureID(1))  <--- create material with texture 
  GetScriptMaterial(0, "mat") <--- here !! get some " Script .material"
  CreateEntity(0, MeshID(0), MaterialID(0)) <--- here add texture and .material in same model .. 
  
how can i do this ?
Post Reply