December 01, 2020, 06:06:25 PM

Author Topic: PureBasic Terrain.png  (Read 3813 times)

Offline Kris

  • Full Member
  • ***
  • Posts: 116
Re: PureBasic Terrain.png
« Reply #15 on: October 24, 2019, 08:42:11 PM »
Older documentation is good for having a kind of reference of techniques but in a case of PureBasic you constantly need to check everything if it has changed or not. In your case, you should rely more on the combination of the supplied sample codes (there are at least 8 material focused samples) and the built in help witch is pretty good. For example the answer to your question is right there in the help file just at the beginning of the material chapter.

"Materials are composed of one or several textures and sometimes of some colors. They are widely used by the other objects of the 3D world like the entities, billboards and particles to give them a skin. Each material has a lot a properties like the shading, ambient and specular color, etc. to allow realistic looking material like wood, water, glass and more."

Studying the material command index below can give you an idea how the whole thing works. Check out all the material focused samples. Trying to learn from a book that hasn't been updated can give you a lot of unnecessary frustration.

Offline Pfaber11

  • Hero Member
  • *****
  • Posts: 549
  • Bonjour
    • FABERSGAMES
Re: PureBasic Terrain.png
« Reply #16 on: October 25, 2019, 12:18:28 PM »
I think I understand the terrain problem now . When I create a terrain I have a blank screen with a square in the middle . Been experimenting and the problem seems to be the files I'm using . I was just using any old .png files that were square 512x512 in size . And the map I was using was from my maze game at 2048x2048  which was a 2d map used for a height map. This I think is where the problem lies . This is way more complex than I am used to in AGK with height maps . Any way I think I nearly understand this stuff but a bit confused about needing 7 pics for a terrain as in desert07.zip in the examples . I've been over this many times and it seems you can't throw just any file in there and it'll work. Thanks for reading any further advice about suitable files would be most welcome .
Celeron N3060 1.6 ghz duel core  4 Gb ram 32 gig storage  HD400 Graphics 160 gig external hard drive....

Offline Kris

  • Full Member
  • ***
  • Posts: 116
Re: PureBasic Terrain.png
« Reply #17 on: October 25, 2019, 04:03:11 PM »
The desert.zip pack contains 6 pictures named desert07_BK, desert07_DN, desert07_FR, desert07_LF, desert07_RT, desert07_UP, that are used for the SkyBox() that generates a cube object with 6 sides and assigns each picture as a texture to it's respective side of the cube.   

Offline Pfaber11

  • Hero Member
  • *****
  • Posts: 549
  • Bonjour
    • FABERSGAMES
Re: PureBasic Terrain.png
« Reply #18 on: October 25, 2019, 04:55:37 PM »
nice one Kris will have a play with that. I've really gotta make this work . thanks
Celeron N3060 1.6 ghz duel core  4 Gb ram 32 gig storage  HD400 Graphics 160 gig external hard drive....

Offline RemiD

  • Hero Member
  • *****
  • Posts: 1078
Re: PureBasic Terrain.png
« Reply #19 on: October 25, 2019, 06:09:12 PM »
what i have described about material properties is the old way to render, now materials have others properties/textures, like normalmap, specularmap, emissive, etc... as Kris mentionned...
DualCore AMD E-450, 1646 MHz - 6 Go DDR3 1333 SDRAM - AMD Radeon HD 6320 Graphics (384 Mo) - Windows 7 Home Premium - DirectX 11.0

Offline Pfaber11

  • Hero Member
  • *****
  • Posts: 549
  • Bonjour
    • FABERSGAMES
Re: PureBasic Terrain.png
« Reply #20 on: October 25, 2019, 09:36:33 PM »
Well I've got the skybox thing nailed so got something to play with now . My first bit of success in days . I was expecting to be a few days on this part of the learning curve . Gotta nail the terrain over the weekend then I'll hopefully know enough to start a project .
Celeron N3060 1.6 ghz duel core  4 Gb ram 32 gig storage  HD400 Graphics 160 gig external hard drive....

Offline Pfaber11

  • Hero Member
  • *****
  • Posts: 549
  • Bonjour
    • FABERSGAMES
Re: PureBasic Terrain.png
« Reply #21 on: October 26, 2019, 09:24:09 AM »
I have tried using the terrain files from the textures nvidia folder but all I get are black squares which are floating and no terrain. Does this sound familiar? I really can't see what I'm doing wrong .
Celeron N3060 1.6 ghz duel core  4 Gb ram 32 gig storage  HD400 Graphics 160 gig external hard drive....

