jnonline / ogstudio

Automatically exported from code.google.com/p/ogstudio
0 stars 0 forks source link

Cameratracks mechanics #417

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Нужна возможность работы с камератреками.

А именно - возможность задать в файле сцены 
(или отдельном файле) поледовательность 
точек-нод в сцене, через которые должна 
пролететь камера.

Для каждой ноды в последовательности 
необходимо задать позицию, направление 
камеры, время перехода (время за которое 
камера переместится из предыдйщей ноды в 
данную).

Для самой последовательности необходимо 
задавать тип интерполяции.

Для маджонга нужны будут пять камератреков:
1. Старт игры
2. Пауза
3. Выход из паузы
4. Победа
5. Поражение

Во время проигрывания камератреков 
необходимо отключать игровой автодоворот 
камеры.

Original issue reported on code.google.com by Kai.Saerthen.Darker on 18 Dec 2011 at 10:31

GoogleCodeExporter commented 9 years ago

Original comment by Kai.Saerthen.Darker on 16 Feb 2012 at 9:04

GoogleCodeExporter commented 9 years ago
We need linear and Hermite interpolations. Hermite one is useful for "rounding 
angles".

Original comment by korn...@gmail.com on 30 Apr 2012 at 8:51

GoogleCodeExporter commented 9 years ago
http://people.sc.fsu.edu/~jburkardt/cpp_src/hermite/hermite.html
http://people.sc.fsu.edu/~jburkardt/cpp_src/spline/spline.html

Original comment by korn...@gmail.com on 30 Apr 2012 at 8:54

GoogleCodeExporter commented 9 years ago
http://forums.indiegamer.com/showthread.php?4905-Teach-me-splines-for&p=66079#po
st66079
http://www.ogre3d.org/docs/api/html/classOgre_1_1SimpleSpline.html

Original comment by korn...@gmail.com on 1 May 2012 at 11:40

GoogleCodeExporter commented 9 years ago
http://www.mvps.org/directx/articles/catmull/

Original comment by korn...@gmail.com on 1 May 2012 at 12:14

GoogleCodeExporter commented 9 years ago
Is Catmull-Rom enough for us? What is "направление камеры"?

Original comment by korn...@gmail.com on 1 May 2012 at 12:27

GoogleCodeExporter commented 9 years ago
Выглядит достаточным.
Направление камеры это точка в которую 
смотрит камера ИЛИ поворот камеры. Пока 
делай как тебе проще, в будущем нужно будет 
поддержать оба варианта задания 
направления для разных типов камератреков.

Original comment by Kai.Saerthen.Darker on 1 May 2012 at 7:22

GoogleCodeExporter commented 9 years ago
Since C-R algorithm takes t from 0.0 to 1.0, the formula to convert time to f 
is calculated like this.
Suppose, we have 5 seconds time for interpolation. That means that 0f = 0t, and 
1f = 5t, i.e., f(t) = t/5, where 5 is the specified time.
Thus we have:
f(t) = t/tmax.

Original comment by korn...@gmail.com on 6 May 2012 at 12:45

GoogleCodeExporter commented 9 years ago
I need to implement C-R interpolation in MJIN and add a new test. Or two tests 
(for Linear one too).

Original comment by korn...@gmail.com on 6 May 2012 at 12:47

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Start with CatmullRomSpline class.

Original comment by korn...@gmail.com on 6 May 2012 at 12:52

GoogleCodeExporter commented 9 years ago
I can see some tangent recalculation in Ogre C-R implementation, but after 
reading at MVP I can't get what they are for. Skip them for now. I will return 
if my class won't work.

Original comment by korn...@gmail.com on 6 May 2012 at 12:58

GoogleCodeExporter commented 9 years ago
Continue.

Original comment by korn...@gmail.com on 6 May 2012 at 1:26

GoogleCodeExporter commented 9 years ago
Class is ready. Test it.

Original comment by korn...@gmail.com on 7 May 2012 at 4:40

GoogleCodeExporter commented 9 years ago
Fix CR impl so that non-passable (ending) points are generated automatically 
(pnext - prev).

