Hi. This is an incredibly simple bloom like effect (it's not really bloom, it just makes stuff more glowy) that uses neither shaders nor media. Press SPACE to toggle the bloom on/off, and enjoy
. (A compare/contrast Screenshot is attached.)
rem Start
Sync On
Sync Rate 0
Autocam Off
Set Display Mode 1024,768,32,1
rem Do some light coloring
color ambient light 0
rem Set variables
SkyIMG=1
BloomIMG=100
SkyOBJ=99
BloomOBJ=101
ShowBloom=0
rem Camera stuff
Make Camera 1
for c = 0 to 1
color backdrop c,0
set camera range c,1,10000
next c
camimgWidth=Screen Width()
camimgHeight=Screen Height()
Set Camera To Image 1,BloomIMG,camimgWidth,camimgHeight
rem Create sky image
Create bitmap 1,512,512
TopColor=rgb(200,200,100)
BottomColor=rgb(0,0,100)
box 0,0,512,512,TopColor,BottomColor,TopColor,BottomColor
get image SkyIMG,0,0,512,512
Delete bitmap 1
rem Create sky object
Make Object Sphere SkyOBJ,-2000
texture object SkyOBJ,SkyIMG
set object ambient SkyOBJ,0
rem Create a bunch of random spheres.
for s = 1 to 50
Make object sphere s,10
color object s,rgb( rnd(255) , rnd(255) , rnd(255) )
position object s,-100+rnd(200),-30+rnd(60),-100+rnd(200)
next s
rem Create "bloom" object and lock it to the screen (Locking code posted by IanM)
h# = (screen height() + 0.0) / screen width() ` <--- ratio of height to width
o=BloomOBJ
make object plain o, 1.605, 1.605 * h# ` <--- 1.605 by trial and error
lock object on o
position object o, 0.0, 0.0, 1.000001 ` <--- 1.0 causes half the plain to be clipped on my PC
texture object o,BloomIMG
ghost object on o
set object ambient o,0
disable object zwrite o
rem Loop
do
rem Some text
set cursor 0,0
ink rgb(255,0,0),0
print "Press SPACE to show the bloom effect. Press it again to hide the bloom effect."
print "FPS: ",screen fps()
rem Camera control
spd=2
move camera spd*(upkey()-downkey())
rotate camera camera angle x(0)+mousemovey()/8.0,camera angle y(0)+mousemovex()/8.0,0
rem position camera 1 (the bloom camera) to camera 0's position
position camera 1,camera position x(0),camera position y(0),camera position z(0)
rotate camera 1,camera angle x(0),camera angle y(0),camera angle z(0)
rem Show/Hide bloom when space is pressed.
if Spacekey()
`If ShowBloom is 1 then set it to 0. If it's 0 then set it to 1.
if ShowBloom=1
ShowBloom=0
else
ShowBloom=1
endif
rem Wait for the user to stop pressing space
While Spacekey() : Endwhile
endif
rem if the bloom is to be shown then do the bloom stuff. Otherwise don't.
if ShowBloom=1
rem Hide the bloom object
exclude object on BloomOBJ
rem Update camera 1
sync mask %00000010
sync
rem Show the bloom object
exclude object off BloomOBJ
else
rem Hide the bloom object if it shouldn't be visible
exclude object on BloomOBJ
endif
rem Update camera 0
sync mask %00000001
sync
loop
I just realized that it's very similar to what agent dink mentioned in
this thread, actually. Only now I did it correctly
.
EDIT: Now there can be multiple levels of contrast. Use w/s to switch between them:
rem Start
Sync On
Sync Rate 0
Autocam Off
Set Display Mode 1024,768,32,1
rem Do some light coloring
color ambient light 0
rem Set variables
SkyIMG=1
BloomIMG=100
SkyOBJ=99
ShowBloom=0
ShowBloom=1
BloomStrength=0
rem This is the highest strength that the bloom can go to. (Also the # of bloom objects used)
rem Set this to any number greater than 0 and see what happens.
MaxBloomOBJ=5
DIM BloomOBJ(MaxBloomOBJ)
rem Camera stuff
Make Camera 1
for c = 0 to 1
color backdrop c,0
set camera range c,1,10000
next c
camimgWidth=Screen Width()
camimgHeight=Screen Height()
Set Camera To Image 1,BloomIMG,camimgWidth,camimgHeight
rem Create sky image
Create bitmap 1,512,512
TopColor=rgb(200,200,100)
BottomColor=rgb(0,0,100)
box 0,0,512,512,TopColor,BottomColor,TopColor,BottomColor
get image SkyIMG,0,0,512,512
Delete bitmap 1
rem Create sky object
Make Object Sphere SkyOBJ,-2000
texture object SkyOBJ,SkyIMG
set object ambient SkyOBJ,0
rem Create a bunch of random spheres.
for s = 1 to 50
Make object sphere s,10
color object s,rgb( rnd(255) , rnd(255) , rnd(255) )
position object s,-100+rnd(200),-30+rnd(60),-100+rnd(200)
next s
rem Create "bloom" object and lock it to the screen (Locking code posted by IanM)
h# = (screen height() + 0.0) / screen width() ` <--- ratio of height to width
for s = 1 to MaxBloomOBJ
BloomOBJ(s)=200+s
o=BloomOBJ(s)
if s = 1
make object plain o, 1.605, 1.605 * h# ` <--- 1.605 by trial and error
lock object on o
position object o, 0.0, 0.0, 1.000001 ` <--- 1.0 causes half the plain to be clipped on my PC
texture object o,BloomIMG
ghost object on o
set object ambient o,0
disable object zwrite o
else
Clone Object o,BloomOBJ(1)
lock object on o
position object o, 0.0, 0.0, 1.000001
endif
next s
rem Loop
do
rem Some text
set cursor 0,0
ink rgb(255,0,0),0
print "Press w/s to increase/decrease the bloom strength."
print "FPS: ",screen fps()
print "Bloom Strength: ",BloomStrength," / ",MaxBloomOBJ
BloomINC=Keystate(17)-Keystate(31)
if BloomINC<>0
while keystate(17) or keystate(31) : endwhile
inc BloomStrength,BloomINC
endif
if BloomStrength>MaxBloomOBJ then BloomStrength=MaxBloomOBJ
if BloomStrength<0 then BloomStrength=0
rem Camera control
spd=2
move camera spd*(upkey()-downkey())
rotate camera camera angle x(0)+mousemovey()/8.0,camera angle y(0)+mousemovex()/8.0,0
rem position camera 1 (the bloom camera) to camera 0's position
position camera 1,camera position x(0),camera position y(0),camera position z(0)
rotate camera 1,camera angle x(0),camera angle y(0),camera angle z(0)
rem if the bloom is to be shown then do the bloom stuff. Otherwise don't.
if ShowBloom=1
for s = 1 to MaxBloomOBJ
rem Hide the bloom object
exclude object on BloomOBJ(s)
next s
rem Update camera 1
sync mask %00000010
sync
for s = 1 to BloomStrength
rem Show the bloom object
exclude object off BloomOBJ(s)
next s
else
for s = 1 to MaxBloomOBJ
rem Hide the bloom object if the spacekey is pressed
exclude object on BloomOBJ(s)
next s
endif
rem Update camera 0
sync mask %00000001
sync
loop
High levels actually produce a semi useable full screen cartoon shading effect if you don't turn the ambient of the objects off (on spheres at least):
rem Start
Sync On
Sync Rate 0
Autocam Off
Set Display Mode 1024,768,32,1
rem Do some light coloring
color ambient light 0
rem Set variables
SkyIMG=1
BloomIMG=100
SkyOBJ=99
ShowBloom=0
ShowBloom=1
BloomStrength=20
rem This is the highest strength that the bloom can go to. (Also the # of bloom objects used)
rem Set this to any number greater than 0 and see what happens.
MaxBloomOBJ=20
DIM BloomOBJ(MaxBloomOBJ)
rem Camera stuff
Make Camera 1
for c = 0 to 1
color backdrop c,0
set camera range c,1,10000
next c
camimgWidth=Screen Width()
camimgHeight=Screen Height()
Set Camera To Image 1,BloomIMG,camimgWidth,camimgHeight
rem Create sky image
Create bitmap 1,512,512
TopColor=rgb(200,200,100)
BottomColor=rgb(0,0,100)
box 0,0,512,512,TopColor,BottomColor,TopColor,BottomColor
get image SkyIMG,0,0,512,512
Delete bitmap 1
rem Create sky object
Make Object Sphere SkyOBJ,-2000
texture object SkyOBJ,SkyIMG
set object ambient SkyOBJ,0
rem Create a bunch of random spheres.
for s = 1 to 50
Make object sphere s,10
color object s,rgb( rnd(255) , rnd(255) , rnd(255) )
position object s,-100+rnd(200),-30+rnd(60),-100+rnd(200)
next s
rem Create "bloom" object and lock it to the screen (Locking code posted by IanM)
h# = (screen height() + 0.0) / screen width() ` <--- ratio of height to width
for s = 1 to MaxBloomOBJ
BloomOBJ(s)=200+s
o=BloomOBJ(s)
if s = 1
make object plain o, 1.605, 1.605 * h# ` <--- 1.605 by trial and error
lock object on o
position object o, 0.0, 0.0, 1.000001 ` <--- 1.0 causes half the plain to be clipped on my PC
texture object o,BloomIMG
ghost object on o
`set object ambient o,0
disable object zwrite o
else
Clone Object o,BloomOBJ(1)
lock object on o
position object o, 0.0, 0.0, 1.000001
endif
next s
rem Loop
do
rem Some text
set cursor 0,0
ink rgb(255,0,0),0
print "Press w/s to increase/decrease the bloom strength."
print "FPS: ",screen fps()
print "Bloom Strength: ",BloomStrength," / ",MaxBloomOBJ
BloomINC=Keystate(17)-Keystate(31)
if BloomINC<>0
while keystate(17) or keystate(31) : endwhile
inc BloomStrength,BloomINC
endif
if BloomStrength>MaxBloomOBJ then BloomStrength=MaxBloomOBJ
if BloomStrength<0 then BloomStrength=0
rem Camera control
spd=2
move camera spd*(upkey()-downkey())
rotate camera camera angle x(0)+mousemovey()/8.0,camera angle y(0)+mousemovex()/8.0,0
rem position camera 1 (the bloom camera) to camera 0's position
position camera 1,camera position x(0),camera position y(0),camera position z(0)
rotate camera 1,camera angle x(0),camera angle y(0),camera angle z(0)
rem if the bloom is to be shown then do the bloom stuff. Otherwise don't.
if ShowBloom=1
for s = 1 to MaxBloomOBJ
rem Hide the bloom object
exclude object on BloomOBJ(s)
next s
rem Update camera 1
sync mask %00000010
sync
for s = 1 to BloomStrength
rem Show the bloom object
exclude object off BloomOBJ(s)
next s
else
for s = 1 to MaxBloomOBJ
rem Hide the bloom object if the spacekey is pressed
exclude object on BloomOBJ(s)
next s
endif
rem Update camera 0
sync mask %00000001
sync
loop