Jump to content

How to integrate sranipal c api in C++ rendering project?


Recommended Posts

#include "SRanipal_SDK/include/SRanipal.h"
#include "SRanipal_SDK/include/SRanipal_Eye.h"
#include "SRanipal_SDK/include/SRanipal_Enums.h"
...

        int2 offset = makeint2(rtSceneDesc.width / 2, rtSceneDesc.height / 2);
        int2 gazeOffset = makeint2(0, 0);
        switch (m_eyeTrackingMode)
        {
            case ETM_MousePointer:
            {
                float2 normalizedMousePosition = makefloat2(float(m_mousePosition.x) / float(m_clientWindowSize.x), float(m_mousePosition.y) / float(m_clientWindowSize.y));
                int2 scaledMousePosition = makeint2(int(std::round(normalizedMousePosition.x * rtSceneDesc.width)), int(std::round(normalizedMousePosition.y * rtSceneDesc.height)));
                gazeOffset = scaledMousePosition - offset;
                break;
            }
			case ETM_SRAnipal:
			{
				//ViveSR::anipal::Eye::VerboseData::combined;
				ViveSR::anipal::Eye::EyeData_v2 eye_data_v2;		
				//float *gaze = eye_data_v2.verbose_data.combined.eye_data.gaze_direction_normalized.elem_;
				int2 gazeOffset = makeint2(int(eye_data_v2.verbose_data.combined.eye_data.gaze_direction_normalized.x),int( eye_data_v2.verbose_data.combined.eye_data.gaze_direction_normalized.y));
				break;
			}

The mouse pointer tracking is working, but the eye tracking is fixed at the center of the screen.

Link to comment
Share on other sites

Hi @vinciDa,

Did your code run into ETM_SRAnipal case?

If it does, it should be the x and y values are 0.

According to this post,

 

We suggest developer to move to OpenXR instead of using SRanipal legacy SDK.

BTW, may I know which VR device are you using for your development?

Link to comment
Share on other sites

Hi @VIVE_chengnay, thanks for taking your time. 

  1. the ETM_SRAnipal case is the user interface. You are right, the X and Y values are (0,0). I need the real-time gaze direction. Do I first initialize the eye-engine to get the gaze directions?
  2. I am using NVIDIA's VRWorks SDK, and it uses OpenVR. So, if I integrate OpenXR would be a good idea or not. Because OpenVR and OpenXR serve the same purpose. However, I am aware of the OpenXR script for eye tracking. So what are you suggesting, I should ignore the sranipal (legacy) and use openxr?
  3. I am using Vive Pro Eye.

 

Link to comment
Share on other sites

Hi @vinciDa,

I check the C# script and could you check the status first?

Not sure if you can get below status and use Initial API.

SRanipal_Eye_Framework.Instance.EnableEye

SRanipal_Eye_Framework.Status

Error result = SRanipal_API.Initial(SRanipal_Eye_v2.ANIPAL_TYPE_EYE_V2, IntPtr.Zero);

Link to comment
Share on other sites

Hi @VIVE_chengnay, I have solved my problem. One last question, what is the difference between version 1 and version 2? For example, there are

SRanipal_EyeData_v1.h
SRanipal_EyeData_v2.h

Also, in Unreal, I see the versions. Which version should I use? V2?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...