Posted: 14th Jun 2007 19:44
This is a thread to post any effects you want to share, such as water not using any shaders, cartoon effects (also not using shaders), etcetera. Could you please tell/post the code for making the effect you show, so that other people can use them!

Here's one to start off: a Bloom type effect. Here's a screenshot, then I'll explain how I did it.


What I did to make that effect was make an inverted sphere to be the skysphere, colour it near-white, add fog that was coloured a bit brighter than the average colour of the map, and that was it. Here's the basic code:
+ Code Snippet
set camera range 0,1,21000
fog on
fog distance 18000
fog color rgb(255,230,138)

make object sphere 4,-35000
set ambient light 90
set object fog 4,0
color object 4,rgb(255,231,145)

I hope this helps. Now start showing us your effects.
Posted: 14th Jun 2007 19:48
Ah, great!

I am going to see if I can write something..
Posted: 14th Jun 2007 20:04
Twu Kai, would you mind making that image smaller so it doesn't stretch the thread width?

Edit: Thanks!
Posted: 14th Jun 2007 20:07
Sure, sorry. Doing it now!

EDIT: Done.
Posted: 14th Jun 2007 20:16
Black fog for Day/Night transition effect!



How you do it..

Set the fog to colour black
For day set the fog distance large say FOG DISTANCE 1000
For night set the fog distance close say Fog DISTANCE 50
To get a smooth transition just slowy increase and decrease a variable

do
FOG DISTANCE fogDist
inc fogDist
loop

if you keep it at something like 50 it's like you are holding a torch as there is a bit of light around your feet.

easy peazy
Posted: 15th Jun 2007 8:51
That game looks BRILLIANT, GatorHex!
I'd love to play it!
Posted: 16th Jun 2007 12:47
I would post this no shader-water here, where the texture is just scrolled, but I'm not sure how it works.. however, I may be going to try another technique for realistic water.

I think another effect we could add to this thread was shown by Valle some months ago, where he uses some transparent plains with the same texture, positioned over each other in a row, to create a really cool grass-effect.. I'm going to look if I can find it anywhere.
Posted: 16th Jun 2007 13:38
OK, I've wrote a small example program about my idea for a water-effect.

Here a small screenshot.. it doesn't look very good because the water-textures I created aren't seamless, but I didn't know how to fix it wihtout too much work.



The technique is quite simple, I use two plains, with scaled water-textures. One plain is a big higher than the other one to avoid graphical errors.. Then the plains are moved (I think you could also scroll the texture) always in the mainloop in different directions. The top plain is transparent, so that you can see both. So you can create a more or less realistic water-effect this way...

Here the code I used:

+ Code Snippet
rem MrKohlenstoff's no-shader-water-effect
set display mode 1024,768,32
sync on : sync rate 120
randomize timer()

rem Creating the matrix
make matrix 1, 1000,1000, 50,50
randomize matrix 1, 15
update matrix 1

rem Create simple matrix-sand-texture
lock pixels
   for x = 1 to 256
      for y = 1 to 256
         r = 200+rnd(55)
         g = 150+rnd(r-150)
         b = rnd(g*0.15)
         dot x,y,rgb(r,g,b)
      next y
   next x
unlock pixels
get image 3, 1,1,256,256, 1
prepare matrix texture 1,3, 1,1

rem Create Water-Texture 1
for i = 1 to 2
   lock pixels
      rem top row
      r = rnd(40)
      g = 40+rnd(50)
      b = 150+rnd(105)
      dot 1,1, rgb(r,g,b)
      for x = 2 to 256
         r2 = r : g2 = g : b2 = b
         r = r2+ 5-rnd(10) : if r >  50 : r =  50 : endif : if r <   0 : r =   0 : endif
         g = g2+ 8-rnd(16) : if g > 100 : g = 100 : endif : if g <  30 : g =  30 : endif
         b = b2+10-rnd(20) : if b > 255 : b = 255 : endif : if b < 140 : b = 140 : endif
         dot x,1, rgb(r,g,b)
      next x
      rem Left row
      col = point(1,1) : r = rgbr(col) : g = rgbg(col) : b = rgbb(col)
      for y = 2 to 256
         r2 = r : g2 = g : b2 = b
         r = r2+ 5-rnd(10) : if r >  50 : r =  50 : endif : if r <   0 : r =   0 : endif
         g = g2+ 8-rnd(16) : if g > 100 : g = 100 : endif : if g <  30 : g =  30 : endif
         b = b2+10-rnd(20) : if b > 255 : b = 255 : endif : if b < 140 : b = 140 : endif
         dot 1,y,rgb(r,g,b)
      next x
      rem Rest of image
      for x = 2 to 257
         for y = 2 to 257
            c1 = point(x-1,y-1) : c2 = point(x-1,y) : c3 = point(x,y-1)
            r = (rgbr(c1)+rgbr(c2)+rgbr(c3))/3+ 5-rnd(10) : if r >  50 : r =  50 : endif : if r <   0 : r =   0 : endif
            g = (rgbg(c1)+rgbg(c2)+rgbg(c3))/3+ 8-rnd(16) : if g > 100 : g = 100 : endif : if g <  30 : g =  30 : endif
            b = (rgbb(c1)+rgbb(c2)+rgbb(c3))/3+10-rnd(20) : if b > 255 : b = 255 : endif : if b < 140 : b = 140 : endif
            col = rgb(r,g,b)
            dot x,y,col
            dot 513-x, y, col
            dot x, 513-y, col
            dot 513-x,513-y,col
         next y
      next x
   unlock pixels
   get image i, 2,2,256,256
