Page 9 of 71

Re: MP3D Engine Alpha 30

Posted: Wed Jun 13, 2012 11:44 am
by mpz
Hi,

thanks for your good informations of your tests. I test mp3d it with older grafic card too. Perhaps it is the solution (16bit) of the shadow texture i create for the shadow. I will make a new exe for testing. I think it will be a little problem and we find the solution.

Greetings Michael

Re: MP3D Engine Alpha 30

Posted: Wed Jun 13, 2012 2:14 pm
by applePi
Hi
i have found something which may be important, the talk below is while using windows xp only since in windows 7 using MP_InitShadow() produce an error on my system
you may not believe that but i am using always a 640 X 480 resolution. i don't like 800x600 or above resolutions. so running the shadows programs and your MP_Schachdemo.exe indeed they produce a shadow but it is overwhelming and big shadow that cast it self over the whole objects. and when i have changed the resolution to 800x600 the shadow appears look the picture running MP_ChessShadow.pb or MP_Schachdemo.exe the same with the above resolutions and the same whether using 32bit color quality or 16bit.
http://s13.postimage.org/vz76s4cmf/chess_Shadow.png
now i have run your MP_01_Primitives.pb its falling objects (spheres, pyramids, else) are colorfull without using MP_InitShadow() as it is originally like this picture:
http://s15.postimage.org/wva3qyzsb/shadow_Disabled.png

but when i have inserted MP_InitShadow() in the code , there is shadow but with a problem: the falling objects are black and not colored
http://s10.postimage.org/vmzs0vlh5/shadow_Enabled.png

note: since the new vga cards don't have the 640x480 res, you can use the xp_quickres http://www.dougknox.com/xp/utils/xp_quickres.htm to change to any resolution it can be used also in windows 7, its icon appears on the taskbar

regards

Re: MP3D Engine Alpha 30

Posted: Wed Jun 13, 2012 3:16 pm
by mpz
Hi,

oh, my shadowmap have the size 512x512 and cant create on 640x480. I have created some testfiles and please test them and show me the solution:

Shows normal shader demo with 16 Bit Shadow
http://www.flasharts.de/mpz/Shadowdemo2.exe

Shows Chess shader demo with 24 Bit Shadow
http://www.flasharts.de/mpz/Shadowdemo3.exe

shows stencil sides
http://www.flasharts.de/mpz/Shadowdemo4.exe

Greetings Michael

Re: MP3D Engine Alpha 30

Posted: Wed Jun 13, 2012 5:00 pm
by applePi
thank you, your programs now display shadow in the 640x480 resolution
using winxp: (using 32bit color) and the same as in 16bit color)
http://s16.postimage.org/nnmk4v3o5/Shad ... 40x480.png
http://s7.postimage.org/i0yxfl6nf/Shado ... 00x600.png

http://s17.postimage.org/43o22rven/Shad ... 40x480.png
http://s16.postimage.org/vs3v134ut/Shad ... 00x600.png

http://s15.postimage.org/isekoob6z/Shad ... 40x480.png
Shadowdemo4_800x600.png the same as above

in the windows 7 it gives as before this error: error CreateEffect!
http://s7.postimage.org/e7nupeiuj/win7.png
the Shadowdemo4.exe gives first the above error then when clicking okay it display the result as in the :
http://s15.postimage.org/isekoob6z/Shad ... 40x480.png

regards

Re: MP3D Engine Alpha 30

Posted: Fri Jun 15, 2012 2:34 pm
by applePi
Hi
have you though before to make a general purpose dll of your engine so it can be called from any windows programming language , an example is the free darkgdk http://www.thegamecreators.com/?m=view_product&id=2128 which was once upon time advertised on the microsoft vc++ 2008 express ed page , and some educational institutions have adopted that free version to teach c++ by using graphics from darkgdk ie like learning through playing with toys. of course darkgdk are calling the directx/direct3d functions like darkbasic do.
your engine are doing the same by using purebasic.
any general ideas about the possiblity of a general purpose dll of your engine. so it can be used by more people from several programming languages.
regards

