Page 23 of 71

Re: MP3D Engine Alpha 31

Posted: Tue Feb 26, 2013 7:11 am
by applePi
Hi,
regarding the knot i can't see any difference in speed between the two or any flicker even the green point size on the MP3D example are 20, i have old Nvidia Geforce 210 card with windows XP.
but on the prime numbers spiral example above there is a few flicker when rotating due to about 9594 of thick points in addition to the 90000 of normal points

PS: in comparison with Ogre look at the poor mashimaro saying at the end of this thread: http://www.ogre3d.org/forums/viewtopic.php?f=2&t=58057
(( Basically I'm just trying to plot hundreds of points in 3-D space with 'different' sizes )). but he fails to do that in Ogre.

Re: MP3D Engine Alpha 31

Posted: Tue Feb 26, 2013 8:54 am
by Psychophanta
mpz wrote:Hello Psychophanta,

nice speedcheck but you must check two same functions :wink: . I have changed the structure of the point mesh to make all point sizeabel. With an older lib the mp3d code works as fast as the DM code, but the point size is not sizeabel. In my opinion the DM_CreateLine has not sizeable points too. The question is: sizeable points or more speed without them or two different primitives one with and one without sizeabel points ?!?!

Possible solution, a flag for sizeable points: MP_CreatePrimitives (VertexCount, Modus[,Flag]) ; Flag = 1, Sizeable points...

or a new Modus for sizeable Points , MP_CreatePrimitives (VertexCount, Modus); Mode = 7 sizeable Points

Greetings Michael
Hallo,

The sizeable point should not "destroy" speed. Seriously: if i was you AND there is really not possible to perform point size without reduce speed, then (at least at teh moment) i would quit that feature.

applePi wrote:Hi,
regarding the knot i can't see any difference in speed between the two or any flicker even the green point size on the MP3D example are 20, i have old Nvidia Geforce 210 card with windows XP.
but on the prime numbers spiral example above there is a few flicker when rotating due to about 9594 of thick points in addition to the 90000 of normal points

PS: in comparison with Ogre look at the poor mashimaro saying at the end of this thread: http://www.ogre3d.org/forums/viewtopic.php?f=2&t=58057
(( Basically I'm just trying to plot hundreds of points in 3-D space with 'different' sizes )). but he fails to do that in Ogre.
Ogre never seems to me to be a serious engine, in opposition with i have heard sometimes here.
Not because PB, but because some facts of Ogre engine. Besides it not seems serious to me, it is not powerful, for example in speed respects.

Thanks!

Re: MP3D Engine Alpha 31

Posted: Tue Feb 26, 2013 3:04 pm
by mpz
Hi,

i have made some little updates:
46) new functions: MP_CameraSetPerspective(Cam, Grad.f [, Aspect.f]); for a orthographic camera Grad is the size of the view
47) new functions: MP_CreatePrimitives(VertexCount, Modus), Modus = 1 NOT sizeable Point Mode, Mode = 7 Sizeable Pointmode

Now you can change the Perspective of a normal camera and a Ortho View camera (was important for me)

on some graficcard it the sizeable point mode slower as the other code. So i haven made a new mode.
Please use MP_CreatePrimitives (2000000, 7) for sizeabel Points

download on my mp3d forum

P.S. with MP_CreatePrimitives (xxx, 7) you can use textures too and don't need points....

Here a better Ortho View demo

Code: Select all

MP_Graphics3D (640,240,0,3) ; Erstelle ein WindowsFenster mit 3D Funktion #Window = 0
SetWindowTitle(0, "2 Cameras Ortho View") ; Setzt einen Fensternamen

camera1=MP_CreateCamera() ; Kamera erstellen
camera2=MP_CreateCamera(0.22) ; Kamera erstellen (Orthoview)

light=MP_CreateLight(1) ; Es werde Licht

Mesh=MP_CreateCube() ; Und jetzt ein TeaPot

MP_PositionCamera(camera1,0,0,-3)
MP_PositionCamera(camera2,0,0,-3)

BackColor1 = RGB(0,0,123)
BackColor2 = RGB(0,66,123)

MP_CameraSetPerspective(camera1,45,1.33)
MP_CameraSetPerspective(camera2,0.22,1.33)


camera5 = MP_CameraViewPort (camera1,0,0,640/2,240,BackColor1)
camera6 = MP_CameraViewPort (camera2,640/2,0,640/2,240,BackColor2)

While Not MP_KeyDown(#PB_Key_Escape) And Not WindowEvent() = #PB_Event_CloseWindow; Esc abfrage oder Windows Schliessen

    MP_TurnEntity (Mesh,0.1,0.1,0.1) ; dreh den Würfel
    MP_RenderWorld () ; Hier gehts los
    MP_Flip ()   

Wend
Greetings Michael

Re: MP3D Engine Alpha 31

Posted: Tue Feb 26, 2013 3:30 pm
by Thade
mpz wrote: download on my mp3d forum
Hello Michael

Is it possible to put the link into your sig? So we do not always have to search for the url of that mp3d forum.
Btw: The only mp3d forum I found was updated in december 2012 last time ... is there another?

Thanks
RGR

Re: MP3D Engine Alpha 31

Posted: Tue Feb 26, 2013 4:29 pm
by applePi
@Michael , you have only updated the file in :
http://www.flasharts.de/mpz/x86/MP3D_Library (size 980)
but the file inside http://www.flasharts.de/mpz/x86/MP3D_Library.zip
are the old one (size 954 KB) _
i am going to test it. thanks

@Thade , the new library are here http://www.morty-productions.de/gamedev ... hp?tid=145
go down to the http://www.flasharts.de/mpz/x86/MP3D_Library
it is a file , replace the older file from the version 31 installation.

Re: MP3D Engine Alpha 31

Posted: Tue Feb 26, 2013 4:52 pm
by applePi
Hi Michael,
i can't run your new Library , it gives me the following error with any MP3D code
Image
and the purebasic hangs.
when i replace the newest library with the library from 24/Feb/2013 then it works again

Re: MP3D Engine Alpha 31

Posted: Tue Feb 26, 2013 5:42 pm
by mpz
Hello,

these are onla alpha files for testing of new functions, Sorry if something is not working, but it is working in progress. (to make greate mist...akes you need a computer)..

please try it again, i have copied the files again and tested them...

http://www.flasharts.de/mpz/x86/MP3D_Library

unpack this file if the first not work

http://www.flasharts.de/mpz/x86/MP3D_Library.zip

Greetings Michael

Re: MP3D Engine Alpha 31

Posted: Tue Feb 26, 2013 5:59 pm
by applePi
Hi Michael
thank you, now it works, i saw my thick knot displayed thick after changing to Entity= MP_CreatePrimitives (2000000, 7)
this is a wise idea.
regards

Re: MP3D Engine Alpha 31

Posted: Tue Feb 26, 2013 6:33 pm
by applePi
with MP_CreatePrimitives (xxx, 7) you can use textures too and don't need points....
Hi Michael
i want to use your new addition to use textures for points, but i got always the same color whatever the texture i use like this:
Image

i want to use this texture : Image
it is supposed to be png and have transparent surrounding what i make wrong

Code: Select all

Global xres=640, yres=480
MP_Graphics3D (xres,yres,0,3)
SetWindowTitle(0, "3D Knot, press space key to stop rotation,  press Z, X keys to zoom in/out")

camera=MP_CreateCamera()

light=MP_CreateLight(2)
MP_LightSetColor (light, RGB(255,255,255))

MP_PositionCamera(camera, 0, 5, 10)
MP_CameraLookAt(camera,0,0,0)

MP_PositionEntity(light, 0, 10, 20)
MP_EntityLookAt(light,0,0,0)

Global Entity= MP_CreatePrimitives (2000000, 7) 

  
Global.f x, y, z
Define.l red, green, blue

Quit.b = #False 

textur = MP_LoadTexture("circle.png", 1)

;==============================================================
red = 255: green = 255: blue = 255
pointSize.f=20
NumOfPoints = 3.14159*2 / 0.003 
    For PointNumber = 0 To NumOfPoints
              
              t.f+0.003
              x = Cos(t) + 1.5*Cos(-2*t)
              y = Sin(t) + 1.5*Sin(-2*t)
              ;z = 0.35 * Sin(3*t)
              z = 1 * Sin(3*t)
                   
              MP_SetPrimitives(Entity, PointNumber, x, y, z, textur ,pointSize)             
         
            Next 
            
MP_ScaleEntity(Entity, 1.5, 1.5, 1.5)

MP_PositionCamera(camera, 0, 0, 10)
MP_CameraLookAt(camera,0,0,0)
MP_PositionEntity(light, 0 , 0, 10)
MP_EntityLookAt(light,0,0,0)

xx.f=0 :zz.f=0 : turn.b = 0: rot.f=0.5
While Not MP_KeyDown(#PB_Key_Escape) And Not WindowEvent() = #PB_Event_CloseWindow
  
  If MP_KeyDown(#PB_Key_Z) 
    ;xx.f + 0.1
    zz.f + 0.1
  ElseIf MP_KeyDown(#PB_Key_X) 
    ;xx.f - 0.1
    zz.f - 0.1
  ElseIf MP_KeyHit(#PB_Key_Space)  
    If turn
       rot=0.5
     Else
       rot=0
    EndIf
    turn ! 1 
  EndIf 
      
    MP_PositionEntity(Entity, xx, 0, zz)
    MP_TurnEntity(Entity,0,rot,0) 
   
  MP_RenderWorld()
   
  MP_Flip ()

Wend

Re: MP3D Engine Alpha 31

Posted: Tue Feb 26, 2013 11:32 pm
by mpz
Hello applePi,

some litte mistakes:

to use a texture on a point primitives you use

;45) new functions: MP_EntitySetTexture (Entity, Texture[, Position[, Material]]) , works now Primitives too, funktioniert jetzt auch mit Primitives
MP_EntitySetTexture(Entity,textur)

not every point has a own texture. The primitives has one texture for all points..

the following command is used like the point funktion, but the pointsize = 1 means the textur will shown with full point size = 62x62 on screen so i use pointSize/1000 is little enough

MP_SetPrimitives(Entity, PointNumber, x, y, z, MP_ARGB(0,red,green,blue) ,pointSize/1000)

You can use it like a billboard now

and dont forgett the
MP_PrimitivesBlendingMode (Entity, Source, Destination )

for the Blend mode.

You see i pushed up the primitives :lol:
I hope this helps...

Greetings Michael

Re: MP3D Engine Alpha 31

Posted: Wed Feb 27, 2013 7:35 am
by applePi
Hi Michael
you have pushed plotting facilities of your engine to the extreme, from dynamically normal points to thick point and then textured points, treated as a whole one collection.
i have tried your advise, but i may not applied it correctly:
i can see the points textured correctly when we zoom to it, but i have ambiquity regarding the blending source and destination, my source is a blue or white circle bounded by transparent boundary
Circle_Blue....
Circle_White....
i have used MP_PrimitivesBlendingMode (Entity, 5, 3 ) , i see that the circle boundary are transparent but still the blue have semi transparency. any advice here ??.
when i choose :
NumOfPoints = 3.14159*2 / 0.003
For PointNumber = 0 To NumOfPoints

t.f+0.003

instead of :
NumOfPoints = 3.14159*2 / 0.05
For PointNumber = 0 To NumOfPoints

t.f+0.05


i see a perfect tube, that is very great, but the color are moving through the tube, possibly depends on the GPU card and due to the huge task over the GPU in calculating 2094 textured big points at the same time.
big thanks Michael, i hope the educational, schools, labs, etc be aware of the plotting facilities of this Libary together with PureBasic in math and art.
Image

Code: Select all

Global xres=640, yres=480
MP_Graphics3D (xres,yres,0,3)
SetWindowTitle(0, "3D Knot, press space key to stop rotation,  press Z, X keys to zoom in/out")
; Background
If CreateImage(0, 256, 256,32)
  ;MP_CreateImageColored(0, 0, #Yellow,#Yellow,#Red,#Green)     
  MP_CreateImageColored(0, 0, #Yellow,#White,#Red,#Green)     
  Surface = MP_ImageToSurface(0) 
  FreeImage(0)
  MP_SurfaceSetPosition(Surface,0,0,1)
  MP_SurfaceDestRect(Surface,0, 0, xres, yres)
EndIf

camera=MP_CreateCamera()

light=MP_CreateLight(2)
MP_LightSetColor (light, RGB(255,255,255))

MP_PositionCamera(camera, 0, 5, 10)
MP_CameraLookAt(camera,0,0,0)

MP_PositionEntity(light, 0, 10, 20)
MP_EntityLookAt(light,0,0,0)

Global Entity= MP_CreatePrimitives (1000000, 7) 

  
Global.f x, y, z
Define.l red, green, blue

Quit.b = #False 

textur = MP_LoadTexture("circle.png", 1)

;==============================================================
red = 255: green = 255: blue = 255
pointSize.f=1
NumOfPoints = 3.14159*2 / 0.05
    For PointNumber = 0 To NumOfPoints
              
              t.f+0.05
              x = Cos(t) + 1.5*Cos(-2*t)
              y = Sin(t) + 1.5*Sin(-2*t)
              ;z = 0.35 * Sin(3*t)
              z = 1 * Sin(3*t)
                   
              ;MP_SetPrimitives(Entity, PointNumber, x, y, z, textur ,0.001)             
              MP_SetPrimitives(Entity, PointNumber, x, y, z, MP_ARGB(0,255,255,255), 0.04 )
              
            Next 
            MP_EntitySetTexture(Entity,textur)
            MP_PrimitivesBlendingMode (Entity, 5, 3 )
            
MP_ScaleEntity(Entity, 1.5, 1.5, 1.5)

MP_PositionCamera(camera, 0, 0, 10)
MP_CameraLookAt(camera,0,0,0)
MP_PositionEntity(light, 0 , 0, 10)
MP_EntityLookAt(light,0,0,0)

xx.f=0 :zz.f=0 : turn.b = 0: rot.f=0.5
While Not MP_KeyDown(#PB_Key_Escape) And Not WindowEvent() = #PB_Event_CloseWindow
  
  If MP_KeyDown(#PB_Key_Z) 
    ;xx.f + 0.1
    zz.f + 0.1
  ElseIf MP_KeyDown(#PB_Key_X) 
    ;xx.f - 0.1
    zz.f - 0.1
  ElseIf MP_KeyHit(#PB_Key_Space)  
    If turn
       rot=0.5
     Else
       rot=0
    EndIf
    turn ! 1 
  EndIf 
      
    MP_PositionEntity(Entity, xx, 0, zz)
    MP_TurnEntity(Entity,0,rot,0) 
   
  MP_RenderWorld()
   
  MP_Flip ()

Wend

Re: MP3D Engine Alpha 31

Posted: Sat Mar 02, 2013 10:25 pm
by mpz
Hi applePi,

i have mad a new command with name
MP_EntitySetZEnable (Entity,Bool) ;
Please test the function (you find it in the mp3d forum)

;Please add it in line 62 of you last code
MP_EntitySetZEnable (Entity,0)

Now you have no overlapping if you use textures. I will test this function with other entitys too. I will check it if it make sence for mesh etc. too...

Greetings Michael

Re: MP3D Engine Alpha 31

Posted: Sun Mar 03, 2013 6:59 am
by applePi
Hi Michael
when we use your new function with Bool 0 MP_EntitySetZEnable (Entity,0), we get a false knot ie not correct and deceiving. and when we use it with Bool 1 MP_EntitySetZEnable (Entity,1) the knot are correct but with a problem may be related to alpha adjustments. it will be displayed as
Image
this is the same picture i have exactly when using PB Ogre in my example here http://www.purebasic.fr/english/viewtop ... 36&t=53758
but when i have changed the material file in the PB Ogre example to contain this line alpha_rejection greater 200
together with scene_blend alpha_blend
then the knot displayed correctly but there is still the problem of the colors moving randomly along the the tubes of the knot, so in the knot MP3D version it needs a tiny correction to make it works.
here the new png texture to use with the code, it has a transparent borders
Image
PS:: the texture have originaly a continuous color but on the points here it is reduced to 4 separated color (not continuous as in the color_ wheel.png above)

Code: Select all

Global xres=640, yres=480
MP_Graphics3D (xres,yres,0,3)
SetWindowTitle(0, "3D Knot, press space key to stop rotation,  press Z, X keys to zoom in/out")
; Background
If CreateImage(0, 256, 256,32)
  ;MP_CreateImageColored(0, 0, #Yellow,#Yellow,#Red,#Green)     
  MP_CreateImageColored(0, 0, #Yellow,#White,#Red,#Green)     
  Surface = MP_ImageToSurface(0) 
  FreeImage(0)
  MP_SurfaceSetPosition(Surface,0,0,1)
  MP_SurfaceDestRect(Surface,0, 0, xres, yres)
EndIf


camera=MP_CreateCamera()

light=MP_CreateLight(2)
MP_LightSetColor (light, RGB(255,255,255))

MP_PositionCamera(camera, 0, 5, 10)
MP_CameraLookAt(camera,0,0,0)

MP_PositionEntity(light, 0, 10, 20)
MP_EntityLookAt(light,0,0,0)

Global Entity= MP_CreatePrimitives (1000000, 7) 

  
Global.f x, y, z
Define.l red, green, blue

Quit.b = #False 

textur = MP_LoadTexture("color_wheel.png", 1)

;==============================================================
red = 255: green = 255: blue = 255
pointSize.f=1
NumOfPoints = 3.14159*2 / 0.003
    For PointNumber = 0 To NumOfPoints
              
              t.f+0.003
              x = Cos(t) + 1.5*Cos(-2*t)
              y = Sin(t) + 1.5*Sin(-2*t)
              ;z = 0.35 * Sin(3*t)
              z = 1 * Sin(3*t)
                   
              ;MP_SetPrimitives(Entity, PointNumber, x, y, z, textur ,0.001)             
              MP_SetPrimitives(Entity, PointNumber, x, y, z, MP_ARGB(0,255,255,255), 0.05 )
              
            Next 
            MP_EntitySetTexture(Entity,textur)
            MP_PrimitivesBlendingMode (Entity, 5, 3 )
            
MP_ScaleEntity(Entity, 1.5, 1.5, 1.5)

MP_PositionCamera(camera, 0, 0, 10)
MP_CameraLookAt(camera,0,0,0)
MP_PositionEntity(light, 0 , 0, 10)
MP_EntityLookAt(light,0,0,0)
MP_EntitySetZEnable (Entity,1)

xx.f=0 :zz.f=0 : turn.b = 0: rot.f=0.5
While Not MP_KeyDown(#PB_Key_Escape) And Not WindowEvent() = #PB_Event_CloseWindow
  
  If MP_KeyDown(#PB_Key_Z) 
    ;xx.f + 0.1
    zz.f + 0.1
  ElseIf MP_KeyDown(#PB_Key_X) 
    ;xx.f - 0.1
    zz.f - 0.1
  ElseIf MP_KeyHit(#PB_Key_Space)  
    If turn
       rot=0.5
     Else
       rot=0
    EndIf
    turn ! 1 
  EndIf 
      
    MP_PositionEntity(Entity, xx, 0, zz)
    MP_TurnEntity(Entity,0,rot,0) 
   
  MP_RenderWorld()
   
  MP_Flip ()

Wend

Re: MP3D Engine Alpha 31

Posted: Sun Mar 03, 2013 10:29 pm
by mpz
Hi applePi,

i know what you want, but for now i have no solution.

The problem is:
If you use alphablend you must sort the object. If not happens what you see, the alphacolor is overlapping the normal color

http://www.toymaker.info/Games/html/render_states.html
Note: in order to get correct blending you often have to sort your transparent objects before rendering.

This means you must sort the points from the distance to the camera and then you can print this on the screen. I will have a look on it to solve this for PointMeshs, but it is not easy...
i have solved this for Meshs with the sort command MP_MeshAlphaSort(). We need this for pointsmeshs with textures too, but the solution is not fast....

Greetings Michael

Re: MP3D Engine Alpha 31

Posted: Sat Mar 09, 2013 12:16 pm
by AndyLy
Hi Michael Mpz,
You can change the command MP_ScrollTexture() so that it works with values of type Float ? Because with the integer, it works too fast.
Also, you can see that the texture is scrolled only at very close range. Can this somehow change / adjust?
I found that scrolling can be seen always, if you load a texture with MipLevels=1, but it is not a very good decision.