next i

rem Create plains for water-texture
for i = 1 to 2
   make object plain i, 1200,1200
   texture object i, i
   scale object texture i, (20*i), (20*i)
   position object i, 0, 8+i, 0
   xrotate object i, -90
   fix object pivot i
next i
ghost object on 2, 2

rem Variables
PosWater1 as float
PosWater2 as float

rem Camera
position camera 0,0,0

rem Main-Loop
do
   rem camera control
   control camera using arrowkeys 0,1,1
   cx# = camera position x()
   cz# = camera position z()
   cy# = get ground height(1,cx#,cz#)+25
   position camera cx#,cy#,cz#

   rem move Water
   position matrix 1, -500, 0, -500
   PosWater1 = ((PosWater1 + 0.1 ) mod 60)
   PosWater2 = ((PosWater2 + 0.15) mod 30)
   position object 1, PosWater1, 9, 0
   position object 2, 0, 10, PosWater2

   sync
loop



****

Edit:

I've found Valles Grass effect.

He used this example-code:

+ Code Snippet
set display mode 1024,768,32
sync on : sync rate 60 : sync
size = 100
cls : lock pixels
For t=1 to size*20 : dot rnd(size-1),rnd(size-1),rgb(0,100+rnd(155),rnd(10)) : next t
unlock pixels:get image 1,0,0,size-1,size-1,1

For t = 0 to 19
   make object plain t+1,size,size
   position object   t+1,0,t,t*.5
   xrotate object    t+1,90
   texture object    t+1,1
   set object transparency t+1,3
next t

do
   position camera cos(a)*size*1.5,size*2,sin(a)*size*1.5 : inc a
   point camera 0,0,0
sync:loop


The result looks like this:



And the thread can be found here: http://forum.thegamecreators.com/?m=forum_view&t=97923&b=11
Posted: 16th Jun 2007 16:39
Wow, the grass looks great. The water effect looks neat too. You could maybe have 3 or 4 different layers, so that it swirled around a lot. I'm trying to find a way to reflect the landscape in a watery way, not using shaders. Hopefully I'll manage soon!
Posted: 16th Jun 2007 16:57
Yes, reflections would be great, but I have no idea how you could realize it without using DBP-reflection shading, or other shaders... good luck though.

