Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

CamBaseCamera class#1252

kagikn started this conversation inIdeas
Jul 1, 2023· 2 comments· 1 reply
Discussion options

I'm considering adding theCamBaseCamera orBaseCamera class so you can fetch camera info from the active camera in the game, but NOT limited to scripted camera like howGET_RENDERING_CAM returns. Any questions, suggestions, or potentially ideas? Please refrain from suggesting what new features SHVDN camera classes should have without stuff obtained by reverse engineering the exe in this discussion.

There'scamBaseCamera and the pool forcamBaseCamera instance. The game uses pool handles for scripted camera handles, just like howCEntity handles are created and how we use entity (strictlyCPhysical) handles via native functions, but the game also stores gameplay camera instance (notcamBaseDirector ones) to the same pool.
The problem is, not all existing members ofCamera class can use with non-scripted camera handles. Some of the camera natives that takes a cam handle can work properly only with scripted cam handles since they also access thecamScriptDirector instance or some other script cam variables, such asSET_CAM_ACTIVE. While others such asGET_CAM_FAR_DOF can work with arbitrary cam handles without any potential issues such as pointer malformation, meaning they access only the members ofcamBaseCamera. That is why I prefer the class forcamBaseCamera as a new class over treating existingCamera class as the base cam class in v3 API, although you won't be able to recognize existingCamera class as scripted cams too quickly. We'll make a class likeScriptedCamera orCamScriptedCamera so you can recognize the scripted camera class in v4, though.

We can introduce the newCamBaseCamera as the base class of existingCamera, but I believe we shouldn't addsealed keyword for the new class so we can add subclasses that represents some of the subclasses ofcamBaseCamera such ascamFollowPedCamera.

For those wondering how to fetch thecamBaseCamera pool address and the functions for activecamBaseCamera address:

IntPtrpatternAddr=Game.FindPattern("45 8B C8 4D 85 DB 7E 59 49 8B 42 08 42 0F B6 14 08");IntPtrptrToptrToCamBaseCameraPool=(patternAddr+*(int*)(patternAddr-11)-7);// use GenericPool interface in NativeMemory to mess withpatternAddr=Game.FindPattern("44 0F 29 40 A8 E8 ? ? ? ? 45 33 ED 48 8B D8 48 85 C0 0F 84");(delegate* unmanaged[Stdcall]<IntPtr>)getActiveCamera=(delegate* unmanaged[Stdcall]<IntPtr>)(patternAddr+*(int*)(patternAddr+6)+10);// gets the active camBaseCamera address
You must be logged in to vote

Replies: 2 comments 1 reply

Comment options

Hi@kagikn !
I'm currently attempting to align point cloud data from RGBD collected in GTA-V. However, I'm struggling to find the appropriate intrinsic matrices. Moreover, I've been unable to locate the extrinsic matrix necessary to accurately transform the depth image to world coordinates. I suspect the depth images might not be in the camera coordinates, which means I can't directly apply the camera parameters for the transformation. Are there any chances in your latest powerful scripthook to acquire the correctintrinsic matrix of default camera and thetransformation matrix of from depth coords to World?(I guess I miss the NDC to World matrix) Any insights or experience you could share would be greatly appreciated. Thank you in advance

You must be logged in to vote
1 reply
@kagikn
Comment options

kagiknOct 31, 2023
Maintainer Author

Hi!
I am afraid that your question does not fit into this discussion. This discussion is about camera classes with stuff obtained by reverse engineering the exe. Since you have created a dedicated issue in#1335 (though I converted into a discussion), we can talk in there.

Comment options

kagikn
Dec 13, 2023
Maintainer Author

We know whatcamBaseCamera has now. Maybe more stuff have been added since a build in 2022 though. And no,camBaseCamera doesn't have any info about lookat or attach parent info except for a lookat target entity or an attach parent (camScriptedCamera has).

This is whatcamBaseCamera has as its data:

classcamBaseCamera :publiccamBaseObject {int m_NumUpdatesPerformed;// 0x20    camFrame *m_Frame;// 0x30    camFrame *m_PostEffectFrame;// 0x110    rage::atArray<rage::fwRegdRef<camBaseFrameShaker,rage::fwRefAwareBase>,0,unsignedshort> m_FrameShakers;// 0x1F0uintptr_t m_FrameInterpolator;// 0x200uintptr_t m_DofSettings;// 0x208    rage::fwRegdRef<camCollision,rage::fwRefAwareBase> m_Collision;// 0x210uintptr_t m_Metadata;// 0x218    rage::fwRegdRef<CEntityconst ,rage::fwRefAwareBase> m_AttachParent;// 0x220    rage::fwRegdRef<CEntityconst ,rage::fwRefAwareBase> m_LookAtTarget;// 0x228// _bf230 at 0x230};// size: 0x240

camBaseObject definition for its data (we don't have no real useful members in here):

classcamFrame :publicrage::fwRefAwareBase {uintptr_t m_Metadata;// 0x10uintptr_t m_WidgetGroup;// 0x18};// size: 0x20

For those wondering whatfwRegdRef does, it holds a reference.rage::fwRefAwareBaseImpl<rage::datBase>, which is the direct direct base class ofrage::fwRefAwareBase, holds known references and drop its stuff when it stops tracking any references.

camFrame definition for its data:

classcamFrame :publicrage::fwRefAwareBase {    rage::Matrix34 m_WorldMatrix;// 0x10    rage::Vector4 m_DofPlanes;// 0x50    rage::Vector2 m_DofFocusDistanceGridScaling;// 0x60    rage::Vector2 m_DofSubjectMagPowerNearFar;// 0x68float m_Fov;// 0x70float m_NearClip;// 0x74float m_FarClip;// 0x78float m_CameraTimeScaleThisUpdate;// 0x7cfloat m_DofStrength;// 0x80float m_DofBlurDiskRadius;// 0x84float m_DofMaxPixelDepth;// 0x88float m_DofMaxPixelDepthBlendLevel;// 0x8Cfloat m_DofPixelDepthPowerFactor;// 0x90float m_FNumberOfLens;// 0x94float m_FocalLengthMultiplier;// 0x98float m_DofFStopsAtMaxExposure;// 0x9Cfloat m_DofFocusDistanceBias;// 0xA0float m_DofMaxNearInFocusDistance;// 0xA4float m_DofMaxNearInFocusDistanceBlendLevel;// 0xA8float m_DofMaxBlurRadiusAtNearInFocusLimit;// 0xACfloat m_DofBlurDiskRadiusPowerFactorNear;// 0xB0float m_DofOverriddenFocusDistance;// 0xB4float m_DofOverriddenFocusDistanceBlendLevel;// 0xB8float m_DofFocusDistanceIncreaseSpringConstant;// 0xBCfloat m_DofFocusDistanceDecreaseSpringConstant;// 0xC0float m_DofPlanesBlendLevel;// 0xC4float m_DofFullScreenBlurBlendLevel;// 0xC8float m_MotionBlurStrength;// 0xCC    rage::fwFlags<unsignedshort>// 0xD0};// size: 0xE0
You must be logged in to vote
0 replies
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Category
Ideas
Labels
None yet
2 participants
@kagikn@choiszt

[8]ページ先頭

©2009-2025 Movatter.jp