Posted: 26th Jul 2007 2:29
Nice one Zotoaster!


Indeed.
Posted: 11th Aug 2007 20:40
I just found another effect, although it's very simple. It's a television/camera vision type effect. It draws lines on the screen which you can tint any colour. Here's the code:
+ Code Snippet
function camera_vision(imgnum,coltint as dword)
for y=0 to screen height()
ink coltint,blah
line 0,y*2,screen width(),y*2
next y
get image imgnum,0,0,screen width(),screen height()
endfunction

then you draw a sprite to the screen of that image. Also, if you want the tint to be black, set coltint as 1,1,1 (as in rgb), not 0,0,0 as the sprite will take that as see-through.

Here's an image with a green tint (rgb(1,50,1)).


Hope you have fun with it.
Posted: 12th Aug 2007 13:58
take a look at this one. I modified the reflection code to improve the effect
+ Code Snippet
hide mouse
sync on
sync rate 60
autocam off
make matrix 1,1000,1000,10,10
make object sphere 1,140
make object plain 2,800,600
`yrotate object 2, 180
scale object 2,-100,100,100
make camera 1
set camera to image 1,1,1024,1024
set camera fov 1,90
texture object 2,1

position object 1,500,100,300
position object 2,500,300,500
yrotate camera 1,180
`SCALE object texture 2,.5,.5
`scroll object texture 2,512,0
do
set cursor 0,0
print a
`print dk get camera fov(1)
position camera 0,object position x(1),object position y(1),object position z(1)
set camera to image 1,1,1024,1024

position camera 1,500,object position y(1),499
if leftkey()=1 then move object left 1,2
if rightkey()=1 then move object right 1,2
if upkey()=1 then move object 1,2
if downkey()=1 then move object 1,-2
if inkey$()="-" then dec a
if inkey$()="=" then inc a
`set camera fov 1,a

sync
loop

sync

it isn't perfect, but I'll think of something to get the scale right (other than scaling the object)
Posted: 12th Aug 2007 21:15
Ooh! That looks a lot better than my attempt!

I'm looking forward to another version of it.
Posted: 13th Aug 2007 10:05
This is not mine, but its so cool ive decided to include it anyway. its made by cloggy, this is the link on his website.
http://www.cloggj.f2s.com/DBPro2/snippets.html
Its called 3D rain.
Posted: 27th Aug 2007 19:49
Here's another light effect from me... You could probably fit it into the bloom category.

Here's the code, and then I'll explain it.
+ Code Snippet
sync on
sync rate 20
dot 0,0
get image 1,0,0,1,1
box 0,0,10,10,rgb(70,100,30),rgb(70,100,30),rgb(70,100,30),rgb(70,100,30)
for rndy=1 to 100
dot rnd(10),rnd(10),rgb(rnd(100)+20,rnd(30)+20,rnd(10)+20)
next rndy
get image 2,0,0,10,10
make object sphere 1,49
texture object 1,2
make object sphere 2,51.1
`set object ambient 2,0
texture object 2,1
ghost object on 2
scroll object texture 2,90,40

do
position object 2,object position x(1),object position y(1),object position z(1)
set object to object orientation 2,1
turn object right 1,mousemovex()/2
pitch object up 1,mousemovey()/2

control camera using arrowkeys 0,4,3

sync
loop
sync


First of all, note that I haven't adjusted the ambient light at all.

What you do, is take your object you want to shine, and make a copy of it. The new copy should be scaled slightly bigger than the actual object. Ghost the copy object (you can change the ghost from the default if you want, but I didn't need to), and apply a completely white texture to the copy object. Rotate and position the copy object at the exact angle and position of the actual object. You don't need me to say about if the object is animated. Just start the copy object's animation then too. I think this works according to where you position the light. I'm going to experiment.

Hope this looks nice.
Posted: 27th Aug 2007 21:24
Sorry for the double post. I just made a new effect - It's a bit like Valle's grass effect and Mr Kohlenstoff's wall effect. I'm really excited, just so you know. I'll show the images first, and then the code and explaining.



Here we go:
+ Code Snippet
sync on
sync rate 60
hide mouse
load image "bumpmap.png",1
make object plain 1,100,100
texture object 1,1
autocam off
for x=2 to 5
make object plain x,100,100
texture object x,1
position object x,0,0,x
set object transparency x,1
next x

do
control camera using arrowkeys 0,1.0,0.5
sync
loop

sync

It's simple; all I do is make an image of bricks, realistic or not, with transparency in between. I texture five plains with this texture, and I set the transparency on for four of them. The four transparent textures are set forward one unit more than the last. And there you go, a 3d, low-poly wall!
Posted: 28th Aug 2007 2:47
Hey, that's awesome!

I'd expand on it a bit though by using a real heightmap/bumpmap, scanning it several times and building a separate image with each scan for each layer in the heightmap/bumpmap.

That way you'd still be using several plains but each layer could be slightly different, so you could have smooth bumps and stuff. But yeah, awesome effect!
Posted: 28th Aug 2007 18:30
I tried making another effect, something like Bloom or HDR, don't know, called it 'blend' in the sourcecode (I'm not sure if the english word means the same like the German ).