I have changed the water and grass-textures in my example, and it looks way better now:
Posted: 16th Jun 2007 20:31
I am really motivated Oo (that's not normal..) so I have tried a new technique: Instead of using normalmapping, pre"compile" the normal map onto the texture to have predefined lightning effects (good for static walls etc.. maybe).

The result looks like this (the texture and normalmap are not made by me, I took them from the internet):



The top left image is the original texture, in the top right corner you can see the normalmap. From this normal map I created the lightmap in the bottom left corner, and the bottom right image is the result, with lightmap overlayed on the texture.
If the lights or the players position don't change, this is as good as a shader I think, but with better performance... it looks just not very good if the player, lights or the object itself move.
Posted: 16th Jun 2007 22:20
Not that I know anything about shaders, but isn't the whole point of a normal map derived from a texture that the lighting effect changes as you move - to make it more 3d? If you're not moving, I can't see the point of a normal map - the original texture would be just as good. Perhaps if you had a second plain slightly infront of the wall textured with the shadow map, and made it translucent, it would work better.
Posted: 17th Jun 2007 3:11
Don't think this is good for much, but kind of interesting.
+ Code Snippet
set display mode 800,600,32
set ambient light 20
color backdrop 0,rgb(0,0,0)
backdrop on 0
sync on
sync rate 60
autocam off
set camera range 0,0.1,3000


 ObjA=1
make object cube ObjA,1
position object ObjA,0,0,10

 Frame=2
make object sphere Frame,-2,16,16
color object Frame,rgb(0,200,0)
position object Frame,0,0,camera position z(0)
ghost object on Frame,2
set object transparency Frame,2
lock object on Frame


do

control camera using arrowkeys 0,0.2,0.4

turn object right ObjA,0.2
pitch object up ObjA,0.2

sync
loop
Posted: 18th Jun 2007 20:31
Okay, this is the first attempt at reflection. It's just a basic mirror type thing for now, though.

All it uses is an extra camera to make the illusion of reflection. Here's the code:
+ 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
make camera 1
set camera to image 1,1,1024,1024
texture object 2,1

position object 1,500,100,300
position object 2,500,300,500
yrotate camera 1,180
do
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
sync
loop

sync

I'm going to try and find a better method/camera usage for reflection now.

Also, thanks to everyone who has added their effects!
Posted: 22nd Jun 2007 12:22
I have tried to create a small, simple specular-effect, and it works, more or less, on spheres so far... even if it is a bit buggy. <.<



I'm using an transparent sphere, which is bigger than the original one, and is textured with this "specular-map", and always rotated, depending on the position of camera and light-object. (the light-yellow sphere on the right side)

Code:

+ Code Snippet
set display mode 1024,768,32
set window on
sync on : sync rate 60

CreateSpecularmap(1,512,512,10,0.5)


rem Light
make object sphere 1, 50
color object 1, rgb(255,255,200)
set object light 1,0
position object 1, 0,0,-150

rem Sphere+Specular
o = CreateSpheres(100,1)
color object o, rgb(255,64,16)

rem mainloop
do
   set cursor 0,0
   print "FPS: ", screen fps()
   print "Move cam by pressing arrowkeys"

   `control camera using arrowkeys 0,1,1
   inc Height#, upkey()-downkey()
   inc Angle, (rightkey()-leftkey())*2
   Angle = (Angle + 1 ) mod 360
   position camera 300*cos(Angle), Height#, 300*sin(Angle)
   point camera 0,0,0
   UpdateSpecular(o,1)

   CK = controlkey()
   if CK=1 then get image 2,0,0,200,200,1

   sync

   if CK=1 then repeat : paste image 2,0,0 : Sync : until controlkey()=0 : delete image 2
loop






function UpdateSpecular(ID,LightObject)
   inc ID

   rem Get Positions
   rem Camera
   X1# = camera position x()
   Y1# = camera position y()
   Z1# = camera position z()
   rem Light
   X2# = object position x(LightObject)
   Y2# = object position y(LightObject)
   Z2# = object position z(LightObject)
   rem Specular-Sphere
   X3# = object position x(ID)
   Y3# = object position y(ID)
   Z3# = object position z(ID)

   rem Calculate Angles &lt;Y&gt;
   rem Camera&lt;-&gt;Specular
   AY1# = atanfull(X3#-X1#,Z3#-Z1#)
   rem Light&lt;-&gt;Specular
   AY2# = atanfull(X3#-X2#,Z3#-Z2#)
   rem Calculate average-angle
   A_Dis# = AY2#-AY1#
   if A_Dis# &gt;  180 then dec AY2#, 360
   if A_Dis# &lt; -180 then dec AY1#, 360
   A_Mid# = (AY1#-AY2#)/2.0
   rem Rotate object
   yrotate object ID, A_Mid#

   rem Calculate Angles &lt;X&gt;
   rem Camera&lt;-&gt;Specular
   AX1# = atanfull(Z3#-Z1#,Y3#-Y1#)
   rem Light&lt;-&gt;Specular
   AX2# = atanfull(Z3#-Z2#,Y3#-Y2#)
   rem Calculate average-angle
   A_Dis# = AX2#-AX1#
   if A_Dis# &gt;  180 then dec AX2#, 360
   if A_Dis# &lt; -180 then dec AX1#, 360
   A_Mid# = (AX1#-AX2#)/2.0
   xrotate object ID, A_Mid#

endfunction

function CreateSpheres(Size as float, Texture as integer)
   id = FreeObjects(2)
   make object sphere id, Size
   make object sphere id+1, Size*1.05
   texture object id+1, Texture
   set object light id+1, 0
   set object transparency id+1, 1
endfunction id

function FreeObjects(count)
   id = 0
   do
      inc id
      Free = 1
      for o = id+count to id step -1
         if object exist(o)=1 then Free=0 : exit
      next o
      if Free = 1 then exitfunction id
   loop
endfunction 0

function CreateSpecularmap(img,sx,sy,r,Alpha#)
   ink rgb(255,255,255),0
   box 0,0,sx,sy
   get image img, 0,0,sx,sy, 1
   sx_2 = sx/2
   sy_2 = sy/2
   rem Transparency
   mem = 99
   make memblock from image mem,img
   sz = get memblock size(mem)
   x = 0 : y = 1
   for pos = 15 to sz step 4
      inc x : if x &gt; sx then x = 1 : inc y
      disx = abs(sx_2-x)
      disy = abs(sy_2-y)
      dis = sqrt(disx^2+disy^2)
      rem Writ Alpha
      if dis &lt; r
         bt = 255*Alpha#
         write memblock byte mem, pos, bt
      else
         if dis &lt; r*1.2
            Alpha = 255-255*((Dis-r)/(r*0.2))
            if Alpha &gt; 255 : Alpha = 255 : endif
            Alpha = Alpha*Alpha#
            write memblock byte mem, pos, Alpha
         else
            write memblock byte mem, pos, 0
         endif
      endif
   next pos
   rem Update image
   make image from memblock img, mem
   delete memblock mem
endfunction
Posted: 3rd Jul 2007 11:32
Did somebody play the original Splinter Cell? They had an interesting glass-pseudo-reflection-effect (as far as I remember it seemed to work like a cubemap..). Just another texture with light and dark parts, whichs uv-coordinates depended on the camera's position and angle.. would be great if somebody could do this, I don't really have time now (so many projects in progress ).
Posted: 25th Jul 2007 13:37
Does anyone have anymore shader-less effects? I'd like to see some more
Posted: 25th Jul 2007 14:59
Here's a nice reflection thing I made using cube mapping:



+ Code Snippet
` setup
sync on : sync rate 60
set display mode 1024, 768, 32 : hide mouse
set camera range 1,0x7fffffff : autocam off
backdrop on : color backdrop 0


` Player
make object sphere 1, 100, 32, 32

` Create 6 cameras (one for each size)
for c=1 to 6
   make camera c
   color backdrop c, 0
   set camera range c, 1, 5000
   set camera to image c, c, 512, 512
next c

` Cube map player
set cube mapping on 1, 2, 4, 5, 6, 1, 3

` Create a world
make matrix 1, 10000, 10000, 50, 50
for b = 10 to 100

   make object sphere b, 100
   scl = rnd(300)
   scale object b, scl, rnd(1000), scl
   color object b, rgb( rnd(255), rnd(255), rnd(255) )
   position object b, rnd(10000), 0, rnd(10000)

next b




` Main loop
do

   ` Show FPS
   ink rgb(255, 255, 255), 0
   text 10, 10, str$(screen fps()) + " FPS at " + str$(statistic(1)) + " polygons"

   ` Control player
   y# = 50
   ay# = object angle y(1)
   x# = x# + (sin(ay#) * (upkey() - downkey()) * 10 )
   z# = z# + (cos(ay#) * (upkey() - downkey()) * 10 )
   yrotate object 1, wrapvalue( object angle y(1) + (rightkey() - leftkey()) )
   position object 1, x#, y#, z#


   ` Position player cameras
   position camera 1, x#, y#, z# + 50
   position camera 2, x# + 50, y#, z#
   position camera 3, x#, y#, z# - 50
   position camera 4, x# - 50, y#, z#
   position camera 5, x#, y# + 50, z#
   position camera 6, x#, y# - 50, z#

   ` Rotate cameras
   yrotate camera 1, ay#
   yrotate camera 2, ay# + 90
   yrotate camera 3, ay# + 180
   yrotate camera 4, ay# + 270
   xrotate camera 5, 270
   xrotate camera 6, 90


   ` Main Camera
   ca# = curveangle( ay#, ca#, 20.0 )
   cx# = x# - (sin(ca#) * 600)
   cy# = y# + 300
   cz# = z# - (cos(ca#) * 600)
   position camera cx#, cy#, cz#
   point camera x#, y#, z#


` Continue loop
sync
loop
Posted: 25th Jul 2007 17:32
Wow, that's a really nice reflection effect, Zotoaster!

Sorry that I haven't posted anything recently, I'm still trying to find a way to make water reflection. I'll post again when I find a way/discover an interesting effect.
Posted: 26th Jul 2007 1:53
Nice one Zotoaster!