Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / Does anyone have a routine to fade the screen to black

Author
Message
MrTAToad
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 27th Oct 2002 01:54
..and can be used for any mode and resolution ?
Yes, I really am THAT good...
AsylumHunter
21
Years of Service
User Offline
Joined: 3rd Oct 2002
Location: United States
Posted: 27th Oct 2002 10:22
The best method I have found in these situations is to use gamma. Ramp it down using a for next loop, make your changes then ramp it back up. You can get some very smooth fades this way, with little overhead.


AsylumHunter

still falling out of my binary tree most evenings (hicup!)
Shock
AGK Developer
21
Years of Service
User Offline
Joined: 24th Oct 2002
Location: United Kingdom
Posted: 27th Oct 2002 12:31


www.shockforge.com ShockForge Software
www.havochost.com Unlim bandwdith, unlim space, you.havochost.com, you.s8i.com, visit site for more details.
...::::ShockForge::::...
MrTAToad
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 27th Oct 2002 12:37
Yes, unfortunately though not all graphics cards have a working gamma system...

Yes, I really am THAT good...
Shock
AGK Developer
21
Years of Service
User Offline
Joined: 24th Oct 2002
Location: United Kingdom
Posted: 27th Oct 2002 14:16
yes but most do.

if my onboard i810 2megs memory can handle it i think we're safe

www.shockforge.com ShockForge Software
www.havochost.com Unlim bandwdith, unlim space, you.havochost.com, you.s8i.com, visit site for more details.
...::::ShockForge::::...
The Darthster
21
Years of Service
User Offline
Joined: 25th Sep 2002
Location: United Kingdom
Posted: 27th Oct 2002 21:54
Gamma fading runs incredibly slowly on my GeForce 2 mx 400 for some reason. Only other ways I can think of are to use fading bitmaps, or alpha blended full-screen sprites, varying the black overlay transparency to fade in and out.
Shock
AGK Developer
21
Years of Service
User Offline
Joined: 24th Oct 2002
Location: United Kingdom
Posted: 27th Oct 2002 22:04
i dont know if you mean its your graphics card that slows it down, or if you mean the code.

the code i posted above

for x = 0 to 31
z = z - 8
set gamma z,z,z
next x

change the '-8' to change the speed (although the number has to fit into 256, and you have to specify the amount of times it fits into 256 for your for-next loop.

Time to grab out windows calculator i use it quite often when programming

www.shockforge.com ShockForge Software
www.havochost.com Unlim bandwdith, unlim space, you.havochost.com, you.s8i.com, visit site for more details.
...::::ShockForge::::...
The Darthster
21
Years of Service
User Offline
Joined: 25th Sep 2002
Location: United Kingdom
Posted: 27th Oct 2002 22:14
You could use:



instead, changing the step value and the order of the numbers to match the speed and direction. For example, if you want to fade to black change:

for i=255 to 0 step -8

I think it's my graphics card slowing it down, I've used gamma changes before and it ran slowly.
MrTAToad
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 27th Oct 2002 22:15
SET GAMMA doesn't seem to work on a GForce4 in Windows 98 for some reason, so I'll have to use a different method...

Yes, I really am THAT good...
Shadow Robert
21
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 28th Oct 2002 03:32
do you have Standard or Enhanced? if you have enhanced i'll make a simple DLL to access the backbuffer direct and produce the effect you want
you may want to checkout the extra's folder as if memory is correct that has one already made in the DLL provided - but then my memory oftenly forgets things

Anata aru kowagaru no watashi!
MrTAToad
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 28th Oct 2002 11:12
If you mean which version of DB I've got, then its DBPro... I was wondering about the DLL in the examples directory - its a little rough, but might be usable; although if you've got a smoother one, that would be handy.

Yes, I really am THAT good...
SFSW
21
Years of Service
User Offline
Joined: 9th Oct 2002
Location:
Posted: 28th Oct 2002 21:12
You could always use an inverse ghost and color a plain object right in front of the camera. This would work for a 3D scene and can be adjusted to work in various color depths (16-bit illustrated below).




sync on
sync rate 30

make object plain 47,10,10
color object 47,rgb(255,255,255)
ghost object on 47,1
position object 47,0,0,1
set object 47,1,1,1,1,0
color object 47,0

color backdrop 0

position camera 0,0,0
rotate camera 0,0,0


rem PUT YOUR SCENE HERE


rem fade out
for i = 0 to 255
fd=255-i
color object 47,rgb(fd,fd,fd)
sync
next i

MrTAToad
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 29th Oct 2002 00:32
That sounds interesting...

Yes, I really am THAT good...
QuothTheRaven
21
Years of Service
User Offline
Joined: 2nd Oct 2002
Location: United States
Posted: 29th Oct 2002 02:38
yeah sfs's is a step up, especially if you already have your gama set on another color.
SFSW
21
Years of Service
User Offline
Joined: 9th Oct 2002
Location:
Posted: 30th Oct 2002 07:24
You also don't want to alter any gamma settings in-game as it changes the default D3D setting the user may have specified. Trying to fade the screen using gamma, then resetting back to 255,255,255 will not restore the screen to full brightness if the user had specified anything other then 1.0 in their driver properties (meaning your game will be darker or lighter then it is supposed to be from that point on).

Login to post a reply

Server time is: 2024-04-20 15:31:34
Your offset time is: 2024-04-20 15:31:34