Page 1 of 1

Posted: Tue Dec 23, 2008 3:23 pm
by mpz
Hi Cpl.Bator,

Amazing, cool and exactly what i need. Here is a little Example made with my MP 3D Engine and a created normal map from your program.

MP_normal_test.exe:
http://uploaded.to/?id=cemkz2

Code:

Code: Select all

;////////////////////////////////////////////////////////////////
;//
;// Project Title: MP 3D Engine
;// File Title: EarthBumpmap.pb
;// Created On: 2.12.2008
;// Updated On: 
;// Author: Michael Paulwitz
;// OS:Windows
;// 
;// Demofile Earth Bumpmap
;// 
;////////////////////////////////////////////////////////////////

;-
;- ProgrammStart


MP_Graphics3D (640,480,0,3) ; Create Windows #Window = 0
SetWindowTitle(0, "3D Bumpmap Demo, left world / right with created normals") ; Name

camera=MP_CreateCamera() ; Create Camera

x.f=0 : y.f=0 : z.f = -4 
MP_PositionCamera(camera,x.f,y.f,z.f) ; Camera position 

light=MP_CreateLight(1,90,0,0) ; Light on 

earth1=MP_Createsphere(20) ; Sphere 1
earth2=MP_Createsphere(20) ; Sphere 2

Textur=MP_CreateTextureFromFileInMemory (?Earth_map,?Earth_map-?Earth_map_normals)
Textur2=MP_CreateTextureFromFileInMemory (?Earth_map_normals,?Earth_map_normals-?Earth_map_end)

MP_EntityTexture (earth1,textur)
MP_EntityBumpmapTexture (earth1,textur2)

MP_EntityTexture (earth2,textur)

MP_PositionEntity (Earth1,1,0,0) ; Position Earth1 
MP_PositionEntity (Earth2,-1,0,0) ; Position Earth2 

While Not MP_KeyDown(#PB_Key_Escape) And Not MP_WindowEvent() = #PB_Event_CloseWindow; Esc or close

    MP_TurnEntity (earth1,-0.05,0,0) ; Move Earth1
    MP_TurnEntity (earth2,-0.05,0,0) ; Move Earth2
    MP_RenderWorld () ; Hier gehts los
    MP_Flip () ; 

Wend

DataSection
  Earth_map:
  IncludeBinary "c:\earth_map.jpg" ; Mein MP Bild included
  Earth_map_normals:
  IncludeBinary "c:\earth_map_normals.jpg" ; Mein MP Bild included
  Earth_map_end:
EndDataSection

best regards,
Michael

Posted: Tue Dec 23, 2008 3:29 pm
by Anonymous
i can't test your exe , i'm on linux :/ your engine work on linux ?

Posted: Tue Dec 23, 2008 8:45 pm
by mpz
Hi Cpl.Bator,

i am sorry, it is DX9 with Windows...

[img]
http://picfront.de/d/4XXNDZGLH/3dEarthDemo.png
[/img]


Michael

Posted: Tue Dec 23, 2008 9:08 pm
by Anonymous
it's 100% pb your engine ? why do you not use Opengl ? :D

Posted: Tue Dec 23, 2008 9:24 pm
by mpz
Yes all commands are Purebasic codes and you can use a Purebasic lib file, you don't need a Dll (only DX9).

xperience2003 is working on a Opengl 3D System and this works great. I hope he will do sometimes a linux version. Long years ago i use BlitzBasic on amiga and then BlitzBasic 3D on PC. I want to have the same easy commands for 3D on Purebasic and find some good codes for DX9.

OpenGl Tlib (windows)
http://www.purebasic.fr/german/viewtopi ... light=tlib

You have seen the picture 3DEarthDemo.png? :P

Posted: Tue Dec 23, 2008 10:07 pm
by Anonymous
yes , great work , tomorow i will test your exe on my other pc with xp!:D
Thx for th link ;)

Posted: Tue Dec 23, 2008 11:54 pm
by mpz
Hi Cpl.Bator,

in this case i send you a file to test your own Normal maps with 4 mesh types. you can load the texture and normal map and test it with sphere, cube, teapot (you know for all games the importants meshs like in the film "The bloody killer teapot coming on earth") and plane:

MP_normal_test2.exe
http://uploaded.to/?id=ifygew

This code with the mp_engine looks like:

Code: Select all


