Sun demo

Everything related to 3D programming
applePi
Addict
Addict
Posts: 1404
Joined: Sun Jun 25, 2006 7:28 pm

Sun demo

Post 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

   
    
User avatar
Bananenfreak
Enthusiast
Enthusiast
Posts: 519
Joined: Mon Apr 15, 2013 12:22 pm

Re: Sun demo

Post by Bananenfreak »

Nice Thing man :)

Sun Looks fantastic.
Image
User avatar
DK_PETER
Addict
Addict
Posts: 904
Joined: Sat Feb 19, 2011 10:06 am
Location: Denmark
Contact:

Re: Sun demo

Post by DK_PETER »

Thanks ApplePi.

Looks really good. :-)

Add this at line 38:
RotateMaterial(#particle_mat,0.1,#PB_Material_Animated)
Current configurations:
Ubuntu 20.04/64 bit - Window 10 64 bit
Intel 6800K, GeForce Gtx 1060, 32 gb ram.
Amd Ryzen 9 5950X, GeForce 3070, 128 gb ram.
applePi
Addict
Addict
Posts: 1404
Joined: Sun Jun 25, 2006 7:28 pm

Re: Sun demo

Post by applePi »

thanks DK_PETER
with the animation it looks like a solar eruption
User avatar
DK_PETER
Addict
Addict
Posts: 904
Joined: Sat Feb 19, 2011 10:06 am
Location: Denmark
Contact:

Re: Sun demo

Post 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.
Last edited by DK_PETER on Sun Aug 10, 2014 5:35 am, edited 2 times in total.
Current configurations:
Ubuntu 20.04/64 bit - Window 10 64 bit
Intel 6800K, GeForce Gtx 1060, 32 gb ram.
Amd Ryzen 9 5950X, GeForce 3070, 128 gb ram.
User avatar
Bananenfreak
Enthusiast
Enthusiast
Posts: 519
Joined: Mon Apr 15, 2013 12:22 pm

Re: Sun demo

Post by Bananenfreak »

Looks like the exploding Deathstar :D
Image
User avatar
DK_PETER
Addict
Addict
Posts: 904
Joined: Sat Feb 19, 2011 10:06 am
Location: Denmark
Contact:

Re: Sun demo

Post by DK_PETER »

Bananenfreak wrote:Looks like the exploding Deathstar :D
You're right! :lol:
Current configurations:
Ubuntu 20.04/64 bit - Window 10 64 bit
Intel 6800K, GeForce Gtx 1060, 32 gb ram.
Amd Ryzen 9 5950X, GeForce 3070, 128 gb ram.
davido
Addict
Addict
Posts: 1890
Joined: Fri Nov 09, 2012 11:04 pm
Location: Uttoxeter, UK

Re: Sun demo

Post 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)
DE AA EB
Olby
Enthusiast
Enthusiast
Posts: 461
Joined: Mon Jan 12, 2009 10:33 am
Contact:

Re: Sun demo

Post 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.
Intel Core i7 Quad 2.3 Ghz, 8GB RAM, GeForce GT 630M 2GB, Windows 10 (x64)
applePi
Addict
Addict
Posts: 1404
Joined: Sun Jun 25, 2006 7:28 pm

Re: Sun demo

Post 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
Olby
Enthusiast
Enthusiast
Posts: 461
Joined: Mon Jan 12, 2009 10:33 am
Contact:

Re: Sun demo

Post 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.
Intel Core i7 Quad 2.3 Ghz, 8GB RAM, GeForce GT 630M 2GB, Windows 10 (x64)
applePi
Addict
Addict
Posts: 1404
Joined: Sun Jun 25, 2006 7:28 pm

Re: Sun demo

Post 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.
Olby
Enthusiast
Enthusiast
Posts: 461
Joined: Mon Jan 12, 2009 10:33 am
Contact:

Re: Sun demo

Post by Olby »

That looks good enough, should give it a spin.
Intel Core i7 Quad 2.3 Ghz, 8GB RAM, GeForce GT 630M 2GB, Windows 10 (x64)
davido
Addict
Addict
Posts: 1890
Joined: Fri Nov 09, 2012 11:04 pm
Location: Uttoxeter, UK

Re: Sun demo

Post 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
DE AA EB
User avatar
DK_PETER
Addict
Addict
Posts: 904
Joined: Sat Feb 19, 2011 10:06 am
Location: Denmark
Contact:

Re: Sun demo

Post 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
Current configurations:
Ubuntu 20.04/64 bit - Window 10 64 bit
Intel 6800K, GeForce Gtx 1060, 32 gb ram.
Amd Ryzen 9 5950X, GeForce 3070, 128 gb ram.
Post Reply