Re: MP3D Engine Alpha 30

Posted: Sun Jun 17, 2012 5:37 pm
by Olby
Have a look at DarkGDK 2.0 it's currently in release candidate status and comes in a form of single dll file. Out of the box it supports C++, PureBasic, .Net. Experimental Java and D language support is in progress. Best part is that it comes with SDK that allows you to generate headers for any language that supports DLL calls. Compared to DarkGDK 1.0 it is faster, has better documentation and is generally more up to date. Besides there's now a dedicated developer who is working solely on GDK 2.0 and will be able to fix long standing issues with DBPro that are present in GDK as well. Future looks bright. You can try the RC now (it is free but will expire at some point).

http://www.purebasic.fr/english/viewtop ... 14&t=49977

Re: MP3D Engine Alpha 30

Posted: Sun Jun 24, 2012 9:27 am
by applePi
Hi
i am studying the example MP_PickingTriangle.pb from the picking demos in the MP3D examples.
it works perfect, but i have some trouble understanding how the triangle indexes works. in the attached image in the triangle index 1:
Image

the index0 = 1, index1 = 12, index2 = 0. i was expecting that the indexes go like this for the first triangle 0,1,2 and for the second triangle like this 3,4,5 but here for the second triangle it is 12, 11, 0. so how indexes numbering works here.
second question (or wish):
if the MP_EntityGetTriangle(mesh, triangleindex, 0) determines the index number of a vertex point of a specific triangle in a mesh, i wish that we can change the specific vertex point coordinates of a specific triangle something like MP_EntitySetTriangleZ(mesh, triangleIndes,0)
and MP_EntitySetTriangleX, MP_EntitySetTriangleY. just a suggestion
thanks

Re: MP3D Engine Alpha 30

Posted: Mon Jun 25, 2012 9:24 pm
by Zach
For some reason I can't extract your MP3D .zip download.

When I try with Windows Explorer I just get a generic error.
When I try with 7zip I get a CRC error on setup_mp3d_30.exe saying the file is broken

Re: MP3D Engine Alpha 30

Posted: Mon Jun 25, 2012 10:18 pm
by gnasen
you can use this download for MP3D version 30 instead:
Download
I checked this file, no problem with winrar.

Re: MP3D Engine Alpha 30

Posted: Tue Jun 26, 2012 5:27 pm
by Zach
Thanks, that download worked.. Now to see if I can understand any of this :o

textured animated 3D curves

Posted: Thu Jun 28, 2012 5:12 pm
by applePi
here is how to draw a textured animated 3D curves, it depends on the MP3D ability to change dynamically the model vertices coordinates even the real models such as 3ds models. i have used as a template the example by Michael "MP_Bewegende Objekte.pb" from the MP3D library examples\mesh.
i have used a plane 30x30 so it has 961 vertices (31x31). the plot range for the first example is from -3 ro +3 so we need to project the real plot to the 30x30 plane. we just multiply the x,y vertices of the plane by 6/30.
the first example will plot a curve resemble a flying carpet textured by a tiger fur. save the texture from here http://s13.postimage.org/b88odkv3r/tiger.png to the program folder. you can tune the figure by changing the timer values, or more or less z values.

Code: Select all

;//published originally by Michael Paulwitz as the library example "MP_Bewegende Objekte.pb"
;//used and modified here to draw a 3D curve
MP_Graphics3D (640,480,0,3) ; Erstelle ein WindowsFenster #Window = 0
SetWindowTitle(0, "3D animated curves _ use arrow keys to rotate,..... z, x    to zoom  in/out") ; So soll es heissen

camera=MP_CreateCamera() ; Kamera erstellen

camX.f=0 : camY.f=0 : camZ.f = -40 : rotX=0: rotY=45
Global timer.l: Global tX.f,tY.f,tZ.f
tX=-3.2:tY=-3
MP_PositionCamera(camera,camX,camY,camZ) 
light=MP_CreateLight(2) 
light2=MP_CreateLight(2) 