I's a bit slow because I use the point-command to check some screen-colors.. but I still get 600-700 FPS in this "demo".

+ Code Snippet
sync on
sync rate 120

rem Objects
make object cube 1, 10
make object plain 2, 200,200

xrotate object 2, -90

set object light 1,0
position object 1, 0,5,0
color object 1, rgb(255,255,255)
color object 2, rgb(32,16,4)

rem Cam-Position
position camera 0, 5, -40
xrotate camera 0

rem Setup functions
SetupBlend(30) `<- increase this value for better performance (but worse quality..)!
ink rgb(255,0,0),0

angle# = 0

do
   set cursor 0,0

   angle# = wrapvalue(angle# + 1.5)
   position object 1, 0, 5.5*sin(angle#), 0

   if controlkey()=0 then UpdateBlend()

   control camera using arrowkeys 0,1,1

   print "FPS: ", screen fps()

   sync
loop



function SetupBlend(dis)
   global Blend_Value as float = 0
   global Blend_Col as integer = 0
   global Blend_Dec as float = 0
   global Blend_XStep as integer = : Blend_XStep = dis
   global Blend_YStep as integer = : Blend_YStep = dis
   rem Create image
   global Blend_Image = 5221 `<- ^^ unprofessional :D but i'm to lazy now sorry
   global Blend_Sprite = 5715
   mem = 31 `<- again ~~
   make memblock mem, 16
   write memblock dword mem,  0,  1
   write memblock dword mem,  4,  1
   write memblock dword mem,  8, 32
   write memblock dword mem, 12, 0xFFFFFFFF
   make image from memblock Blend_Image, mem
   delete memblock mem
   sprite Blend_Sprite,0,0,Blend_Image
   hide sprite Blend_Sprite
endfunction

function UpdateBlend()
   sw = screen width()
   sh = screen height()
   size sprite Blend_Sprite, sw,sh
   rem Get screen colors
   col = 0
   num = 0
   lock pixels
      for x = 1 to sw step Blend_XStep
         for y = 1 to sh step Blend_YStep
            ActCol = point(x,y)
            inc num
            f# = 1-(abs(x-sw/2)*abs(y-sh/2))/((sw/2.0)*(sh/2.0))
            f# = f#^40
            if controlkey()=0 and f# > 1 then print f#
            inc col, rgbr(ActCol)*f#+rgbg(ActCol)*f#+rgbb(ActCol)*f#
         next y
      next x
   unlock pixels
   col = 10*col/num
   rem Update Blend
   `if col > 255 then col = 255
   dif = col-Blend_Col
   if dif>0 then inc Blend_Value, dif
   Blend_Col = col
   dec Blend_Value, Blend_Dec
   inc Blend_Dec, 0.01
   if Blend_Value < 0 then Blend_Value = 0 : Blend_Dec = 0
   if Blend_Value > 255 then Blend_Value = 255
   rem Update sprite
   set sprite alpha Blend_Sprite, Blend_Value
   paste sprite Blend_Sprite, 0,0
   print col
   print Blend_Value
endfunction


Nice bump-effect by the way.
Posted: 29th Aug 2007 2:58
@Twu Kai

That 3d low-poly wall effect is awesome -- it definitely creates a unique style. Good job !!!
Posted: 29th Aug 2007 9:00
yeah you could make an awesome medialess game with that!
Posted: 29th Aug 2007 18:43
That's a nice effect, Mr Kohlenstoff. If I get it right, it does a sort of average of all the colours?

@ Aralox.
Hm... That would be interesting to do.

Glad everyone likes the wall effect!
Posted: 30th Aug 2007 0:50
This thread is pretty cool. I'll keep an eye on it. Maybe I'll try something
Posted: 31st Aug 2007 9:45
Here's a nice reflection thing I made using cube mapping:


Cube maping IS a shader, if you had coded the uv data changing yourself then it would be a shaderless effect.

But all these effects look great!

why does noone post the pseudo motion blur effect of the DP examples?
Posted: 31st Aug 2007 15:37
Tried a motion blur.. looks more or less good and runs kind of fast. ^^

+ Code Snippet
set display mode 800,600,32
sync on
sync rate 120


color backdrop 0xFFFFFF

make object cube 1, 10

set camera to image 0, 1, 512,512
sprite 1, 0,0, 1
size sprite 1, 800,600
hide sprite 1
set sprite 1, 0,1
set sprite alpha 1, 32

autocam off

make object cube 2, 5
color object 2, rgb(0,255,0)
Angle = rnd(360)

ink rgb(255,0,0),0


do
   set cursor 0,0
   print "FPS: ", screen fps()
   print "Move mouse to look around"
   print "Press control for slow-motion"
   yrotate object 1, object angle y(1)+1.8

   Angle = wrapvalue(Angle+1)
   position object 2, 50*sin(Angle), 0, 50*cos(Angle)

   xrotate camera camera angle x()+mousemovey()
   yrotate camera camera angle y()+mousemovex()

   paste sprite 1, 0,0

   sync

   rem Control for "slow motion"
   if controlkey() then wait 25
