Author Topic: Ray of lights  (Read 6995 times)

Offline Albert

  • Dr. Type
  • ****
  • Posts: 257
    • View Profile
    • Blog
Re: Ray of lights
« Reply #15 on: 2011-Sep-28 »
For bloom we have to do some things.
First, we have to copy the whole screen and apply a tolerance (only keep the bright spots).
Second, we want to blur this copied screen.
Finally we can copy this screen over our original screen.
I couldn't found a fast algorithm for this. The only way to do the TOLERANCE and the BLUR is from shader. :(

Here is a test without any shader. I tuned up all the effect to see, but it's wrong and it's even worse if you start to move around the screen.



And if I switch on my Horizontal blur shader, then the shader works, but the scene falls apart. Why???



Here is the project in the attachment.
To enable the shader look here:
Code: GLBasic [Select]
                        //IF YOU USE THIS SHADER THE RENDER FALL APART??
                        //X_SETSHADER 13
                        DRAWSPRITE map[mx][my], cx, cy
                        //X_SETSHADER -1
 




[attachment deleted by admin]

Offline mentalthink

  • Prof. Inline
  • *****
  • Posts: 3366
  • Integrated Brain
    • View Profile
Re: Ray of lights
« Reply #16 on: 2011-Sep-28 »
Thanks Albert, I try more later, but have a good look.

 :nw: :nw: :nw:

Kinds Regards,
Iván J.

Offline mentalthink

  • Prof. Inline
  • *****
  • Posts: 3366
  • Integrated Brain
    • View Profile
Re: Ray of lights
« Reply #17 on: 2011-Sep-28 »
Albert, agains you do it, absolutely fantastic, it´s very very nice the effect image, and touching a little the parameters, you have a fake 8 bits effects, like a dirty image in a old CPC from de Asmtrad.

Thanks again.

Iván J.

Offline Albert

  • Dr. Type
  • ****
  • Posts: 257
    • View Profile
    • Blog
Re: Ray of lights
« Reply #18 on: 2011-Sep-29 »
Iván, if you can use this effect, then I would love to see what you can achieve it. So use it freely, if you manage to mix the parameters and get something fun, share with us.

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10715
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
Re: Ray of lights
« Reply #19 on: 2011-Sep-29 »
For a radial blur, there's an old technique that requires no shaders:
http://nehe.gamedev.net/tutorial/radial_blur__rendering_to_a_texture/18004/

Basicall he does:
-Render the blur objects to a texture.
-Optionally: Scale the texture down to 1/4 of the original size (for more speed)
-Draw the very same texture on itself like:
Code: GLBasic [Select]
USESCREEN 1
FOR i=0 TO 10
   ALPHAMODE 0.5
   ZOOMSPRITE 1, 0,0, 1.05, 1.05
NEXT
USESCREEN -1
 
-Draw that sprite now over the final scene
Code: GLBasic [Select]
ALPHAMODE 0.9
   STRETCHSPRITE 1, 0,0,screenx, screeny
 


You get the idea...

Offline Albert

  • Dr. Type
  • ****
  • Posts: 257
    • View Profile
    • Blog
Re: Ray of lights
« Reply #20 on: 2011-Sep-30 »
Thanks Gernot, this is what I'm used for the lightray algorithm just with some doublebuffering or what :)
But this NeHe tutorial gave me an idea to blur the screen without zooming, just displacing a bit. Here is my results:




Offline chve

  • Mr. Drawsprite
  • **
  • Posts: 65
    • View Profile
Re: Ray of lights
« Reply #21 on: 2011-Oct-30 »
I am new still in GLBasic forum and I have just donwloaded "Ray of lights" Albert.
It is awesome!!!  :good: :good: :good:


Congratulations!!

Offline Hatonastick

  • Dr. Type
  • ****
  • Posts: 474
  • Amstrad CPC 6128
    • View Profile
Re: Ray of lights
« Reply #22 on: 2011-Oct-30 »
Those examples are seriously cool!  Now I'm tempted to think up ways and programs I can use them in.  :good:
Mat. 5: 14 - 16

Android: Toshiba Thrive Tablet (3.2), Samsung Galaxy Tab 2 (4.1.2).
Netbook: Samsung N150+ Netbook (Win 7 32-bit + Ubuntu 11.10).
Desktop: Intel i5 Desktop with NVIDIA GeForce GTX 460 (Win 8.1 64-bit).