MP_LightSetColor(light,RGB(255,255,255))
MP_LightSetColor(light2,RGB(255,255,255))
MP_AmbientSetLight (RGB(255,220,255)) 


MP_PositionEntity(light,0,50,-60)
MP_PositionEntity(light2,0,100,60)

plane=MP_CreatePlane(30,30) ;the plane used for draw
teapot=MP_CreateTeapot() ; just a fantasia

texture =  MP_LoadTexture("tiger.png")
;texture = MP_CreateTextureColor(256, 256, RGBA(0, 255, 255, 255))
MP_EntitySetTexture(plane, texture)
MP_MaterialEmissiveColor (texture, 0, 0, 0, 0) 
;MP_MaterialSpecularColor(plane,1,255,10,0,1)

For n = 0 To MP_CountVertices(plane)-1

          farbea.l = Random(255)
          farbeb.l = Random(255)
          farbec.l = Random(255)

          ;uncomment the below line to enable colorfull demo
          ;MP_VertexSetColor (plane,n,RGB(farbea,farbeb,farbec))
          ;MP_VertexSetColor (plane,n,RGB(255,100,0))
Next

;MessageRequester("",Str(MP_CountVertices(plane)))
While Not MP_KeyDown(#PB_Key_Escape) And Not WindowEvent() = #PB_Event_CloseWindow; Esc abfrage oder schliessen
    
  ;play with timer values to tune nore
  timer = MP_ElapsedMicroseconds()/200
  For n = 0 To MP_CountVertices(plane)-1
        x.f = MP_VertexGetX (plane,n)
        y.f = MP_VertexGetY (plane,n)
        z.f = MP_VertexGetZ (plane,n)
        
        ;projecting the draw from -3 to 3 over -15 to 15:
        x=x*6/30: y=y*6/30
        
        ;zufall.f = (Cos(timer/600+(Pow(x*(6/30),2)+Pow(y*(6/30),2))/4))/(Pow(x,2) + Pow(y,2) + 3.1415/9)
        ;zufall.f = (Cos(timer/600+(Sqr(Pow(2*x*(6/30),2)+Pow(2*y*(6/30),2)))))
        zufall.f = (Sin(timer/100+x)+Sin(timer/100+y))/5
        ;MP_VertexSetX (plane,n, x + zufall)
        ;MP_VertexSetY (plane,n, y + zufall)
        MP_VertexSetZ (plane,n, z + zufall)
        If n=900
          zufall.f = (Sin(timer/100+0*(6/30))+Sin(timer/100+(-1)*(6/30)))/5
          MP_PositionEntity(teapot,0,z+zufall,-1)
        EndIf  


   Next 
   
   If MP_KeyDown(#PB_Key_Up)
     rotY+1
     ElseIf MP_KeyDown(#PB_Key_Down)
     rotY-1
     ElseIf MP_KeyDown(#PB_Key_Right)
     rotX+1
     ElseIf MP_KeyDown(#PB_Key_Left)
     rotX-1
     ElseIf MP_KeyDown(#PB_Key_Z )  
     camZ+1
     ElseIf MP_KeyDown(#PB_Key_X )    
     camZ-1
    
   EndIf 
   
   MP_RotateEntity(plane, rotX, rotY, 0 )
   MP_PositionCamera(camera,camX,camY,camZ)
   MP_RenderWorld () 
   MP_Flip () ; 

Wend

End

Image

if you want to try more functions uncoment one of another 2 functions in the code

the other code resemble the example posted here http://www.purebasic.fr/english/viewtop ... =7&t=50171 but to plot a textured 3D letter 'A' , save this texture to use : http://s18.postimage.org/hvzb0h2s9/snake.png
. and the plot are from -1 to +1 so we have to multiply the 30x30 plane x,y by 2/30, there is no timer here since we want to plot only the z values.

Code: Select all

;//published originally by Michael Paulwitz as example "MP_Bewegende Objekte.pb"
;//used and modified here to show textured 3D 'A' letter
MP_Graphics3D (640,480,0,3) 
SetWindowTitle(0, "3D animated curves _ use arrow keys to rotate,..... z, x    to zoom  in/out") ; So soll es heissen

camera=MP_CreateCamera()

camX.f=0 : camY.f=0 : camZ.f = -60 : rotX=0: rotY=0: rotZ=-90
Global timer.l: Global tX.f,tY.f,tZ.f
tX=-3.2:tY=-3
MP_PositionCamera(camera,camX,camY,camZ)
light=MP_CreateLight(2)
MP_LightSetColor(light,RGB(255,255,255))
MP_AmbientSetLight (RGB(255,220,255)) 

MP_PositionEntity(light,0,50,-60)

plane=MP_CreatePlane(30,30)
tea=MP_CreateTeapot() 

texture =  MP_LoadTexture("snake.png")
MP_EntitySetTexture(plane, texture)
MP_MaterialEmissiveColor (texture, 0, 0, 0, 0) 
;MP_MaterialSpecularColor(plane,1,255,10,0,1)
;MessageRequester("",Str(MP_CountVertices(plane)))
While Not MP_KeyDown(#PB_Key_Escape) And Not WindowEvent() = #PB_Event_CloseWindow; Esc abfrage oder schliessen
    
    For n = 0 To MP_CountVertices(plane)-1
        x.f = MP_VertexGetX (plane,n)
        y.f = MP_VertexGetY (plane,n)
        z.f = MP_VertexGetZ (plane,n)
        
        x=x*2/30: y=y*2/30
        
        zufall.f = ((1-Sign(-x-0.9+Abs(y*2)))/3*(Sign(0.9-x)+1)/3)*(Sign(x+0.65)+1)/2 -((1-Sign(-x-0.39+Abs(y*2)))/3*(Sign(0.9-x)+1)/3) + ((1-Sign(-x-0.39+Abs(y*2)))/3*(Sign(0.6-x)+1)/3)*(Sign(x-0.35)+1)/2
        MP_VertexSetZ (plane,n, -zufall*40)
        
   Next 
   
   If MP_KeyDown(#PB_Key_Up)
     rotY+1
   ElseIf MP_KeyDown(#PB_Key_Down)
     rotY-1
   ElseIf MP_KeyDown(#PB_Key_Right)
     rotX+1
   ElseIf MP_KeyDown(#PB_Key_Left)
     rotX-1
   ElseIf MP_KeyDown(#PB_Key_Z )  
     camZ+1
   ElseIf MP_KeyDown(#PB_Key_X )    
     camZ-1
     
    
   EndIf 
   
    MP_RotateEntity(plane, rotX, rotY, rotZ )
    MP_PositionCamera(camera,camX,camY,camZ)
    MP_RenderWorld ()
    MP_Flip () ; 

Wend

End

Image

to experiment with more 3D functions look http://www.benjoffe.com/code/tools/functions3d/examples

i am still studying the MP3D since it is so huge, i just use a small part of it wich deals with vertices for plotting and deforming.
at last where are you Michael !! i hope you are okay.
regards

Re: textured animated 3D curves

Posted: Thu Jun 28, 2012 8:12 pm
by IceSoft
applePi wrote:at last where are you Michael !! i hope you are okay.
regards
He is on vacation for two weeks.

Re: MP3D Engine Alpha 30

Posted: Sat Jun 30, 2012 12:52 am
by Swos2009
I got a questions...

I have done well using first Intro Demo of using MP3D of putting two things together to make intro.

I have start to make my own Folder then went on Purebasic IDE and I make new Project then starting doing some MP3D Engine coding.... why does cause Error when say

Line 9: EP_InitFXLib() is not a function, Array, Marcro or linked list...

Do I have add library files in my own folder?

P.S. MP3D is Great Engine :mrgreen:

Re: MP3D Engine Alpha 30

Posted: Sat Jun 30, 2012 7:06 am
by gnasen
did you activate "dx9" subsystem?

Re: MP3D Engine Alpha 30

Posted: Sat Jun 30, 2012 9:26 am
by Swos2009
did you activate "dx9" subsystem?
How do I do that? :?