Original comment by korn...@gmail.com on 8 May 2012 at 7:56

GoogleCodeExporter commented 9 years ago
Continue with CatmullRomSpline::genAllPoints.

Original comment by korn...@gmail.com on 8 May 2012 at 8:08

GoogleCodeExporter commented 9 years ago
Done. Looks fine to me: http://www.youtube.com/watch?v=_BxUwSGgSmM

Now I need to implement scene nodes.

Original comment by korn...@gmail.com on 8 May 2012 at 9:00

GoogleCodeExporter commented 9 years ago
Before that, make it accept up to 6 values to interpolation, since camera 
tracks will have 3 values for position, and 3 values for rotation.

Original comment by korn...@gmail.com on 8 May 2012 at 1:55

GoogleCodeExporter commented 9 years ago
No, first make up the format, since this time interpolations will only be used 
for Camera tracks, thus, it's faster done by somewhat hard coding.

Original comment by korn...@gmail.com on 9 May 2012 at 8:34

GoogleCodeExporter commented 9 years ago
Also, add printing of camera pos + rot on some key for easier camera track 
assembly.

Original comment by korn...@gmail.com on 9 May 2012 at 8:38

GoogleCodeExporter commented 9 years ago
Ok. Format has been already given some thought in the past, and it's fine.
I should only rename it's from Track to CameraTrack and add smth like 
addCameraTrack method to Camera, along with a way to start/stop certain camera 
track by name.

I need to think about CameraTrack class. May be I should change 
CatmullRomSpline to interpolate only one variable? Think.

Original comment by korn...@gmail.com on 9 May 2012 at 8:48

GoogleCodeExporter commented 9 years ago
Create Sequence class which accepts points and can select interpolation type.

Original comment by korn...@gmail.com on 9 May 2012 at 8:54

GoogleCodeExporter commented 9 years ago
Nah. Let it be CameraTrack with position and rotation. Otherwise it can't be 
automated to accept any number of values.

Original comment by korn...@gmail.com on 9 May 2012 at 9:08

GoogleCodeExporter commented 9 years ago
Try to make ending points the same as specified ones. Looks like it won't make 
anything bad.

Original comment by korn...@gmail.com on 9 May 2012 at 9:11

GoogleCodeExporter commented 9 years ago
Continue with Sequence.

Original comment by korn...@gmail.com on 9 May 2012 at 9:40

GoogleCodeExporter commented 9 years ago
Sequence done. testSequence shows None, Linear, and Spline fine.
Now back to CameraTrack and how we're gonna bind it with Sequence.

Original comment by korn...@gmail.com on 9 May 2012 at 12:50

GoogleCodeExporter commented 9 years ago
Scene should load Tracks.
And CameraTrack should accept Camera and Scene. Then 
CameraTrack::startSequence("Name") will be launching sequence read by Scene for 
Camera.

Left:
1) Scene: read Tracks;
2) CameraTrack implementation.

Original comment by korn...@gmail.com on 9 May 2012 at 1:30

GoogleCodeExporter commented 9 years ago
Scene can now read CameraTracks. There's no need to save CameraTrack, because 
of the coming changes in the future.
Left:
2) CameraTrack impl.

Original comment by korn...@gmail.com on 9 May 2012 at 2:28

GoogleCodeExporter commented 9 years ago
Due to new PC, build MJ/MJIN here.

Original comment by korn...@gmail.com on 16 May 2012 at 2:22

GoogleCodeExporter commented 9 years ago
MJIN compiled. MJ needs fixing after I finish it since I didn't yet fix Timer 
usage.

Original comment by korn...@gmail.com on 16 May 2012 at 3:04

GoogleCodeExporter commented 9 years ago
Tests that render Scene in OGRE don't work on my new PC. Mahjong 0.9.1 works 
perfect. Amazing.

I should fix MJ with Timer to see if it will run on my PC.

Original comment by korn...@gmail.com on 16 May 2012 at 4:13

GoogleCodeExporter commented 9 years ago
If MJ doesn't run, copy ogre,cegui,etc libs from previous PC to current one. No 
time to search for problems. Especially in OGRE.

Original comment by korn...@gmail.com on 18 May 2012 at 11:46

GoogleCodeExporter commented 9 years ago
Doesn't work. The same problem with OGRE:
Program received signal SIGSEGV, Segmentation fault.
0x00000000000009b0 in ?? ()
(gdb) bt
#0  0x00000000000009b0 in ?? ()
#1  0x00007ffff6db44f7 in Ogre::Entity::getShadowVolumeRenderableIterator 
(this=0x4082ed0, 
    shadowTechnique=<optimized out>, light=0x4083580, indexBuffer=0x1b38f80, extrude=false, 
    extrusionDistance=99850, flags=6) at /home/kornerr/rep/ogre/OgreMain/src/OgreEntity.cpp:1997
#2  0x00007ffff6f1c987 in Ogre::SceneManager::renderShadowVolumesToStencil 
(this=0x1b34a60, 
    light=0x4083580, camera=0x1a16340, calcScissor=<optimized out>)
    at /home/kornerr/rep/ogre/OgreMain/src/OgreSceneManager.cpp:5590
#3  0x00007ffff6f10acc in 
Ogre::SceneManager::renderModulativeStencilShadowedQueueGroupObjects (
    this=0x1b34a60, pGroup=0x41f5970, om=Ogre::QueuedRenderableCollection::OM_PASS_GROUP)
    at /home/kornerr/rep/ogre/OgreMain/src/OgreSceneManager.cpp:2474
#4  0x00007ffff6eb3c92 in 
Ogre::SceneManager::renderVisibleObjectsDefaultSequence (this=0x1b34a60)
    at /home/kornerr/rep/ogre/OgreMain/src/OgreSceneManager.cpp:2316
#5  0x00007ffff6f07ed9 in Ogre::SceneManager::_renderScene (this=0x1b34a60, 
camera=0x1a16340, vp=
    0x16317e0, includeOverlays=<optimized out>)
    at /home/kornerr/rep/ogre/OgreMain/src/OgreSceneManager.cpp:1529
#6  0x00007ffff6d7a03c in Ogre::Camera::_renderScene (this=0x1a16340, 
vp=0x16317e0, 
    includeOverlays=false) at /home/kornerr/rep/ogre/OgreMain/src/OgreCamera.cpp:426
#7  0x00007ffff6e9c4b8 in Ogre::RenderTarget::_updateViewport (this=0x1c58aa0, 
viewport=0x16317e0, 
    updateStatistics=true) at /home/kornerr/rep/ogre/OgreMain/src/OgreRenderTarget.cpp:199
#8  0x00007ffff6e9af4b in Ogre::RenderTarget::_updateAutoUpdatedViewports 
(this=0x1c58aa0, 
    updateStatistics=true) at /home/kornerr/rep/ogre/OgreMain/src/OgreRenderTarget.cpp:177
#9  0x00007ffff6e978be in Ogre::RenderTarget::updateImpl (this=0x1c58aa0)
    at /home/kornerr/rep/ogre/OgreMain/src/OgreRenderTarget.cpp:154
#10 0x00007ffff6eb65cc in Ogre::RenderTarget::update (this=0x1c58aa0, 
swap=false)
    at /home/kornerr/rep/ogre/OgreMain/src/OgreRenderTarget.cpp:611
---Type <return> to continue, or q <return> to quit---
#11 0x00007ffff6e9a37f in Ogre::RenderSystem::_updateAllRenderTargets 
(this=0x797320, 
    swapBuffers=false) at /home/kornerr/rep/ogre/OgreMain/src/OgreRenderSystem.cpp:122
#12 0x00007ffff6f0894a in Ogre::Root::_updateAllRenderTargets 
(this=this@entry=0x77d2b0)
    at /home/kornerr/rep/ogre/OgreMain/src/OgreRoot.cpp:1403
#13 0x00007ffff6f08a10 in Ogre::Root::renderOneFrame (this=0x77d2b0)
    at /home/kornerr/rep/ogre/OgreMain/src/OgreRoot.cpp:988
#14 0x00007ffff69ce2c1 in mjin::Window::onTimerTick (this=0x8b2df0)
    at /home/kornerr/p/mjin/src/mjin/Window.cpp:88
#15 0x00007ffff69cd91d in mjin::Timer::update (this=0x8b2d90)
    at /home/kornerr/p/mjin/src/mjin/Timer.cpp:111
#16 0x0000000000495cae in mj::Application::run (this=0x7fffffffe050)
    at /home/kornerr/p/mj/src/mj/Application.cpp:140
#17 0x00000000004939cf in main (argc=3, argv=0x7fffffffe2d8) at 
/home/kornerr/p/mj/src/main.cpp:44

Original comment by korn...@gmail.com on 18 May 2012 at 11:55

GoogleCodeExporter commented 9 years ago
Better yet: take 0.9.2 libraries which are known to work 100%.

Original comment by korn...@gmail.com on 18 May 2012 at 11:58

GoogleCodeExporter commented 9 years ago
Those libs work fine.

Time to write CameraTrack test.

Original comment by korn...@gmail.com on 18 May 2012 at 12:23

GoogleCodeExporter commented 9 years ago
Test done: http://www.youtube.com/watch?v=dIe0-ZfQ46w
Works fine, but there exist gimbal lock issues which should be carefully 
avoided.

Now to make it into Mahjong.

Original comment by korn...@gmail.com on 18 May 2012 at 1:27

GoogleCodeExporter commented 9 years ago
looks good

Original comment by Kai.Saerthen.Darker on 18 May 2012 at 8:22

GoogleCodeExporter commented 9 years ago
Not clear how to be with Pause, Unpause, Loss, Victory camera tracks, because 
the scene is hidden in these states.

Original comment by korn...@gmail.com on 19 May 2012 at 7:03

GoogleCodeExporter commented 9 years ago
Start: MainCore::onGameStart.
Pause/Unpause: MainCore::setActive.
Loss/Victory: MainCore::onGameStateChange(LOSS,VICTORY).

Original comment by korn...@gmail.com on 19 May 2012 at 7:08

GoogleCodeExporter commented 9 years ago
Implemented camera track "Start" sequence. Example in Room scene.

Original comment by korn...@gmail.com on 19 May 2012 at 8:38

GoogleCodeExporter commented 9 years ago
For other states we should not hide the scene. Try make it visible to some 
extent.

Original comment by korn...@gmail.com on 20 May 2012 at 2:06

GoogleCodeExporter commented 9 years ago
We should simply shade the scene by half instead of displaying an image.

Original comment by korn...@gmail.com on 21 May 2012 at 9:52

GoogleCodeExporter commented 9 years ago
Added MenuBackgroundTransparent.png image which only contains text.

There's also a bug with startup sequence: after stopping it re-enables dynamic 
camera, if we've paused the game, it re-enables it during that pause.

Original comment by korn...@gmail.com on 21 May 2012 at 10:17

GoogleCodeExporter commented 9 years ago
The bug will be solved separately: issue 482.

Continue with implementing pause/unpause sequences.

Original comment by korn...@gmail.com on 21 May 2012 at 10:23

GoogleCodeExporter commented 9 years ago
All sequences except for quit one have been implemented.

Original comment by korn...@gmail.com on 22 May 2012 at 12:48

GoogleCodeExporter commented 9 years ago
There's a problem with Victory/Loss textures however. Due to bug issue 483 
Victory/Loss texture is defined by Classic since it's the first theme. To see 
Distro's theme you have to move Classic somewhere else so that Distros become 
the first.

As for quit sequence, I'm not sure if we want to hold user for long.

Original comment by korn...@gmail.com on 22 May 2012 at 12:53

GoogleCodeExporter commented 9 years ago

Original comment by korn...@gmail.com on 22 May 2012 at 12:54

GoogleCodeExporter commented 9 years ago
Fixed overlay bug. Only SCC left.

Original comment by korn...@gmail.com on 22 May 2012 at 5:59

GoogleCodeExporter commented 9 years ago
Fixed SCC.

Original comment by korn...@gmail.com on 23 May 2012 at 12:31

GoogleCodeExporter commented 9 years ago
Done.

Original comment by korn...@gmail.com on 23 May 2012 at 12:34