;////////////////////////////////////////////////////////////////
;//
;// Project Title: MP 3D Engine
;// File Title: EarthBumpmap.pb
;// Created On: 2.12.2008
;// Updated On: 
;// Author: Michael Paulwitz
;// OS:Windows
;// 
;// Demofile Earth Bumpmap
;// 
;////////////////////////////////////////////////////////////////

;-
;- ProgrammStart

MP_Graphics3D (640,480,0,3) ; Create Windows #Window = 0
SetWindowTitle(0, "3D Bumpmap Demo, left world / right with created normals") ; Name

  If CreateMenu(0, WindowID(0)) ; MenĂ¼ erstellen/Create Menu 
    MenuTitle("&File")
      MenuItem( 1, "&Load Texture") 
      MenuItem( 2, "&Load Bumpmap Texture") 
      MenuBar() 
      MenuItem( 3, "&End") 
    MenuTitle("&Mesh") 
      MenuItem(4, "Sphere")
      SetMenuItemState(0,4,1)
      MenuItem(5, "Cube")
      MenuItem(6, "Teapot")
      MenuItem(7, "Plane")
  EndIf 

camera=MP_CreateCamera() ; Create Camera

x.f=0 : y.f=0 : z.f = -4 
MP_PositionCamera(camera,x.f,y.f,z.f) ; Camera position 
light=MP_CreateLight(1,90,0,0) ; Light on 
earth1=MP_Createsphere(20) ; Sphere 1
earth2=MP_Createsphere(20) ; Sphere 2

Textur=MP_CreateTextureFromFileInMemory (?Earth_map,?Earth_map-?Earth_map_normals)
Textur2=MP_CreateTextureFromFileInMemory (?Earth_map_normals,?Earth_map_normals-?Earth_map_end)

MP_EntityTexture (earth1,textur)
MP_EntityBumpmapTexture (earth1,textur2)

MP_EntityTexture (earth2,textur)

MP_PositionEntity (Earth1,1,0,0) ; Position Earth1 
MP_PositionEntity (Earth2,-1,0,0) ; Position Earth2 

