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 Professional Discussion / Filtering a scene to one color?

Author
Message
TheComet
16
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 26th Jul 2010 20:26
Hi

What's the most efficient way to filter a render of the screen to one color? I was thinking of a night vision thing... When you put on the goggles, the whole scene turns green, and all other colors are filtered out. How could I do this?

There is one other problem... I would only like one camera to be able to filter the scene, and the other cameras would see everything in a normal view.

Thanks,

TheComet

HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 26th Jul 2010 20:44 Edited at: 26th Jul 2010 20:45
sync mask would be the one for saying which camera does the night render.

I thought I seen some where on here some memory block code for turning a screen to grey, might work for turning it red-ish edit [Err I mean green].

Dark Physics makes any hot drink go cold.
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 26th Jul 2010 21:45
If you're using lights then the simplest thing to do is to change the light colours. For example,



which would make the default light (light 0) and the ambient light both dark green.
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 26th Jul 2010 21:47
GG is correct. Even if you are using fx lighting, killing the red and blue component will give you what you are looking for.

The fastest code is the code never written.
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 27th Jul 2010 13:28
You could use a noise map created in GIMP (like the fuzzy effect on an untuned TV) on a ghosted plain to make it look like it's seen through the goggles too. Maybe use an overdone bloom effect too?

Van B
Moderator
21
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 27th Jul 2010 14:54
It depends on how you render your nightvision camera, if you could overlay that onto the screen as a sprite, then your home free.

All I would do is hide and show that sprite, but use SET SPRITE DIFFUSE Spr,0,255,0 to make it render only green. Having a lower res camera for night vision should be no problem, because you probably want a bit of blurring anyway. I would make a camera with a longer drawing range, but wouldn't change anything - I hate doing it that way, like changing the properties of objects, then having to change it all back again. Sprites are ideal, stretch a sprite over the screen, colour it how you want, even fade it in and out if you like.

Health, Ammo, and bacon and eggs!
Sixty Squares
17
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 27th Jul 2010 17:15 Edited at: 27th Jul 2010 22:18
Here's a night vision function, complete with static. You can adjust it to fit your needs. It basically does what VanB said only it adds static. This is probably possible with a fullscreen shader too if you don't want to use sprites. But sprites are easier to make an example of . You can make your own static texture if you want. This example generates its own at the start. If you don't want night vision on the screen then just don't call the function . It's fully commented, so if you want to adjust anything (like the color) just read the comments in the function.




Guns, cinematics, stealth, items and more!
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 27th Jul 2010 22:09
That's great sixty, with the right lighting and a bit of bloom to mimic the 'over-contrast' effect you get with night-vision that would look great!!

Very cheap on FPS too!

TheComet
16
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 27th Jul 2010 22:47
That's perfect, sixty []! Thanks a lot for everyone's help!

TheComet

Van B
Moderator
21
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 27th Jul 2010 22:48
Nice demo Sixty, just how I imagined it.

Health, Ammo, and bacon and eggs!
Sixty Squares
17
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 28th Jul 2010 02:35 Edited at: 28th Jul 2010 02:42
Thanks .

@baxslash: I'm not sure if bloom works on sprites. But this could always be added to the bloom shader itself...

I'll add it to the code snippets board. Credit to Van B for the Set Sprite Diffuse idea.


Guns, cinematics, stealth, items and more!
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 28th Jul 2010 11:43
Quote: "I'm not sure if bloom works on sprites. But this could always be added to the bloom shader itself..."

It doesn't but if you turn bloom on when night vision is on you'd get the effect surely?

HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 28th Jul 2010 13:31 Edited at: 28th Jul 2010 13:32
not as good a Sixty Squares but here's my version of doing it. just not could find away to rotate the image on object 101.



Dark Physics makes any hot drink go cold.

Login to post a reply

Server time is: 2024-04-28 10:00:29
Your offset time is: 2024-04-28 10:00:29