Offline RemiD

  • Hero Member
  • *****
  • Posts: 1078
Re: PureBasic Terrain.png
« Reply #22 on: October 26, 2019, 10:58:56 AM »
would this help if i post a simple code example (with comments) on how to make a terrain with a color texture + a detail texture (for Blitz3d) ?
(if you want to understand the concept)
DualCore AMD E-450, 1646 MHz - 6 Go DDR3 1333 SDRAM - AMD Radeon HD 6320 Graphics (384 Mo) - Windows 7 Home Premium - DirectX 11.0

Offline Pfaber11

  • Hero Member
  • *****
  • Posts: 549
  • Bonjour
    • FABERSGAMES
Re: PureBasic Terrain.png
« Reply #23 on: October 26, 2019, 05:54:39 PM »
It might do can't hurt to take a look . I have no idea why what I'm doing is not working . I'm even using the example files . I've been over it so many times . Thanks
Celeron N3060 1.6 ghz duel core  4 Gb ram 32 gig storage  HD400 Graphics 160 gig external hard drive....

Offline RemiD

  • Hero Member
  • *****
  • Posts: 1078
Re: PureBasic Terrain.png
« Reply #24 on: October 26, 2019, 06:35:57 PM »
maybe your problem is not that you are doing something wrong but that your gpu is too old/crap and not compatible with the rendering way of ogre (the graphics engine that purebasic apparently uses) ?
DualCore AMD E-450, 1646 MHz - 6 Go DDR3 1333 SDRAM - AMD Radeon HD 6320 Graphics (384 Mo) - Windows 7 Home Premium - DirectX 11.0

Offline Pfaber11

  • Hero Member
  • *****
  • Posts: 549
  • Bonjour
    • FABERSGAMES
Re: PureBasic Terrain.png
« Reply #25 on: October 26, 2019, 07:11:03 PM »
You Know I would agree with you but it runs the examples . I have no problem with producing Entities and displaying them on the screen and moving them about and detecting collisions . It's just the terrain . I might put the code up again to see if anybody can tell me where I'm going wrong . In fact I'll do that now.
 Here it is maybe if I stare at it long enough it'll work
