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 / "Save" camera image(not to file) for ghosted vision flashbang

Author
Message
TuPP3
19
Years of Service
User Offline
Joined: 26th Jan 2007
Location: [+--]FINLAND
Posted: 20th Mar 2011 15:22 Edited at: 20th Mar 2011 15:24
So how can I save current screen to image/sprite so I can apply it ghosted over the main camera for flashbang effect?
I'm currently using get image, which does the job correctly, but getting 1920x1080 image is slow and game freezes for 1-2 secs when I call get image for the whole screen.
I also tried set camera to image, but it keeps updating the sprite with the main camera so I won't get much ghosting effect.
I pretty much ran out of ideas, there must be a way to save my rendered image so I could use it later...
I also tried save image and load image, but it takes even more time.
The image doesn't really have to be 1920x1080, it could be half or 1/4 of that size, but I can't even figure out how to resize it to achieve faster resoults.

This effect I'm after, this is with get image which would do well if there wasn't be any delay.
http://i160.photobucket.com/albums/t187/TuPP3/Sniper2011-03-2013-44-21-58.png?t=1300626009
(obviously that grenade is way misplaced there, it is just placeholder)
Quel
17
Years of Service
User Offline
Joined: 13th Mar 2009
Location:
Posted: 20th Mar 2011 16:00
Can't the "set camera to image" command be used for just a single frame? That would be some serious defect there...
TuPP3
19
Years of Service
User Offline
Joined: 26th Jan 2007
Location: [+--]FINLAND
Posted: 20th Mar 2011 16:09 Edited at: 20th Mar 2011 16:09
As far as I know, set camera to image has to be called only once and it will keep on updating the camera to the image by itself.
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 20th Mar 2011 16:33
Use a separate camera for it and only update that camera when you need to. You can use the sync mask command for that. For example



If it's only to be done once, i.e. before the main loop, then render just that camera before the main loop in the same way.
TuPP3
19
Years of Service
User Offline
Joined: 26th Jan 2007
Location: [+--]FINLAND
Posted: 20th Mar 2011 17:51
Isn't making another camera just for that heavy, even if you don't update it but only once when needed?
Does it take any more memory, cpu cycles or something, even if it's not updated?
It's simple that way though... I already have 5 cameras...
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 20th Mar 2011 17:59
Quote: "Isn't making another camera just for that heavy, even if you don't update it but only once when needed?"


Yes, but I'm fairly sure it's only a problem when the camera is actually rendered. I would expect the overhead to be negligible when the camera isn't being rendered. IanM would know for certain though.

If set camera to image could be turned off then you wouldn't need an extra camera. I don't know whether that's possible though.
Van B
Moderator
23
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 21st Mar 2011 00:22
Might be handy to have the extra camera for other effects though. For example, position and update it with a security camera object position then texture the image onto a 3D screen object. Or use it for night vision by extending the camera range and setting the diffuse of an overlay sprite. You could even use it on the scope of a rifle.

Health, Ammo, and bacon and eggs!

Login to post a reply

Server time is: 2026-07-17 14:13:14
Your offset time is: 2026-07-17 14:13:14