Page 1 of 2

Sun demo

Posted: Thu Aug 08, 2013 7:41 am
by applePi
there is a sun demo using billboard in example StaticGeometry.pb
but this is a sun particles demo, or a giant red star, show the storms inside the sun,
Image
the script from http://www.ogre3d.org/tikiwiki/tiki-ind ... ExampleSun
but change it a little, copy it to a file like sun.particle

Code: Select all

particle_system Space/Sun
 {
    material        Examples/Flare
    particle_width  10
    particle_height 10
    cull_each       false
    quota           100
    billboard_type  point
 
    // Area emitter
    emitter Ellipsoid
    {
        angle           30
        emission_rate   30
        time_to_live_min 2
        time_to_live_max 10
        direction       0 1 0
        velocity       0.001
        colour 0.15 0.1 0.0
        width           5
        height          5
        depth           5
    }
 
    // Fader
    affector ColourFader
    {
        red -0.010
        green -0.025
        blue -0.025
    }
 }

Code: Select all

Enumeration
   #CAMERA
   #mainwin
   #particle
   #particle_mat
EndEnumeration
Global ss.f
ExamineDesktops()
OpenWindow(#mainwin, 0, 0, DesktopWidth(0), DesktopHeight(0), "particles _ sun", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
;Initialize environment
InitEngine3D()
InitSprite()
InitKeyboard()
OpenWindowedScreen(WindowID(#mainwin), 0, 0, DesktopWidth(0), DesktopHeight(0)-5, 0, 0, 0)

SetFrameRate(60)

Add3DArchive(".", #PB_3DArchive_FileSystem)
Add3DArchive(#PB_Compiler_Home + "Examples/3D/Data/Textures", #PB_3DArchive_FileSystem)
Add3DArchive(#PB_Compiler_Home + "Examples/3D/Data/Packs/skybox.zip", #PB_3DArchive_Zip)
Parse3DScripts()

;SkyDome("clouds.jpg", 80) 
;SkyBox("stevecube.jpg")

CreateLight(0,RGB(255,255,255),0,40,10)
AmbientColor(RGB(100,100,100))

CreateCamera(#CAMERA, 0, 0, 400, 400)
MoveCamera(#CAMERA, 0, 4, 9)
CameraLookAt(#CAMERA, 0, 2, 0)

LoadTexture(#particle_mat, "flare.png")
CreateMaterial(#particle_mat, TextureID(#particle_mat))
DisableMaterialLighting(#particle_mat, 1)
MaterialBlendingMode(#particle_mat, #PB_Material_Add)
	
GetScriptParticleEmitter(#particle, "Space/Sun")
MoveParticleEmitter(#particle, 1,0.3,-10)
ParticleMaterial(#particle, MaterialID(#particle_mat))

;Main loop
Repeat
  Event = WindowEvent()
     
   TimeSinceLastFrame = RenderWorld()
   
  FlipBuffers()

  ExamineKeyboard()
  If KeyboardReleased(#PB_Key_Z)
    ParticleColorRange(#particle, RGB(0,22,222), RGB(0,0,255))

  EndIf
   
    
Until KeyboardReleased(#PB_Key_Escape) Or Event = #PB_Event_CloseWindow

   
    

Re: Sun demo

Posted: Thu Aug 08, 2013 8:24 am
by Bananenfreak
Nice Thing man :)

Sun Looks fantastic.

Re: Sun demo

Posted: Thu Aug 08, 2013 8:36 am
by DK_PETER
Thanks ApplePi.

Looks really good. :-)

Add this at line 38:
RotateMaterial(#particle_mat,0.1,#PB_Material_Animated)

Re: Sun demo

Posted: Thu Aug 08, 2013 9:54 am
by applePi
thanks DK_PETER
with the animation it looks like a solar eruption

Re: Sun demo

Posted: Thu Aug 08, 2013 1:34 pm
by DK_PETER
applePi wrote: with the animation it looks like a solar eruption
Yeah..It's a nice effect. :-)

Your example made me try to do a sun example myself. Mind you..I'm extremely new at this. :lol:


Here's the complete rar file:Edit [removed]

Best regards
Peter.

Re: Sun demo

Posted: Thu Aug 08, 2013 2:59 pm
by Bananenfreak
Looks like the exploding Deathstar :D

Re: Sun demo

Posted: Thu Aug 08, 2013 3:05 pm
by DK_PETER
Bananenfreak wrote:Looks like the exploding Deathstar :D
You're right! :lol:

Re: Sun demo

Posted: Thu Aug 08, 2013 3:09 pm
by davido
Hi Guys,

Please help. I've never done any 3d stuff, and this looks great. :oops:

I cannot get it working.
Exactly where do I place the sun.particle file. (Careful how you answer that, please)

Re: Sun demo

Posted: Thu Aug 08, 2013 4:24 pm
by Olby
davido wrote:Hi Guys,

Please help. I've never done any 3d stuff, and this looks great. :oops:

I cannot get it working.
Exactly where do I place the sun.particle file. (Careful how you answer that, please)
Save it in your "PureBasic\Examples\3D\Data\Textures" folder as "sun.particle". And run the code in the first post.

[Edit]

As you can see here:

Code: Select all

Add3DArchive(#PB_Compiler_Home + "Examples/3D/Data/Textures", #PB_3DArchive_FileSystem)
Add3DArchive(#PB_Compiler_Home + "Examples/3D/Data/Packs/skybox.zip", #PB_3DArchive_Zip)
Engine3D will have access to Data\Textures folder and Data\Packs\skybox.zip archive. Anything else inaccessible.

Re: Sun demo

Posted: Thu Aug 08, 2013 5:37 pm
by applePi
DK_PETER your example are realy fantastic, i have found that there are 2 particle editors for Ogre which i have not tried yet, i hope it will enable us to experiment with particle scripts before using it in purebasic.
1- OGRE Particle Editor
http://sourceforge.net/projects/ogre/fi ... ols/1.2.0/
http://www.game-cat.com/ogre/pe/ParticleEditor_Beta.zip
http://www.game-cat.com/ogre/pe/docs/ description and tutorial
2- Ogre Particle Lab
http://www.ogre3d.org/tikiwiki/Ogre+Particle+Lab
i have downloaded it from a torrent, there was one person seeding the file
@davido: in addition to olby reply, if you add

Code: Select all

Add3DArchive(".", #PB_3DArchive_FileSystem)
then you can put the particle file in the same folder as the code file

Re: Sun demo

Posted: Thu Aug 08, 2013 5:40 pm
by Olby
applePi wrote:DK_PETER your example are realy fantastic, i have found that there are 2 particle editors for Ogre which i have not tried yet, i hope it will enable us to experiment with particle scripts before using it in purebasic.
1- OGRE Particle Editor
http://sourceforge.net/projects/ogre/fi ... ols/1.2.0/
http://www.game-cat.com/ogre/pe/ParticleEditor_Beta.zip
http://www.game-cat.com/ogre/pe/docs/ description and tutorial
2- Ogre Particle Lab
http://www.ogre3d.org/tikiwiki/Ogre+Particle+Lab
i have downloaded it from a torrent, there was one person seeding the file
@davido: in addition to olby reply, if you add

Code: Select all

Add3DArchive(".", #PB_3DArchive_FileSystem)
then you can put the particle file in the same folder as the code file
applePi, have you found any usable Ogre Material script editors by any chance? I need something like FX Composer where changes are immediately compiled and rendered.

Re: Sun demo

Posted: Thu Aug 08, 2013 6:13 pm
by applePi
there is a material editor here: http://www.purebasic.fr/english/viewtop ... ial+editor , read the limitation there, also there are several versions go down the page
it is too slow on my slow machine, i can't even rotate the teapot by mouse easily. so i can't test, hope it will work for you it seems good utility.
i remember reading something like your quest, i remember the answer was negative, but it may be the answer was wrong.

Re: Sun demo

Posted: Thu Aug 08, 2013 6:17 pm
by Olby
That looks good enough, should give it a spin.

Re: Sun demo

Posted: Thu Aug 08, 2013 6:55 pm
by davido
Hi Olby,

Thank you very much for taking the time to help me out. :D

I had put it in the directory with other .particle files.

Looks really great - Thanks applePi

Re: Sun demo

Posted: Fri Aug 09, 2013 12:35 pm
by DK_PETER
applePi wrote:DK_PETER your example are realy fantastic, i have found that there are 2 particle editors for Ogre which i have not tried yet, i hope it will enable us to experiment with particle scripts before using it in purebasic.
1- OGRE Particle Editor
http://sourceforge.net/projects/ogre/fi ... ols/1.2.0/
http://www.game-cat.com/ogre/pe/ParticleEditor_Beta.zip
http://www.game-cat.com/ogre/pe/docs/ description and tutorial
2- Ogre Particle Lab
http://www.ogre3d.org/tikiwiki/Ogre+Particle+Lab
i have downloaded it from a torrent, there was one person seeding the file
:lol: Thanks for the 'thumbs up' ApplePI. I know the example is at best: mediocre.
I think it's time to dive into real 3D from now on. I'm completely bored out of my skull doing windows applications.
Appreciate the links. I've downloaded them and will try'em out for sure.

Best regards
Peter