loop



Edit: Screenshot... but it looks better in motion of course.
Posted: 1st Sep 2007 0:09
You can also do a motion blur effect by turning off the backdrop, making your own "backdrop" with a giant inverted object (like a sphere or box) with about half transparency. It looks cool and if used right can be pretty awesome.
Posted: 1st Sep 2007 14:51
can you post an example snippet?
Posted: 1st Sep 2007 15:32
fixed function "bump mapping" using texture blending (no shaders, so it should run almost anywhere)...





code example...

+ Code Snippet
rem BLEND MODE (0=diffuse colour for light direction,1=bumpmap,2=earth image)
` iStage 0-7
` iImage Index
` iTexCoordMode
` 0 - Regular UV Stage Match
` 1 - Sphere Mapping UV Data
` 2 - Cube Mapping UV Data
` 3 - Steal UV Data From Stage Zero
` 10-17 - Take UV Data From Stage.. (10=0,11-1,etc)
` iBlendMode
` D3DTOP_DISABLE = 1,
` D3DTOP_SELECTARG1 = 2,
` D3DTOP_SELECTARG2 = 3,
` D3DTOP_MODULATE = 4,
` D3DTOP_MODULATE2X = 5,
` D3DTOP_MODULATE4X = 6,
` D3DTOP_ADD = 7,
` D3DTOP_ADDSIGNED = 8,
` D3DTOP_ADDSIGNED2X = 9,
` D3DTOP_SUBTRACT = 10,
` D3DTOP_ADDSMOOTH = 11,
` D3DTOP_BLENDDIFFUSEALPHA = 12,
` D3DTOP_BLENDTEXTUREALPHA = 13,
` D3DTOP_BLENDFACTORALPHA = 14,
` D3DTOP_BLENDTEXTUREALPHAPM = 15,
` D3DTOP_BLENDCURRENTALPHA = 16,
` D3DTOP_PREMODULATE = 17,
` D3DTOP_MODULATEALPHA_ADDCOLOR = 18,
` D3DTOP_MODULATECOLOR_ADDALPHA = 19,
` D3DTOP_MODULATEINVALPHA_ADDCOLOR = 20,
` D3DTOP_MODULATEINVCOLOR_ADDALPHA = 21,
` D3DTOP_BUMPENVMAP = 22,
` D3DTOP_BUMPENVMAPLUMINANCE = 23,
` D3DTOP_DOTPRODUCT3 = 24,
` D3DTOP_MULTIPLYADD = 25,
` D3DTOP_LERP = 26,

iObj=4 : iStage=1 : iImage=2 : iTexCoord=3 : iBlendMode=24
set blend mapping on iObj, iStage, iImage, iTexCoord, iBlendMode
iObj=4 : iStage=2 : iImage=1 : iTexCoord=3 : iBlendMode=4
set blend mapping on iObj, iStage, iImage, iTexCoord, iBlendMode


for more code, check out the Number8-Blend Modes demo in /U58Examples/BugFixes folder...

--Mike
Posted: 2nd Sep 2007 1:39
Nice thread. I should try these out.

Here's a sort of HDR effect, or at least a correction of the sRGB monitor gamma/whatever. I tried to use Evolved's HDR shader, but it wouldn't work on my computer. However, inspired by the code, i made an effect without using shaders. Roughly halves the framerate since it has to render everything twice, although it is rendering the same thing twice.

At the start of the program, do this...


+ Code Snippet
#constant hdr_experiment_objnum   10  `this  can be whatever
#constant hdr_expt_imagenum       10  `so can this



make object plain hdr_experiment_objnum,80,60
lock object on hdr_experiment_objnum
position object hdr_experiment_objnum,0,0,50
`basically so it fills the screen

hdr_expt_camnum=1
make camera hdr_expt_camnum
set camera to image hdr_expt_camnum,hdr_expt_imagenum,512,512

texture object hdr_experiment_objnum,hdr_expt_imagenum
set object hdr_experiment_objnum,1,0,0,1,0,0,0  
ghost object on hdr_experiment_objnum
disable object zwrite hdr_experiment_objnum
disable object zdepth hdr_experiment_objnum

`make sure the camera range allows camera 0 to see the object.
`make sure camera range allows camera 1 to see your world

 


then during the game loop, make the cameras have the same position and orientation, then call a sync like this:

+ Code Snippet
exclude object on hdr_experiment_objnum
hide object hdr_experiment_objnum

sync mask 2:sync  `render the image to overlay (camera 1)

exclude object off hdr_experiment_objnum
show object hdr_experiment_objnum

sync mask 1:sync  `render the main scene, including overlaid image( textured plain)


Anyway, it seems to work pretty good. Perhaps i can make it faster using sprites.
Posted: 2nd Sep 2007 1:58
can you post an example snippet?



+ Code Snippet
backdrop off
make object sphere 1,-100
color object 1,rgb(0,0,0)
set alpha mapping on 1,50 `or whatever value you want, lower number = more motion blurring, higher = less motion blurring


Then, do whatever you want