Page 1 of 1

texture dont working ...

Posted: Sat Apr 23, 2016 1:34 am
by skinkairewalker
hi everyone ^^

someone know why texture dont working ?

link of my test > http://coldbasic.com.br/shared/texture_not_working.zip

Re: texture dont working ...

Posted: Sat Apr 23, 2016 5:31 pm
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  

Re: texture dont working ...

Posted: Sun Apr 24, 2016 7:04 pm
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 ?