.
Code: [Select]
UsePNGImageEncoder()
UseJPEGUsePNGImageDecoder()
ImageDecoder()
UseJPEGImageEncoder()
#CameraSpeed =  2
  InitEngine3D() 
  InitSprite()
  InitKeyboard()
  InitMouse()
  OpenScreen(1366,768,32,"")
    Add3DArchive("C:/Users/pfabe/Documents/Textures", #PB_3DArchive_FileSystem)
    Add3DArchive("C:/Users/pfabe/Documents/nvidia", #PB_3DArchive_FileSystem)
    Add3DArchive("C:/Users/pfabe/Documents/New folder", #PB_3DArchive_FileSystem)
    light = CreateLight(#PB_Any ,RGB(190, 190, 190), 4000, 1200, 1000,#PB_Light_Directional)
    SetLightColor(light, #PB_Light_SpecularColor, RGB(255*0.4, 255*0.4,255*0.4))
    LightDirection(light ,0.55, -0.3, -0.75)
    AmbientColor(RGB(255*0.2, 255*0.2,255*0.2))
    CreateCamera(0, 0, 0, 100, 100)
    MoveCamera(0,  800, 400, 80,#PB_Absolute)
    SetupTerrains(LightID(Light), 3000, #PB_Terrain_NormalMapping)
   Debug CreateTerrain(0,513, 12000, 600, 3 , "TerrainGroup", "dat") 
   Debug AddTerrainTexture(0,0,100,"paul1.jpg", "paul2.jpg" )
  Debug  AddTerrainTexture(0,1,30,"paul3.jpg" , "paul4.jpg")
  Debug AddTerrainTexture(0,2,200,"paul5.jpg" , "paul6.jpg")
      DefineTerrainTile(0,0,0, "amaze12.png", #False, #True) 
 
    BuildTerrain(0)   
     
   
    SkyBox("desert07.png")
    Repeat   
      If ExamineKeyboard()           
        If KeyboardPushed(#PB_Key_Left)
          KeyX = -5
        ElseIf KeyboardPushed(#PB_Key_Right)
          KeyX = 5
        Else
          KeyX = 0
        EndIf     
        If KeyboardPushed(#PB_Key_Up)
          KeyY = -5
        ElseIf KeyboardPushed(#PB_Key_Down)
          KeyY = 5
        Else
          KeyY = 0
        EndIf       
      EndIf
      If ExamineMouse()
        MouseX = -MouseDeltaX() * #CameraSpeed * 0.05
        MouseY = -MouseDeltaY() * #CameraSpeed * 0.05
      EndIf
      MoveCamera(0, CameraX(0), TerrainHeight(0, CameraX(0), CameraZ(0)) + 20, CameraZ(0), #PB_Absolute)
      MoveCamera  (0, KeyX, 0, KeyY)
      RotateCamera(0,  MouseY, MouseX, 0, #PB_Relative)   
      RenderWorld()
      FlipBuffers() 
    Until KeyboardPushed(#PB_Key_Escape)     
    End   
   
 
 
Celeron N3060 1.6 ghz duel core  4 Gb ram 32 gig storage  HD400 Graphics 160 gig external hard drive....

Offline Pfaber11

  • Hero Member
  • *****
  • Posts: 549
  • Bonjour
    • FABERSGAMES
Re: PureBasic Terrain.png
« Reply #26 on: October 26, 2019, 10:00:30 PM »
@ RemiD you were very nearly correct but it turned out to be the other way around . I had to download DirectX 9.0c for it to run so in effect I had to downgrade my system. Anyway all working now . Thanks for making me take a look at my system. And thanks to you Kris for all your help . They could of told me this on the official PureBasic forum but there you go got it sorted in the end . happy coding

I'm now going to go and try and make my own hight map now thanks for again for the help. Only thing bugging me now is will my programs run on a new system . Hmm what do you think Kris is this a problem?
Celeron N3060 1.6 ghz duel core  4 Gb ram 32 gig storage  HD400 Graphics 160 gig external hard drive....

Offline RemiD

  • Hero Member
  • *****
  • Posts: 1078
Re: PureBasic Terrain.png
« Reply #27 on: October 26, 2019, 11:26:29 PM »
Quote
ou were very nearly correct but it turned out to be the other way around . I had to download DirectX 9.0c for it to run so in effect I had to downgrade my system.
oh, good. maybe it is not downgrading but rather installing missing (old) libs... now you can continue to experiment, good luck !
DualCore AMD E-450, 1646 MHz - 6 Go DDR3 1333 SDRAM - AMD Radeon HD 6320 Graphics (384 Mo) - Windows 7 Home Premium - DirectX 11.0

Offline Pfaber11

  • Hero Member
  • *****
  • Posts: 549
  • Bonjour
    • FABERSGAMES
Re: PureBasic Terrain.png
« Reply #28 on: October 27, 2019, 12:42:51 AM »
Yes you're right missing old bits . I was preparing to admit to myself I couldn't do it but there you go if it wasn't for that directx thing I would of sorted the terrain thing a lot quicker . So glad I didn't give up . I know the terrain code backwards by now so maybe  not such a bad thing . I can't believe the people on the PureBasic website didn't mention this to me and if you hadn't said my computer might not be up to it and got me to look more closely at the required specifications I would probably of gone nuts by now. I've been at the pure basic for about two weeks now and no how to do nearly as much as over a year using AGK .
In some things Pure Basic is easier than AGK2 for example colliding objects in 3D Pure Basic wins out in that respect . For height maps AGK wins . so far anyway. I would put my latest code up that now works but I doubt anybody would like to see it although for someone starting out it might prove useful. I'll leave it for now but if anybody asks I'll be happy to share.
 Happy coding .
Celeron N3060 1.6 ghz duel core  4 Gb ram 32 gig storage  HD400 Graphics 160 gig external hard drive....

Offline Pfaber11

  • Hero Member
  • *****
  • Posts: 549
  • Bonjour
    • FABERSGAMES
Re: PureBasic Terrain.png
« Reply #29 on: October 27, 2019, 10:01:23 AM »
Hi Naughty Alien thanks for your input too. Pure Basic has got to be one of the best basics around . Can't wait to get something published with it. Still got plenty to learn but I've got the basics of 3D and 2D game creation coming along nicely . It's what I call a proper Basic  with a modern twist . Really can't believe how quickly I've picked it up . Had a few hiccups but I'm doing very well for 2 weeks in . when I was learning the python using pygame the graphics used to judder a bit and that I found unacceptable none of that with pure basic or AGK2 . Panda3D would of been what I'd be using for the 3D programming in python  and that seemed very uninviting and complicated.
Celeron N3060 1.6 ghz duel core  4 Gb ram 32 gig storage  HD400 Graphics 160 gig external hard drive....

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal