Welcome, Guest Wednesday 16th April 2014, 23:37:58
   Home   Help Search Login Register  

OFPEC Forum

Author Topic: camPreload  (Read 382 times)
0 Members and 1 Guest are viewing this topic.
Binary
*
Offline Offline


« on: 16 Aug 2009, 13:25:16 »

Hello folks Smiley

I'm getting a bit into making cutscenes - but camPreload is a command that i still don't quite get.
I'm not sure how or where to insert it into my existing cutscene (which suffers quite a bit from texture lag).

I would really apreciate if anyone could explain where i should insert the camPreload command ?

 Smiley

My intro.sqs
Code:
;TURN ON CAMERA
_camera = "camera" camCreate [11843,12573,8]
_camera cameraEffect ["internal","back"]

;PLAY MUSIC
playmusic "HELL MARCH"

;SHOW PICTURE
TitleRsc["INTRO1","PLAIN"]

;FIRST TARGET (A BIT OF TEXTURE LAG)
_camera camPrepareTarget [-64701.92,80217.75,7449.45]
_camera camPreparePos [7291.32,11232.77,11.56]
_camera camPrepareFOV 0.700
_camera camCommitPrepared 0
@camCommitted _camera
~6

;=== 15:33:37
_camera camPrepareTarget [-67068.63,77369.32,-10067.30]
_camera camPreparePos [7211.21,11176.65,81.13]
_camera camPrepareFOV 0.700
_camera camCommitPrepared 6
_camera camcommit 6
@camCommitted _camera
~8

;=== 15:34:12
_camera camPrepareTarget [63957.96,84672.30,-36404.20]
_camera camPreparePos [6821.68,11313.08,67.37]
_camera camPrepareFOV 0.700
_camera camCommitPrepared 4
@camCommitted _camera
~6

;=== 14:15:34
_camera camPrepareTarget [-38268.65,59583.93,-75092.64]
_camera camPreparePos [6917.59,11414.05,48.88]
_camera camPrepareFOV 0.905
_camera camCommitPrepared 5
@camCommitted _camera
~7

;SECOND TARGET (A BIT OF TEXTURE LAG)
_camera camPrepareTarget [37572.84,105491.93,-15429.41]
_camera camPreparePos [9910.82,10642.87,3.77]
_camera camPrepareFOV 0.700
_camera camCommitPrepared 0
@camCommitted _camera
~6

;THIRD TARGET (A LOT OF TEXTURE LAG)
_camera camPrepareTarget [-82434.69,-5361.69,-27087.93]
_camera camPreparePos [12138.13,12652.10,13.18]
_camera camPrepareFOV 0.700
_camera camCommitPrepared 0
@camCommitted _camera
~6

;FOURTH TARGET (A LOT OF TEXTURE LAG)
_camera camPrepareTarget [41525.03,-78210.12,-36728.36]
_camera camPreparePos [9382.29,8931.19,5.02]
_camera camPrepareFOV 0.700
_camera camCommitPrepared 0
@camCommitted _camera
~4

;FIFTH TARGET (A LOT OF TEXTURE LAG)
_camera camPrepareTarget [62022.48,-55111.23,-55350.61]
_camera camPreparePos [9335.23,9016.99,87.56]
_camera camPrepareFOV 0.700
_camera camCommitPrepared 5
@camCommitted _camera
~6

;=== 16:09:39
_camera camPrepareTarget [103939.52,37540.20,-29342.79]
_camera camPreparePos [12529.42,9616.85,53.39]
_camera camPrepareFOV 0.530
_camera camCommitPrepared 0
@camCommitted _camera
~4

;=== 16:10:06
_camera camPrepareTarget [39708.00,102500.14,-25076.13]
_camera camPreparePos [12679.07,9519.16,35.61]
_camera camPrepareFOV 0.530
_camera camCommitPrepared 6
@camCommitted _camera
~8

;SHUT OFF CAMERA
player cameraEffect ["terminate","back"]
camDestroy _camera

;FADE MUSIC
8 fadeMusic 0

;CHANGE TIME
skiptime -2

exit
Logged

"Ah.. Home sweet hell !" - Al Bundy
Mandoble
Editors Depot
Administrator
*****
Offline Offline



WWW
« Reply #1 on: 16 Aug 2009, 15:33:46 »

Hi Binary,
I've not used it, but I assume it preloads whatever its needed to render a scene before you commit the camera.

What I guess is that while you are watching a scene (after committing a camera) you may set the camera parameters for the next one, then before commiting the new cam parameters you execute that camPreload and wait until it is preloaded checking the condition with ?(camPreloaded _cam), once preloaded you commit the camera. Might be the effect is just smooth transitions between a camera position/configuration and the next one.
Logged

Worldeater
Editors Depot
Administrator
*****
Offline Offline


Suum cuique


« Reply #2 on: 16 Aug 2009, 15:36:44 »

Well, you're jumping from one point on the map to another. The engine has no time to load all the objects and textures for the new scene. Without giving the engine some time your problem can't be solved.

You could try something like this:

1. Blank the screen and create the camera
2. Use camPreload without a timeout
3. Wait until it's done
4. Use preloadCamera on the next location (let's call it "Scenery2")
5. Show current scenery until preloadCamera for "Scenery2" is done
6. Use preloadCamera on the next location (let's call it "Scenery3")
7. Show "Scenery2" until preloadCamera for "Scenery3" is done
6. Use preloadCamera on the next location (let's call it "Scenery4")
7. Show "Scenery3" until preloadCamera for "Scenery4" is done
8. etc.

This might ruin your timings, however, since you cannot tell how long it will take the engine to preload stuff.

Another approach would be to blank the screen, preload all locations, pray that the user has enough RAM to store the whole stuff, wait until all locations are preloaded and continue.
Logged

try { return true; } finally { return false; }
Mandoble
Editors Depot
Administrator
*****
Offline Offline



WWW
« Reply #3 on: 16 Aug 2009, 15:46:11 »

Worldeater, not sure if both commands are the same, but he is referring to camPreload not to preloadCamera. preloadCamera will preload textures around a position, while camPreload has no position as argument, just the camera.
Logged

Worldeater
Editors Depot
Administrator
*****
Offline Offline


Suum cuique


« Reply #4 on: 16 Aug 2009, 17:46:09 »

Well, camPreload is useless when you're already displaying a scene. It will make the engine do what the engine does anyway: load stuff. So if you don't hide the scene you'll notice no difference.

It's only useful when you blank the screen while it's working and wait until it's done (using camPreloaded). At least that's how I think it's working. Corrections are always welcome.

When you're already displaying a scene and want to preload the next scene in the background you have to use preloadCamera. And that's pretty much what needs to be done to solve the problem.
Logged

try { return true; } finally { return false; }
Binary
*
Offline Offline


« Reply #5 on: 20 Aug 2009, 18:09:29 »

Thank you for your answers Smiley

I never got around to implementing it in the specific cutscene as I had a deadline on the mission, but i will experiment with preload-commands on my next mission and post the results here Smiley
Logged

"Ah.. Home sweet hell !" - Al Bundy
Pages: [1]   Go Up
  Send this topicPrint  
 
Jump to: