MP3D Engine Alpha 33

Applications, Games, Tools, User libs and useful stuff coded in PureBasic
User avatar
IceSoft
Addict
Addict
Posts: 1682
Joined: Thu Jun 24, 2004 8:51 am
Location: Germany

Re: MP3D Engine Alpha 30

Post by IceSoft »

I miss some 2Dphysics examples. Right?
Belive! C++ version of Puzzle of Mystralia
<Wrapper>4PB, PB<game>, =QONK=, PetriDish, Movie2Image, PictureManager,...
mpz
Enthusiast
Enthusiast
Posts: 497
Joined: Sat Oct 11, 2008 9:07 pm
Location: Germany, Berlin > member German forum

Re: MP3D Engine Alpha 30

Post by mpz »

Hi,

there a 11 Demos in the MP3D Demos\2DPhysik folder. How many do you have?

Greetings Mchael
Working on - MP3D Library - PB 5.73 version ready for download
User avatar
IceSoft
Addict
Addict
Posts: 1682
Joined: Thu Jun 24, 2004 8:51 am
Location: Germany

Re: MP3D Engine Alpha 30

Post by IceSoft »

Yes right. Maybe I used an earlier local version which hasnot the examples.
Belive! C++ version of Puzzle of Mystralia
<Wrapper>4PB, PB<game>, =QONK=, PetriDish, Movie2Image, PictureManager,...
User avatar
[blendman]
Enthusiast
Enthusiast
Posts: 297
Joined: Thu Apr 07, 2011 1:14 pm
Location: 3 arks
Contact:

Re: MP3D Engine Alpha 30

Post by [blendman] »

Thanks for your answers ;)
* what exactly do you mean? in normal case the black color is transparent and you can change the transparence color. If you need you can use the sprite blendmode, see example MP_SpriteBlendMode.pb
But how to use a simple alpha chanel (png with alpha chanel)?
I think there is some bug with transparency, you can see here :
Image

the code :

Code: Select all

MP_Graphics3D (640,480,0,3)
UsePNGImageDecoder()
Sprite = MP_CatchSprite(?MyData, ?EndOfMyData - ?MyData)
Sprite2 = MP_CatchSprite(?MyData, ?EndOfMyData - ?MyData)
ground = MP_CatchSprite(?MyGround, ?EndOfMyGround - ?MyGround)
part = MP_CatchSprite(?MyGround2, ?EndOfMyGround2 - ?MyGround2)

MP_SpriteSetZ(ground , 10)
MP_SpriteSetZ(Sprite , 50)
MP_SpriteSetCenterY(Sprite, 100)
MP_SpriteSetCenterY(Sprite2, 100)
;MP_TransparentSpriteColor(Sprite, RGB(255,0,255))
;MP_TransparentSpriteColor(Sprite2, RGB(255,0,255))

angle.f=0

While Not MP_KeyDown(#PB_Key_Escape) And Not WindowEvent() = #PB_Event_CloseWindow
  MP_AmbientSetLight (RGB(0,50,128))
  
  ;{ drawsprite
  MP_DrawTiledSprite(ground, 0,0)
  ;MP_DrawSprite(Sprite, 0, 25)
  MP_DrawSprite(part, 150, 150,Abs(Cos(angle)*100))
  MP_DrawSprite(Sprite, 300, 250, Abs(Cos(angle)*100))
  MP_DrawSprite(Sprite2, x, y)
  ;}
  
  ;{ event keyboard and depth
  angle+0.02
  If MP_keyDown(#PB_Key_Right)  :  x+1 :  EndIf 
  If MP_keyDown(#PB_Key_Left)   :  x-1 :  EndIf 
  If MP_keyDown(#PB_Key_Up)     :  y-1 :  EndIf 
  If MP_keyDown(#PB_Key_Down)   :  y+1 :  EndIf 
  MP_SpriteSetZ(Sprite2 , y)
  ;}
  
  ;MP_drawtext(10,10,Str(y))
  MP_RenderWorld() 
  MP_Flip () 
Wend

DataSection
  ;MyData :  IncludeBinary #PB_Compiler_Home + "Examples\Sources\Data\Geebee2.bmp"  :  EndOfMyData :
  MyData :  IncludeBinary "sprite.png"  :  EndOfMyData :
  MyGround :   IncludeBinary #PB_Compiler_Home + "Examples\Sources\Data\Background.bmp"  : EndofMyGround :
  MyGround2 :   IncludeBinary "particle1.png"  : EndofMyGround2 :
EndDataSection
A simple test with this sprite :
Image

The result :
Image

The code :

Code: Select all

MP_Graphics3D (640,480,0,3)

Sprite = MP_CatchSprite(?MyData, ?EndOfMyData - ?MyData)
ground = MP_CatchSprite(?MyGround, ?EndOfMyGround - ?MyGround)
MP_SpriteSetZ(ground , 10)

While Not MP_KeyDown(#PB_Key_Escape) And Not WindowEvent() = #PB_Event_CloseWindow; Esc abfrage oder Windows Schliessen
  MP_AmbientSetLight (RGB(0,50,128))
  
  ; Draw our sprite
  MP_DrawTiledSprite(ground, 0,0)
  MP_DrawSprite(Sprite, 0, 25)
  MP_DrawSprite(Sprite, x+100, 100, x)
  
  x+1    
  If x = 300
    x=0
  EndIf  
  
  MP_RenderWorld() ; Erstelle die Welt
  MP_Flip () ; Stelle Sie dar
Wend

DataSection
  MyData:     IncludeBinary "test.png":     EndOfMyData:
  MyGround :   IncludeBinary #PB_Compiler_Home + "Examples\Sources\Data\Background.bmp"  : EndofMyGround :
EndDataSection
if you change the order of
Sprite = MP_LoadSprite("donut.bmp")
Background = MP_LoadSprite("raupe40_60.bmp")
the background will be on the background and not in front. If you want you can use the MP_SpriteSetZ(Sprite , z) command to change this
ah ok. But how can we sort the sprite by Y, to do a Y-ordering ?
I don't understand why MP_SpriteSetZ() is limited to 0-10 ?
Why this function has not a variable type .w (limited from : -32768 to +32767) for example ;)?
it could be great to use it as a Z-depth/ordering if we do :

Code: Select all

MP_SpriteSetZ(Sprite , y)
But, I think we need to sort the sprite by the Y axis, for each sprite, because, some monsters can use the same sprite, and the MP_SpriteSetZ(Sprite , Z) set the Z for a Sprite, event if it is used by many "objects".

I work on two 2Diso games (3arks and Arkeos : http://vimeo.com/29874494).
I need to "sort" a lot of sprites each frame, thanks to the Y. It's ok with the purebasic engine (sprite/sprite3D), but with MP3D, I don't know how I can do that.
is there a technic to sort the sprite :)?

- About the post processing (bloom, emboss) : can we have the bloom not on a GUi for example ?
* Please make me a little example. I will test it and find a solution
Thank you, here is a little example, based on MP_bloomEffect.pb

Code: Select all

shaderFX.s = PeekS(?Shader,?ShaderEnd-?Shader)
MP_Graphics3D (640,480,0,3)
SetWindowTitle(0, "Bloom & UI") 
MP_VSync(0) 
camera=MP_CreateCamera() 
light=MP_CreateLight(1) 
Mesh=MP_CreateTeapot()  
MP_PositionEntity (Mesh,0,0,3) 
;Texture = MP_CreateTexture(640,480)
;Texture2 = MP_CreateTexture(640,480)
Texture  = MP_CreateBackBufferTexture() 
Texture2 = MP_CreateBackBufferTexture() 
MyShader = MP_CreateMyShader(shaderFX)
MyUi = MP_catchSprite(?Ui, ?UiEnd -?Ui)
ok.a =1

While Not MP_KeyDown(#PB_Key_Escape) And Not WindowEvent() = #PB_Event_CloseWindow
  
  MP_TurnEntity (Mesh,0.1,0.1,0.1) ; dreh den Würfel
  MP_RenderWorld() ; Erstelle die Welt

  ;{ Bloom
  If ok = 1      
    MP_BackBufferToTexture (Texture)
    MP_BackBufferToTexture (Texture2)
    
    MP_SetTechniqueMyShader (MyShader,"DownScale")
    MP_ShaderSetTexture (MyShader,"TextureA",Texture)
    MP_UseBackbufferShader(Texture, MyShader)
    
    MP_SetTechniqueMyShader (MyShader,"DownScale")
    MP_ShaderSetTexture (MyShader,"TextureA",Texture2)
    MP_UseBackbufferShader(Texture, MyShader)
    
    MP_SetTechniqueMyShader (MyShader,"GaussianBlurH")
    MP_ShaderSetTexture (MyShader,"TextureA",Texture)
    MP_UseBackbufferShader(Texture, MyShader)
    
    MP_SetTechniqueMyShader (MyShader,"GaussianBlurV")
    MP_ShaderSetTexture (MyShader,"TextureA",Texture)
    MP_UseBackbufferShader(Texture, MyShader)
    
    MP_SetTechniqueMyShader (MyShader,"Bloom")
    MP_ShaderSetTexture (MyShader,"TextureA",Texture)
    MP_ShaderSetTexture (MyShader,"TextureB",Texture2)
    MP_UseBackbufferShader(Texture, MyShader)
    MP_TextureToBackBuffer (Texture)
  EndIf  
  ;} Bloom
  
  If MP_keyhit(#PB_Key_Space) ; to Activate the bloom or not
    ok = 1-ok
  EndIf
  
  ; For example, I would like the text and the logo not "bloomed" ;)
  MP_DrawSprite(MyUi,200,350)
  MP_DrawText (1,1,"FPS = "+Str(MP_FPS())) 

  MP_Flip ()

Wend

DataSection
  Shader:      IncludeBinary "bloom.fx" :   ShaderEnd:
  Ui : IncludeBinary "../Epyxshader/power2.png" : UiEnd :
EndDataSection
* You can create a texture and color it. All Sprites have textures and if you change the texture you change the texture of the sprite too. use the command MP_SpriteFromTexture(Texture) for this.
Thanks, I will tried that soon ;).
- can we have an orthographic camera (to create a 3D isometric camera) ?
* i don't know, is the camera a normal one or not? Do you habe a example for this?
of course, :
purebasic\Examples\3D\camera.pb

Code: Select all

    CameraProjectionMode(0,#PB_Camera_Orthographic)
- is there a way to project shadow with sprite, or to use normal mapping to illuminate the sprite ?
* You want to make shadow with sprite? or Iluminate it? I think this can be done with the MP_SpriteBlendMode
In fact, I'm looking for this function :
Shadow projection (realised with the sprite3D purebasic engine) :
http://vimeo.com/32071358

Normal map illumination (like in 3D, but with sprite) :
http://www.youtube.com/watch?v=ut0SqBeA ... re=related

About the licence, can we use your engine in a commercial game ? Or is it a particular licence to use it ?
* the lib is for free, but please make a info that you use the MP3D in the intro
* i love donation but i am realist
I think that MP3D could be use in a commercial game easily for 3D, and 2D, but with a few little features like :
2D :
- alpha chanel for png with no bug
- possibility to sort and draw the sprite as we need
3D :
- there's a little bug with transparency of object/texture

Your engine is really interesting and it's a very great engine ;)
mpz
Enthusiast
Enthusiast
Posts: 497
Joined: Sat Oct 11, 2008 9:07 pm
Location: Germany, Berlin > member German forum

Re: MP3D Engine Alpha 30

Post by mpz »

Hi blendman,

i dont have forgotten your questions, but i need time to understand your problems and find a solution. In the mp3 3d engine i use dx9 sprites and they are different to pb sprites, because i think pb has Billboards (flat meshs) and not sprites. So the alpha transparency is different to use. The problem with the "trancparence bug" could be a order problem of the both sprites. if you change the order of sprite and background the picture is different. You can change the order also with a command MP_ListSwapElements(9, sprite , background). I will make some more tests with alpha transparency an sprite, perhaps i find a better solution or a new function for a future version of mp3d

MP_SpriteSetZ() is limited to 0-10 ?, yes use a trick and patch the z-order position with fixed values, i cant calculate for now but i work on it.

I think you main question is to make light on the human position and make shadow on the animal position. I think you dont need alpha sprites for that, you can use the MP_SpriteBlendMode command for that. Can you send me the (anim) sprite of the human and the animal please (as pm) ? i will make a little demo with light and shadow without alpha sprites...

post processing and gui = you need only MP_RenderSprite() for the sprite and MP_RenderText() for the fps
MP_RenderSprite()
MP_RenderText()

Code: Select all

shaderFX.s = PeekS(?Shader,?ShaderEnd-?Shader)
MP_Graphics3D (640,480,0,3)
SetWindowTitle(0, "Bloom & UI") 
MP_VSync(0) 
camera=MP_CreateCamera() 
light=MP_CreateLight(1) 
Mesh=MP_CreateTeapot()  
MP_PositionEntity (Mesh,0,0,3) 
;Texture = MP_CreateTexture(640,480)
;Texture2 = MP_CreateTexture(640,480)
Texture  = MP_CreateBackBufferTexture() 
Texture2 = MP_CreateBackBufferTexture() 
MyShader = MP_CreateMyShader(shaderFX)
MyUi = MP_catchSprite(?Ui, ?UiEnd -?Ui)
ok.a =1

While Not MP_KeyDown(#PB_Key_Escape) And Not WindowEvent() = #PB_Event_CloseWindow
  
  MP_TurnEntity (Mesh,0.1,0.1,0.1) ; dreh den Würfel
  MP_RenderWorld() ; Erstelle die Welt

  ;{ Bloom
  If ok = 1      
    MP_BackBufferToTexture (Texture)
    MP_BackBufferToTexture (Texture2)
    
    MP_SetTechniqueMyShader (MyShader,"DownScale")
    MP_ShaderSetTexture (MyShader,"TextureA",Texture)
    MP_UseBackbufferShader(Texture, MyShader)
    
    MP_SetTechniqueMyShader (MyShader,"DownScale")
    MP_ShaderSetTexture (MyShader,"TextureA",Texture2)
    MP_UseBackbufferShader(Texture, MyShader)
    
    MP_SetTechniqueMyShader (MyShader,"GaussianBlurH")
    MP_ShaderSetTexture (MyShader,"TextureA",Texture)
    MP_UseBackbufferShader(Texture, MyShader)
    
    MP_SetTechniqueMyShader (MyShader,"GaussianBlurV")
    MP_ShaderSetTexture (MyShader,"TextureA",Texture)
    MP_UseBackbufferShader(Texture, MyShader)
    
    MP_SetTechniqueMyShader (MyShader,"Bloom")
    MP_ShaderSetTexture (MyShader,"TextureA",Texture)
    MP_ShaderSetTexture (MyShader,"TextureB",Texture2)
    MP_UseBackbufferShader(Texture, MyShader)
    MP_TextureToBackBuffer (Texture)
  EndIf  
  ;} Bloom
  

  
  If MP_keyhit(#PB_Key_Space) ; to Activate the bloom or not
    ok = 1-ok
  EndIf
  
  ; For example, I would like the text and the logo not "bloomed" ;)
  MP_DrawSprite(MyUi,200,350)
  
  MP_DrawText (1,1,"FPS = "+Str(MP_FPS())) 
  
  MP_RenderSprite() 
  MP_RenderText() 
  
  MP_Flip ()

Wend

DataSection
  Shader:      IncludeBinary "bloom.fx" :   ShaderEnd:
  Ui : IncludeBinary "../Epyxshader/power2.png" : UiEnd :
EndDataSection
i will have a look on Camera_Orthographic on weekend, i have family and time is short


P.S. Antialising 2x and 4x is integrated and works fine now, was a good idea...

Greetings Michael
Working on - MP3D Library - PB 5.73 version ready for download
User avatar
[blendman]
Enthusiast
Enthusiast
Posts: 297
Joined: Thu Apr 07, 2011 1:14 pm
Location: 3 arks
Contact:

Re: MP3D Engine Alpha 30

Post by [blendman] »

Thanks for your answer :)

mpz wrote:i dont have forgotten your questions, but i need time to understand your problems and find a solution. In the mp3 3d engine i use dx9 sprites and they are different to pb sprites, because i think pb has Billboards (flat meshs) and not sprites. So the alpha transparency is different to use. The problem with the "trancparence bug" could be a order problem of the both sprites. if you change the order of sprite and background the picture is different. You can change the order also with a command MP_ListSwapElements(9, sprite , background). I will make some more tests with alpha transparency an sprite, perhaps i find a better solution or a new function for a future version of mp3d
ok, thank you ;). I think it's very important, to use your engine for 2D game ;). And your engine is so great, that it could be excellent to use the alpha transparency for the sprite ;). I have tried your solution, but I have somes bugs with transparency alpha and png, even if I change their position, or MP_ListSwapElements().
MP_SpriteSetZ() is limited to 0-10 ?, yes use a trick and patch the z-order position with fixed values, i cant calculate for now but i work on it.
ok. And can we "sort" the sprites, by their Y position (like with SortStructuredList()), and draw they by the Y ?
I think you main question is to make light on the human position and make shadow on the animal position. I think you dont need alpha sprites for that, you can use the MP_SpriteBlendMode command for that. Can you send me the (anim) sprite of the human and the animal please (as pm) ? i will make a little demo with light and shadow without alpha sprites...
heu, what human and what animal ? :)
I can send to you some sprite (the character). But in fact, I'm looking about a technic like "normal map lighting", like your exemple with normal map shader, but with sprite ;).
I don't know if it's possible.
post processing and gui = you need only MP_RenderSprite() for the sprite and MP_RenderText() for the fps
MP_RenderSprite()
MP_RenderText()
Thank you very much, it's great !
i will have a look on Camera_Orthographic on weekend, i have family and time is short
I totaly understand, I have a family too, and the family is more important than the code ;).
P.S. Antialising 2x and 4x is integrated and works fine now, was a good idea...
it's a really great news :D.

Thank you for your answers , and keep up your very great work ;) !
mpz
Enthusiast
Enthusiast
Posts: 497
Joined: Sat Oct 11, 2008 9:07 pm
Location: Germany, Berlin > member German forum

Re: MP3D Engine Alpha 30

Post by mpz »

Hi Blendman,

if you send me some sprites with background and charakter i will check it and will make a demo. Perhaps i have new ideas and will finde something special...

Greetings Michael
Working on - MP3D Library - PB 5.73 version ready for download
User avatar
[blendman]
Enthusiast
Enthusiast
Posts: 297
Joined: Thu Apr 07, 2011 1:14 pm
Location: 3 arks
Contact:

Re: MP3D Engine Alpha 30

Post by [blendman] »

ok, I have send you a message with some sprites ;)

Thanks
morosh
Enthusiast
Enthusiast
Posts: 329
Joined: Wed Aug 03, 2011 4:52 am
Location: Beirut, Lebanon

Re: MP3D Engine Alpha 30

Post by morosh »

Rubik' Cube again!!

just installing final 4.60 right now, then re-copying the MP3D files , then trying to compile, I got:
POLINK : fatal error : access is denied

what's the problem??
PureBasic: Surprisingly simple, diabolically powerful
mpz
Enthusiast
Enthusiast
Posts: 497
Joined: Sat Oct 11, 2008 9:07 pm
Location: Germany, Berlin > member German forum

Re: MP3D Engine Alpha 30

Post by mpz »

Hi,

i have tested the Rubik' Cube with the last release 4.60 and it works fine. Perhaps you must install mp3d with the installer or check if the PureLibraries\Windows\Library file are copied too. Is it the only not working demo file or have you other not working files too?

In most case the "POLINK : fatal error : access is denied is" is a library problem. If this is not working install the Purebasic 4.60 in a new folder, install MP3d there and check it there again.

i hope this help

Greetings Michael
Working on - MP3D Library - PB 5.73 version ready for download
User avatar
Didelphodon
PureBasic Expert
PureBasic Expert
Posts: 450
Joined: Sat Dec 18, 2004 11:56 am
Location: Vienna - Austria
Contact:

Re: MP3D Engine Alpha 30

Post by Didelphodon »

Seems as BumpMaps and Shadows aren't cooperating.
When I use both, shadows win in terms of no more BumpMaps.

I guess that's not as it was supposed to be?

Further questions:
* Is it possible to enable Antialiasing, Anisotropic filtering, etc.?
* Is it possible to restrict shadows to specific objects?
* Is it possible to provide a low-poly-version of a mesh for shadows?
* How are Skyboxes done? At least I found a rendering-command but I dunno how to configure any skybox.

I just recently took my first look at MP3D and I find it pretty cool.
As it's rather easy to use I hope it will grow in its capabilities to beat the engines I've spent my money on so far. It's actually possible.
Keep up the good work!

Cheers, Didel.
Go, tell it on the mountains.
mpz
Enthusiast
Enthusiast
Posts: 497
Joined: Sat Oct 11, 2008 9:07 pm
Location: Germany, Berlin > member German forum

Re: MP3D Engine Alpha 30

Post by mpz »

Hi Didelphodon,

thanks for the feedback, here comes some answers

BumpMaps and Shadows aren't cooperating
* Yes these are different rendering kinds. I think about a different kind of rendering methodes(i mean shader rendering)and then it will be possible to make both at the same time.

Is it possible to enable Antialiasing, Anisotropic filtering, etc.?
* Antialiasing is in the next version integrated. I dont habe infromationa about dx9 Anisotropic filtering, if i find something i can integrade it too

Is it possible to restrict shadows to specific objects?
* now for now, but this is possible for the next version.

* Is it possible to provide a low-poly-version of a mesh for shadows?
the function to create a low-poly-version of a mesh is integrated. But you need all times two versions of a mesh if you use this in shadows. I think about this but it is nothing for the next version.

How are Skyboxes done? At least I found a rendering-command but I dunno how to configure any skybox.
* yes, the documentaion is bad. I make the documetation alone and have more fun to make the lib (and have no fun to make the documetation). you find an example of the Skybox in the MP_terrain.pb demo and you need 6 grafic for all sides of the cube

I hope these answers helps..

Greetings Michael
Working on - MP3D Library - PB 5.73 version ready for download
User avatar
Didelphodon
PureBasic Expert
PureBasic Expert
Posts: 450
Joined: Sat Dec 18, 2004 11:56 am
Location: Vienna - Austria
Contact:

Re: MP3D Engine Alpha 30

Post by Didelphodon »

Thx for your detailed answers. They helped a lot.

Cheers, Didel.
Go, tell it on the mountains.
User avatar
electrochrisso
Addict
Addict
Posts: 989
Joined: Mon May 14, 2007 2:13 am
Location: Darling River

Re: MP3D Engine Alpha 30

Post by electrochrisso »

Any chance of an alternative download link, as file-upload not working properly, firefox tells me that the download is complete and the file size is only 2.4mb and the zip is corrupted. I seem to get a lot of problems with file-upload corrupting a lot of the downloads for some reason, probably getting bumped because too many people using it.
PureBasic! Purely the best 8)
User avatar
electrochrisso
Addict
Addict
Posts: 989
Joined: Mon May 14, 2007 2:13 am
Location: Darling River

Re: MP3D Engine Alpha 30

Post by electrochrisso »

Yes file-upload does have a download time limit of 30 min, then boots, so not good for people on low speed network and the download is large, I think that might be some kind of discrimination.
I will try a download manager and see if file-upload allows resuming of broken download, it will be the only way for me to test out your engine.
PureBasic! Purely the best 8)
Post Reply