[HELP] Processing camera data menu

User Tag List

Results 1 to 8 of 8
  1. #1
    skra's Avatar Member
    Reputation
    1
    Join Date
    Apr 2009
    Posts
    33
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [HELP] Processing camera data

    Hi,
    i came across this thread a while ago, but i can't get this thing working. I've updated the offsets and from what i can tell it's reading the right values. Nevertheless i get totally absurd values as result. Therefor i've got 2 questions:

    1. What does the matrix (fViewMat) contain/represent?
    2. What is this math operation called, and why is fViewMat with the new values never used (assigning new values = pointless?) ?
    Code:
    	float fInv[3][3];
    	fInv[0][0] = camera.fViewMat[1][1]*camera.fViewMat[2][2]-camera.fViewMat[1][2]*camera.fViewMat[2][1];
    	fInv[1][0] = camera.fViewMat[1][2]*camera.fViewMat[2][0]-camera.fViewMat[1][0]*camera.fViewMat[2][2];
    	fInv[2][0] = camera.fViewMat[1][0]*camera.fViewMat[2][1]-camera.fViewMat[1][1]*camera.fViewMat[2][0];
    	float fDet = camera.fViewMat[0][0]*fInv[0][0]+camera.fViewMat[0][1]*fInv[1][0]+camera.fViewMat[0][2]*fInv[2][0];
    	float fInvDet = 1.0f / fDet;
    	fInv[0][1] = camera.fViewMat[0][2]*camera.fViewMat[2][1]-camera.fViewMat[0][1]*camera.fViewMat[2][2];
    	fInv[0][2] = camera.fViewMat[0][1]*camera.fViewMat[1][2]-camera.fViewMat[0][2]*camera.fViewMat[1][1];
    	fInv[1][1] = camera.fViewMat[0][0]*camera.fViewMat[2][2]-camera.fViewMat[0][2]*camera.fViewMat[2][0];
    	fInv[1][2] = camera.fViewMat[0][2]*camera.fViewMat[1][0]-camera.fViewMat[0][0]*camera.fViewMat[1][2];
    	fInv[2][1] = camera.fViewMat[0][1]*camera.fViewMat[2][0]-camera.fViewMat[0][0]*camera.fViewMat[2][1];
    	fInv[2][2] = camera.fViewMat[0][0]*camera.fViewMat[1][1]-camera.fViewMat[0][1]*camera.fViewMat[1][0];
    	camera.fViewMat[0][0] = fInv[0][0]*fInvDet;
    	camera.fViewMat[0][1] = fInv[0][1]*fInvDet;
    	camera.fViewMat[0][2] = fInv[0][2]*fInvDet;
    	camera.fViewMat[1][0] = fInv[1][0]*fInvDet;
    	camera.fViewMat[1][1] = fInv[1][1]*fInvDet;
    	camera.fViewMat[1][2] = fInv[1][2]*fInvDet;
    	camera.fViewMat[2][0] = fInv[2][0]*fInvDet;
    	camera.fViewMat[2][1] = fInv[2][1]*fInvDet;
    	camera.fViewMat[2][2] = fInv[2][2]*fInvDet;
    	float fView[3];
    	fView[0] = fInv[0][0]*fDiff[0]+fInv[1][0]*fDiff[1]+fInv[2][0]*fDiff[2];
    	fView[1] = fInv[0][1]*fDiff[0]+fInv[1][1]*fDiff[1]+fInv[2][1]*fDiff[2];
    	fView[2] = fInv[0][2]*fDiff[0]+fInv[1][2]*fDiff[1]+fInv[2][2]*fDiff[2];
    Thanks for your help!

    [HELP] Processing camera data
  2. #2
    dekz's Avatar Member
    Reputation
    5
    Join Date
    Jan 2008
    Posts
    37
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Without looking at any other code, I can only asume fViewMat is the View Matrix, which you need to set every time your camera changes position.

    There are also 3 matrices needed, world, view and projection. (SO it can properly transfrom geometry)

    Correct me if I'm wrong because its quite probable.

  3. #3
    skra's Avatar Member
    Reputation
    1
    Join Date
    Apr 2009
    Posts
    33
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    well i have the camera position, the object position, a field of view float and the view matrix. that's 1 matrix, 1 float, and 2 "vectors" but not "3 matrices " =/ perhapse some of the other matrices can be created out of that data but i don't know how

  4. #4
    dekz's Avatar Member
    Reputation
    5
    Join Date
    Jan 2008
    Posts
    37
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I am not experienced in camera projections so be wary, but hopefully this may help you a little.

    I think (without an in depth look) that the math you are talking about is the mapping of a 3d point in the world to a 2d plane. You may find more info with a Camera matrix search

  5. #5
    Robske's Avatar Contributor
    Reputation
    305
    Join Date
    May 2007
    Posts
    1,062
    Thanks G/R
    3/4
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think this was mentioned in one of those 3D->2D threads
    3D projection - Wikipedia, the free encyclopedia
    "Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live." - Martin Golding
    "I cried a little earlier when I had to poop" - Sku

  6. #6
    skra's Avatar Member
    Reputation
    1
    Join Date
    Apr 2009
    Posts
    33
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok thanks everyone! that pointed me in the right direction. i'm getting better values now. however they are still not correct and so i'm not sure i'm reading the matrix out of memory correct. The numbers represent the offsets from the beginning of the matrix block i'm reading:

    Code:
    0 | 12 | 24 
    4 | 16 | 28
    8 | 20 | 32
    or should i read it like this?

    Code:
    0 | 4 | 8
    12 | 16 | 20
    24 | 28 | 32

  7. #7
    YetiHunter's Avatar Member
    Reputation
    6
    Join Date
    Aug 2006
    Posts
    57
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks that solved my problem as well
    btw: you have to read the matrix the second way

  8. #8
    skra's Avatar Member
    Reputation
    1
    Join Date
    Apr 2009
    Posts
    33
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks alot!

Similar Threads

  1. [help] Process Handle and multithreading
    By Myryador in forum WoW Memory Editing
    Replies: 4
    Last Post: 11-03-2011, 12:41 AM
  2. [Help] Search for data in binary file
    By Fenryr in forum Programming
    Replies: 5
    Last Post: 11-08-2008, 01:24 PM
  3. Need help with putting Mpqs into Data folder, not working!!!
    By Korey16 in forum WoW ME Questions and Requests
    Replies: 2
    Last Post: 12-26-2006, 12:15 PM
  4. HELP! Can't find data file!!
    By Rekro in forum WoW ME Questions and Requests
    Replies: 2
    Last Post: 12-25-2006, 11:42 PM
All times are GMT -5. The time now is 01:31 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search