Compositor example

Everything related to 3D programming
User avatar
Comtois
Addict
Addict
Posts: 1431
Joined: Tue Aug 19, 2003 11:36 am
Location: Doubs - France

Compositor example

Post by Comtois »

Here is an example with a dozen of Compositors from Ogre SDK which work well on my pc.

List of available Compositors in Example :

Code: Select all

    ;CreateCompositorEffect(0, 0, "Old Movie")
    ;CreateCompositorEffect(0, 0, "Old TV")
    ;CreateCompositorEffect(0, 0, "B&W")
    ;CreateCompositorEffect(0, 0, "Glass")
    ;CreateCompositorEffect(0, 0, "Sharpen Edges")
    ;CreateCompositorEffect(0, 0, "Posterize")
    ;CreateCompositorEffect(0, 0, "ASCII")
    ;CreateCompositorEffect(0, 0, "Embossed")   
    ;CreateCompositorEffect(0, 0, "Tiling")  
    CreateCompositorEffect(0, 0, "Night Vision")  
http://ftp-developpez.com/comtois/fichi ... ositor.zip
Please correct my english
http://purebasic.developpez.com/
Fred
Administrator
Administrator
Posts: 18171
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Compositor example

Post by Fred »

Works perfectly here as well.
User avatar
idle
Always Here
Always Here
Posts: 5876
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: Compositor example

Post by idle »

It doesn't appear to work on my ubuntu 12.04 x64

crashes with invalid memory access at CreateCompositorEffect

log suggests it was all good

Code: Select all

13:41:59: Particle Renderer Type 'billboard' registered
13:41:59: Added resource location '././textures' of type 'FileSystem' to resource group 'General'
13:41:59: Added resource location '././programs' of type 'FileSystem' to resource group 'General'
13:41:59: Added resource location '././models' of type 'FileSystem' to resource group 'General'
13:41:59: Added resource location '././packs/skybox.zip' of type 'Zip' to resource group 'General'
13:41:59: Added resource location '././scripts' of type 'FileSystem' to resource group 'General'
13:41:59: Parsing scripts for resource group Autodetect
13:41:59: Finished parsing scripts for resource group Autodetect
13:41:59: Creating resources for group Autodetect
13:41:59: All done
13:41:59: Parsing scripts for resource group General
13:41:59: Parsing script StdQuad_vp.program
13:41:59: Parsing script Posterize.material
13:41:59: Parsing script Glass.material
13:41:59: Parsing script SharpenEdges.material
13:41:59: Parsing script BlackAndWhite.material
13:41:59: Parsing script Tiling.material
13:41:59: Parsing script ASCII.material
13:41:59: Parsing script OldTV.material
13:41:59: Parsing script Embossed.material
13:41:59: Parsing script Examples.material
13:41:59: Parsing script OldMovie.material
13:41:59: Parsing script NightVision.material
13:41:59: Finished parsing scripts for resource group General
13:41:59: Creating resources for group General
13:41:59: All done
13:41:59: Parsing scripts for resource group Internal
13:41:59: Finished parsing scripts for resource group Internal
13:41:59: Creating resources for group Internal
13:41:59: All done
Windows 11, Manjaro, Raspberry Pi OS
Image
User avatar
Samuel
Enthusiast
Enthusiast
Posts: 755
Joined: Sun Jul 29, 2012 10:33 pm
Location: United States

Re: Compositor example

Post by Samuel »

Works fine on my windows 7 x64. Those effects look really nice. I especially like the old movie one.
applePi
Addict
Addict
Posts: 1404
Joined: Sun Jun 25, 2006 7:28 pm

Re: Compositor example

Post by applePi »

at first it does not run on my windows xp with a message "The 3D Engine can't be initialized" , then i have remembered the post by LuCiFeR[SD] here http://www.purebasic.fr/english/viewtop ... 76#p407686 , so after installing The Nvidia Cg Toolkit the examples works great. thanks
User avatar
Comtois
Addict
Addict
Posts: 1431
Joined: Tue Aug 19, 2003 11:36 am
Location: Doubs - France

Re: Compositor example

Post by Comtois »

Code updated for 5.11 beta 3.

Code: Select all

;
; ------------------------------------------------------------
;
;   PureBasic - Compositor
;
;    (c) 2013 - Fantaisie Software
;
; ------------------------------------------------------------
;

#CameraSpeed = 2

IncludeFile "Screen3DRequester.pb"

Define.f KeyX, KeyY, MouseX, MouseY

If InitEngine3D(#PB_Engine3D_EnableCG)
  
  InitSprite()
  InitKeyboard()
  InitMouse()
  
  If Screen3DRequester()
    Add3DArchive("textures", #PB_3DArchive_FileSystem)    
    Add3DArchive("programs", #PB_3DArchive_FileSystem)
    Add3DArchive("models", #PB_3DArchive_FileSystem)
    Add3DArchive("packs/skybox.zip", #PB_3DArchive_Zip)
    Add3DArchive("scripts", #PB_3DArchive_FileSystem)
    Parse3DScripts()
    
    ; First create materials
    ;
    
    CreateMaterial(0, LoadTexture(0,"grass1.png"))
    MaterialBlendingMode(0, #PB_Material_AlphaBlend)
    CreateMaterial(1, LoadTexture(1,"Dirt.jpg"))
    
    
    ; Then create the billboard group and use the previous material
    ;
    ;-Billboard
    
    CreateBillboardGroup(0, MaterialID(0), 96, 96)
    For i = 0 To 600
      AddBillboard(#PB_Any, 0, Random(2000)-1000, Random(18) + 30, Random(2000) - 1000)
    Next i
    
    ; create ground
    
    CreatePlane(0, 2000, 2000, 40, 40, 4, 4)
    CreateEntity(0, MeshID(0), MaterialID(1))
    
    ; Add house
    LoadMesh(1, "tudorhouse.mesh")
    LoadMesh(2, "tudorhouse.mesh")
    CreateEntity(1, MeshID(1), #PB_Material_None, 0, 280, 0)
    ScaleEntity(1, 0.5, 0.5, 0.5)
    
    LoadMesh(3, "robot.mesh")
    
    CreateEntity(3, MeshID(3), #PB_Material_None, 0, 0, 300)
    StartEntityAnimation(3, "Walk")
    ScaleEntity(3, 2, 2, 2)
    
    RotateEntity(3, 0, -70, 0)
    
    ; SkyBox
    SkyBox("stevecube.jpg")
    
    ; create camera
    CreateCamera(0, 0, 0, 100, 100)
    MoveCamera(0, 200, 400, 900, #PB_Absolute)
    CameraLookAt(0, 0, 100, 0)
    
    
    CreateCompositorEffect(0, CameraID(0), "Old Movie")
    ;CreateCompositorEffect(0, CameraID(0), "Old TV")
    ;CreateCompositorEffect(0, CameraID(0), "B&W")
    ;CreateCompositorEffect(0, CameraID(0), "Glass")
    ;CreateCompositorEffect(0, CameraID(0), "Sharpen Edges")
    ;CreateCompositorEffect(0, CameraID(0), "Posterize")
    ;CreateCompositorEffect(0, CameraID(0), "ASCII")
    ;CreateCompositorEffect(0, CameraID(0), "Embossed")   
    ;CreateCompositorEffect(0, CameraID(0), "Tiling")  
    ;CreateCompositorEffect(0, CameraID(0), "Night Vision")  
    
    Repeat
      Screen3DEvents()
      
      If ExamineMouse()
        MouseX = -MouseDeltaX() * #CameraSpeed * 0.05
        MouseY = -MouseDeltaY() * #CameraSpeed * 0.05
      EndIf
      
      If ExamineKeyboard()
        
        If KeyboardPushed(#PB_Key_Left)
          KeyX = -#CameraSpeed 
        ElseIf KeyboardPushed(#PB_Key_Right)
          KeyX = #CameraSpeed 
        Else
          KeyX = 0
        EndIf
        
        If KeyboardPushed(#PB_Key_Up)
          KeyY = -#CameraSpeed 
        ElseIf KeyboardPushed(#PB_Key_Down)
          KeyY = #CameraSpeed 
        Else
          KeyY = 0
        EndIf
        
      EndIf
      
      RotateCamera(0, MouseY, MouseX, 0, #PB_Relative)
      MoveCamera  (0, KeyX, 0, KeyY)
      
      RenderWorld()
      Screen3DStats()
      FlipBuffers()
    Until KeyboardPushed(#PB_Key_Escape) Or Quit = 1
  EndIf
  
Else
  MessageRequester("Error", "The 3D Engine can't be initialized",0)
EndIf

End
Please correct my english
http://purebasic.developpez.com/
User avatar
idle
Always Here
Always Here
Posts: 5876
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: Compositor example

Post by idle »

still gets an IMA with CreateCompositorEffect(0, CameraID(0), "Old Movie")
on ubuntu 12.04 x64
Windows 11, Manjaro, Raspberry Pi OS
Image
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: Compositor example

Post by IdeasVacuum »

Does this require a DirectX environment or can it also be used with OpenGL?
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
LuCiFeR[SD]
666
666
Posts: 1033
Joined: Mon Sep 01, 2003 2:33 pm

Re: Compositor example

Post by LuCiFeR[SD] »

works fine with the opengl subsystem for me in windows anyway, not tested elsewhere
Post Reply