While Not MP_KeyDown(#PB_Key_Escape) ; ESC 
 Select MP_WindowEvent()  ; WindowsEvent abfrage 
      Case #PB_Event_Menu 
        Select EventMenu()  ; Welches MenĂ¼? / Menuquestion 
          Case 1 ; Load Texture
              Pattern$ = "Image Files (bmp,jpg,tga,png,dds,ppm,dib,hdr,pfm|*.bmp;*.jpg;*.tga;*.png;*.dds;*.ppm;*.dib;*.hdr;*.pfm" 
              ;directory$ = "C:\Programme\PureBasic\media\" 
              File.s = OpenFileRequester("Load Texture!", directory$, Pattern$,  0) 
              If File
                 MP_FreeTexture (Textur)
                 Texture =  MP_LoadTexture(File.s)
                 MP_EntityTexture (earth1,Textur)
                 MP_EntityTexture (earth2,Textur)
               EndIf
          Case 2 ; Load Bumpmap Texture
              Pattern$ = "Image Files (bmp,jpg,tga,png,dds,ppm,dib,hdr,pfm|*.bmp;*.jpg;*.tga;*.png;*.dds;*.ppm;*.dib;*.hdr;*.pfm" 
              ;directory$ = "C:\Programme\PureBasic\media\" 
              File.s = OpenFileRequester("Load Bump Texture!", directory$, Pattern$,  0) 
              If File
                 MP_FreeTexture (Textur2)
                 Texture2 =  MP_LoadTexture(File.s)
                 MP_EntityBumpmapTexture (earth1,textur2)
               EndIf
          Case 3 ; end
                  End
          Case 4 ; Sphere
               SetMenuItemState(0,4,1)
               SetMenuItemState(0,5,0)
               SetMenuItemState(0,6,0)
               SetMenuItemState(0,7,0)
               MP_FreeEntity (earth1)
               MP_FreeEntity (earth2)
               earth1=MP_Createsphere(20) ; Sphere 1
               earth2=MP_Createsphere(20) ; Sphere 2
               MP_PositionEntity (Earth1,1,0,0) ; Position Earth1 
               MP_PositionEntity (Earth2,-1,0,0) ; Position Earth2
               MP_EntityTexture (earth1,textur)
               MP_EntityBumpmapTexture (earth1,textur2)
               MP_EntityTexture (earth2,textur)
          Case 5 ; Cube
               SetMenuItemState(0,4,0)
               SetMenuItemState(0,5,1)
               SetMenuItemState(0,6,0)
               SetMenuItemState(0,7,0)
               MP_FreeEntity (earth1)
               MP_FreeEntity (earth2)
               earth1=MP_Createcube() ; Cube 1
               earth2=MP_Createcube() ; Cube 2
               MP_PositionEntity (Earth1,1,0,0) ; Position Earth1 
               MP_PositionEntity (Earth2,-1,0,0) ; Position Earth2
               MP_EntityTexture (earth1,textur)
               MP_EntityBumpmapTexture (earth1,textur2)
               MP_EntityTexture (earth2,textur)
          Case 6 ; Teapot
               SetMenuItemState(0,4,0)
               SetMenuItemState(0,5,0)
               SetMenuItemState(0,6,1)
               SetMenuItemState(0,7,0)
               MP_FreeEntity (earth1)
               MP_FreeEntity (earth2)
               earth1=MP_CreateTeapot () ; Teapot 1
               earth2=MP_CreateTeapot () ; Teapot 1
               MP_PositionEntity (Earth1,1,0,0) ; Position Earth1 
               MP_PositionEntity (Earth2,-1,0,0) ; Position Earth2
               MP_EntityTexture (earth1,textur)
               MP_EntityBumpmapTexture (earth1,textur2)
               MP_EntityTexture (earth2,textur)
          Case 7 ; Plane
               SetMenuItemState(0,4,0)
               SetMenuItemState(0,5,0)
               SetMenuItemState(0,6,0)
               SetMenuItemState(0,7,1)
               MP_FreeEntity (earth1)
               MP_FreeEntity (earth2)
               earth1=MP_CreatePolygon (1,4) ; Plane 1
               earth2=MP_CreatePolygon (1,4) ; Plane 2
               MP_PositionEntity (Earth1,1,0,0) ; Position Earth1 
               MP_PositionEntity (Earth2,-1,0,0) ; Position Earth2
               MP_EntityTexture (earth1,textur)
               MP_EntityBumpmapTexture (earth1,textur2)
               MP_EntityTexture (earth2,textur)               
        EndSelect 
      Case #PB_Event_CloseWindow 
         End 
EndSelect

    MP_TurnEntity (earth1,-0.06,0,0) ; Move Earth1
    MP_TurnEntity (earth2,-0.06,0,0) ; Move Earth2
    
    MP_RenderWorld () ; Hier gehts los
    MP_Flip () ; 

Wend

DataSection
  Earth_map:
  IncludeBinary "c:\earth_map.jpg" ; Mein MP Bild included
  Earth_map_normals:
  IncludeBinary "c:\earth_map_normals.jpg" ; Mein MP Bild included
  Earth_map_end:
EndDataSection


Posted: Wed Dec 24, 2008 11:33 am
by Anonymous
hi , For more effect , you can add light and move this for play with the bump :)

And for TLib , it's doesn't work with pb 4.3 , "pb_string missing" , and Avast found virus in the archive :?

Posted: Mon Dec 29, 2008 12:58 am
by mpz
Hi Cpl.Bator,

the author works on a new version for 4.30, but he has only one example for now. Please use the SmalTLib instead the Tlib library.

http://www.digitalarts-egypt.com/tlx/tlibpublic.rar

I think the new version will come soon...

P.S. The TLib-terrain.pb, DemoFX-Bitmapfonts.pb, 3-TLib-Drawing3d.pb and 2-TLib-Drawing2d.pb example of the old Tlib works fine too

Michael

Posted: Tue Jan 06, 2009 9:51 am
by vanbeck
''By the way: Wouldn't be Parallax Mapping enough for that? It just makes a relief in one direction (normal map is grayscale), not like bump mapping using red, green and blue colorchannel.''

Not sure what you mean.

Bump mapping uses greyscale images.
Normal mapping uses RGB images.
Parallax mapping uses RGB normal map plus separate height map.

Parallax mapping can produce some incredible results, but these normal maps look good, a lot of bump to normal generators are a real pain to use.

Parallax Mapping

Posted: Tue Jan 06, 2009 11:55 am
by Violet
Oh, alright. I just read in Wikipedia (once upon a time :wink: ) that Parallax Mapping just uses a grayscale Map.