hello everyone !
i am studying PB 2D engine ( Game ), and an intriguing question arose, can I do something similar to this in PB with the 2d support library?
The project in question was done on the 2D engine called Unity Engine https://xform.artstation.com/projects/gJZbOP and consists of "generating" sidereal stars automatically...
Does anyone have a similar example or have any idea how to do it in PB?
how can i generate 2d object with particles ?
- skinkairewalker
- Enthusiast
- Posts: 635
- Joined: Fri Dec 04, 2015 9:26 pm
Re: how can i generate 2d object with particles ?
It would be just sprites and or pixels that get blended together in this case with additive blending.
Draw the sun and the surface layers (animate them) then create particles (sprites) for the burts and blend everything together.
If you want an object to facilitate all of that check out one of the oop threads.
Draw the sun and the surface layers (animate them) then create particles (sprites) for the burts and blend everything together.
If you want an object to facilitate all of that check out one of the oop threads.
Last edited by Mijikai on Thu Apr 22, 2021 10:57 pm, edited 1 time in total.
Re: how can i generate 2d object with particles ?
Here is a super simple sun rendered with just 3 sprites:
If these sprites are rotated against each other the sun surface looks already pretty nice and alive.
The more work is put into the animation and sprites the more realistic the sun will look.
But even with just 3 sprites it looks already fairly good, so it all depends on what look you want to achive.
Have fun
If these sprites are rotated against each other the sun surface looks already pretty nice and alive.
The more work is put into the animation and sprites the more realistic the sun will look.
But even with just 3 sprites it looks already fairly good, so it all depends on what look you want to achive.
Have fun
- skinkairewalker
- Enthusiast
- Posts: 635
- Joined: Fri Dec 04, 2015 9:26 pm
Re: how can i generate 2d object with particles ?
can u send me this example ? xD
Re: how can i generate 2d object with particles ?
How i did it.
Source:
Download Engine:
viewtopic.php?p=563734#p563734
Download Sprites:
https://www.dropbox.com/s/w0rdp67joc6ml ... s.zip?dl=0
Put all files in the same Directory.
Hope this helps even thought i used my own gfx lib.
This ofc. can also be easily done with the PB 2d lib.
Source:
Code: Select all
EnableExplicit
XIncludeFile "nautilus.pbi"
Macro RenderSun(_x_,_y_,_size_)
*engine\RenderBegin()
*sun_light\BlendMod (_x_,_y_,_size_ * 1.6,_size_ * 1.6,#True,$FFFFFF,rotate + 45)
*sun_light\BlendMod (_x_,_y_,_size_ * 1.8,_size_ * 1.8,#True,$FFFF33,-rotate)
*sun_core_1\BlendMod(_x_,_y_,_size_,_size_,#True,$BBBB88,-rotate)
*sun_core_1\BlendMod(_x_,_y_,_size_,_size_,#True,$FFFF88,-rotate / 2)
*sun_core_1\BlendMod(_x_,_y_,_size_,_size_,#True,$FFFF88,rotate)
*sun_core_2\BlendMod(_x_,_y_,_size_,_size_,#True,$BBBB88,rotate / 2)
*sun_core_2\BlendMod(_x_,_y_,_size_,_size_,#True,$888866,-rotate)
*engine\DrawText(470,500,"Sun Example",#True)
*engine\RenderEnd()
EndMacro
Procedure.i Main()
Protected *engine.NAUTILUS_ENGINE
Protected *sun_light.NAUTILUS_TEXTURE
Protected *sun_core_1.NAUTILUS_TEXTURE
Protected *sun_core_2.NAUTILUS_TEXTURE
Protected rotate.f
If nautilusVersion() = #NAUTILUS_VERSION
If OpenWindow(0,0,0,960,600,#Null$,#PB_Window_SystemMenu|#PB_Window_ScreenCentered|#PB_Window_MinimizeGadget)
AddWindowTimer(0,0,20)
*engine = nautilusEngine(WindowID(0),WindowWidth(0),WindowHeight(0))
If *engine
*engine\RenderVSyncMode(#False)
*sun_light = *engine\CreateTexture(?sun_light)
*sun_core_1 = *engine\CreateTexture(?sun_core_1)
*sun_core_2 = *engine\CreateTexture(?sun_core_2)
Repeat
Select WaitWindowEvent()
Case #PB_Event_Timer
rotate + 0.1
RenderSun(470,260,280)
Case #PB_Event_CloseWindow
Break
EndSelect
ForEver
*engine\Release()
EndIf
CloseWindow(0)
EndIf
EndIf
ProcedureReturn #Null
EndProcedure
Main()
End
DataSection
sun_light:
IncludeBinary "sun_1.png" ;original by HalloweenNight: Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)
sun_core_1:
IncludeBinary "sun_2.png" ;original by Kevin Reardon: Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)
sun_core_2:
IncludeBinary "sun_3.png" ;original by Vasco M. J. Henriques and Ainar Drews: Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)
EndDataSection
viewtopic.php?p=563734#p563734
Download Sprites:
https://www.dropbox.com/s/w0rdp67joc6ml ... s.zip?dl=0
Put all files in the same Directory.
Hope this helps even thought i used my own gfx lib.
This ofc. can also be easily done with the PB 2d lib.
Re: how can i generate 2d object with particles ?
And much more depends on the amount of time that is available for the implementation of the idea. For example, I am enraged by games with poor graphics in 2021. Of course, this does not apply to projects of people who are just learning programming. I'm talking about talentless products that cool companies make for one-time earnings.
Re: how can i generate 2d object with particles ?
I think PB 2D can't achive that. The glow is achived by emissive color. Don't think PB's 2D engine supports that. You would need to use the 3D part of PB (Ogre engine). While unity supports 2D, it is not a 2D engine and often cool effects are achived by doing 3D but using planar projection.skinkairewalker wrote: ↑Wed Apr 21, 2021 4:55 am i am studying PB 2D engine ( Game ), and an intriguing question arose, can I do something similar to this in PB with the 2d support library?
The project in question was done on the 2D engine called Unity Engine https://xform.artstation.com/projects/gJZbOP and consists of "generating" sidereal stars automatically...
Does anyone have a similar example or have any idea how to do it in PB?