Just a basic sun, with dynamic-volumetric light.
from pandac.PandaModules import *
loadPrcFileData("", "textures-power-2 none")
loadPrcFileData("", "basic-shaders-only f")
from direct.directbase.DirectStart import *
from direct.filter.CommonFilters import CommonFilters
import sys
cm = CardMaker('card')
sun = render.attachNewNode(cm.generate())
sun.setBillboardPointWorld()
sun_tex = loader.loadTexture("Circle.png")
sun.setTexture(sun_tex)
sun.setTransparency(TransparencyAttrib.MBinary)
sun.setPos(-2,500, 90)
sun.setScale(50, 50, 50)
fltr = CommonFilters(base.win, base.cam)
fltr.setBloom(blend=(0.3, 0.4, 0.3, 0.0), mintrigger=0.6, maxtrigger=7.0, desat=5.6, intensity=10.0, size="big")
dc=0.5
up=True
def vlght_upd(task):
global dc
global up
if dc>=1.000 and up==True:
up=False
elif dc<=.5 and up ==False:
up=True
if up==True:
dc += 0.001
else:
dc -= 0.001
fltr.setVolumetricLighting(sun, 64, 0.5, dc, 0.05)
return task.again
upd_vlght = taskMgr.doMethodLater(0.03, vlght_upd, 'woo!')
############
render.flattenStrong()
base.accept('escape', sys.exit )
run()
I found that I’ll probly have to use it more often that I thought, and I didn’t want to rewrite it everytime. So I just quickly brought up this in notepad. And that’s the reason why I shared it.
Circle.png:
P.S.:Sorry for the mess.
Be Free To Edit!
-cheers
–Your Mešča