blob: 77b5d728783d7631f9727dd9ec724d3f13a5843f [file] [log] [blame]
Alex Vakulenkoe4eec202017-01-27 14:41:04 -08001
2syntax = "proto2";
3
4option java_package = "com.google.vrtoolkit.cardboard.proto";
5option java_outer_classname = "CardboardDevice";
6option optimize_for = SPEED;
7
8package proto;
9
10
11/**
12 * Message describing properties of a VR head mount device (HMD) which uses an
13 * interchangeable smartphone as a display (e.g. Google Cardboard).
14 *
15 * While some properties are certain (e.g. inter_lens_distance), others
16 * represent nominal values which may be refined depending on context (e.g.
17 * viewport_angles).
18 *
19 * Lengths are in meters unless noted otherwise. Fields are _required_
20 * unless noted otherwise.
21 *
22 * Some context on why this set of parameters are deemed necessary and
23 * sufficient:
24 * * FOV scale can be reasonably approximated from lens-to-screen distance
25 * and display size (i.e. knowing lens focal length isn't crucial).
26 * * Lenses are assumed to be horizontally centered with respect to
27 * display.
28 * * The display is not necessarily vertically centered. For interchangeable
29 * phones where the device rests against a tray, we can derive
30 * the vertical offset from tray-to-lens height along with phone-specific
31 * bezel and screen sizes (supplied separately).
32 */
33message DeviceParams {
34 // String identifying the device's vendor (e.g. "Google, Inc.").
35 // A device's [vendor, model] pair is expected to be globally unique.
36 optional string vendor = 1;
37
38 // String identifying the device's model, including revision info if
39 // needed (e.g. "Cardboard v1"). A device's [vendor, model] pair is
40 // expected to be globally unique.
41 optional string model = 2;
42
43 // Distance from the display screen to the optical center of lenses.
44 // This is a required field for distortion rendering, and must be positive.
45 optional float screen_to_lens_distance = 3;
46
47 // Horizontal distance between optical center of the lenses.
48 // This is a required field for distortion rendering, and must be positive.
49 optional float inter_lens_distance = 4;
50
51 // Four-element tuple (left, right, bottom, top) of left eye's view extent
52 // angles relative to center, assuming the following:
53 // * eye is aligned with optical center of lens
54 // * display screen is equal or larger than extents viewable through lens
55 // * nominal eye-to-lens distance
56 // * mirrored field of view will be applied to the right eye
57 // These values are essentially used as an optimization to avoid rendering
58 // pixels which can't be seen.
59 // This is a required field for distortion rendering, and angles must be
60 // positive.
61 repeated float left_eye_field_of_view_angles = 5 [packed = true];
62
63 enum VerticalAlignmentType {
64 BOTTOM = 0; // phone rests against a fixed bottom tray
65 CENTER = 1; // phone screen assumed to be centered w.r.t. lenses
66 TOP = 2; // phone rests against a fixed top tray
67 }
68
69 // Set according to vertical alignment strategy-- see enum comments above.
70 // NOTE: If you set this to CENTER, see special instructions for the
71 // tray_to_lens_distance field below.
72 optional VerticalAlignmentType vertical_alignment = 11 [default = BOTTOM];
73
74 // If the phone is aligned vertically within the device by resting against
75 // a fixed top or bottom tray, this is the distance from the tray to
76 // optical center of the lenses.
77 // This is a required field for distortion rendering, and must be positive.
78 // NOTE: Due to a bug in initial versions of the SDK's, this field
79 // must be set explicitly to .035 when vertical_alignment = CENTER.
80 optional float tray_to_lens_distance = 6;
81
82 // Coefficients Ki for pincushion distortion function which maps
83 // from position on real screen to virtual screen (i.e. texture) relative
84 // to optical center:
85 //
86 // p' = p (1 + K1 r^2 + K2 r^4 + ... + Kn r^(2n))
87 //
88 // where r is the distance in tan-angle units from the optical center,
89 // p the input point, and p' the output point. Tan-angle units can be
90 // computed as distance on the screen divided by distance from the
91 // virtual eye to the screen.
92 repeated float distortion_coefficients = 7 [packed = true];
93 // Slots 8, 9 reserved for per-color channel distortion.
94
95 // Optionally, whether the head mount uses a magnet in any part of its
96 // design. Intended as hint as to whether phone's magnetometer is
97 // available for tasks such as orientation tracking.
98 optional bool has_magnet = 10;
99
100 enum ButtonType {
101 // No physical button, and touch screen is not easily accessible.
102 NONE = 0;
103 // HMD has integrated magnet switch similar to original Cardboard.
104 MAGNET = 1;
105 // At least a portion of touch screen is easily accessible to user for taps.
106 TOUCH = 2;
107 // Touch screen is triggered indirectly via integrated button on the HMD.
108 INDIRECT_TOUCH = 3;
109 }
110
111 // Specify primary input mechanism of the HMD. Intended for advisory
112 // purposes only, to address simple questions such as "can HMD
113 // be used with apps requiring a physical button event?" or "what icon
114 // should be used to represent button action to the user?".
115 optional ButtonType primary_button = 12 [default = MAGNET];
116
117 // Some internal data for Cardboard. This data is not intended to be
118 // set or used by developers, and any data in this proto is not guaranteed
119 // to be supported with new SDK updates.
120 optional CardboardInternalParams internal = 1729;
121
122 // Optionally, specifies the additional parameters that are necessary for
123 // a Daydream-ready headset. This field is non-null if the headset is
124 // Daydream-ready.
125 // TODO(b/30112366) The inclusion of this message inside a DeviceParams is a
126 // somewhat ugly result of some historical choices in the SDK. We should
127 // consider refactoring our code to allow us to remove this, and the
128 // CardboardInternalParams messages from this proto.
129 optional DaydreamInternalParams daydream_internal = 196883;
130}
131
132// TODO(b/27108179): CardboardInternalParams should be migrated into its own
133// file, and not live in this file.
134
135/**
136 * Message describing parameters that are used internally by Cardboard
137 * and VRToolkit. These parameters don't necessarily fit into the DeviceParams
138 * notion of a VR viewer combined with user's phone (e.g. case of viewer with
139 * dedicated display, etc.) and are not intended to be used by developers
140 * and may or may not be supported or changed without notice on new releases
141 * of the Cardboard SDK or VR Toolkit.
142 */
143message CardboardInternalParams {
144 // Used to specify a per-eye post-process transformation -- an optional
145 // rotation and x-axis reflection -- to be applied after distortion
146 // correction.
147 enum OrientationType {
148 CCW_0_DEGREES = 0;
149 CCW_90_DEGREES = 1;
150 CCW_180_DEGREES = 2;
151 CCW_270_DEGREES = 3;
152 CCW_0_DEGREES_MIRRORED = 4;
153 CCW_90_DEGREES_MIRRORED = 5;
154 CCW_180_DEGREES_MIRRORED = 6;
155 CCW_270_DEGREES_MIRRORED = 7;
156 }
157
158 // Specify a post-process transformation that is applied after the distortion
159 // function. This field is optional, if not specified, CCW_0_DEGREES is
160 // assumed. If repeated, the first orientation is for the left eye, the second
161 // is for the right eye.
162 //
163 // For example, if [CCW_90_DEGREES, CCW_270_DEGREES_MIRRORED] is specified,
164 //
165 // this input:
166 //
167 // ***************** *****************
168 // *1 2* *1 2*
169 // * * * * *** *
170 // * * * * * * *
171 // * **** * * * * *
172 // *4 3* *4 3*
173 // ***************** *****************
174 //
175 // is rendered on the screen like this:
176 //
177 // ***************** *****************
178 // *2 * 3* *3 * 2*
179 // * * * * ** *
180 // * * * * * *
181 // * *** * * *** *
182 // *1 4* *4 1*
183 // ***************** *****************
184 repeated OrientationType eye_orientations = 1 [packed = true];
185
186 // Specify a horizontal offset from the middle of the screen to the center of
187 // the lens, in meters. If one is not provided, half of the inter lens
188 // distance is used.
189 //
190 // This is only necessary if the HMD has some sort of periscope effect, where
191 // the position of the lenses, relative to the screen, is different than
192 // their position relative to the user.
193 //
194 // For example, in the HMD below, two mirrors reflect the image from the
195 // screen to the user, creating a larger inter lens distance than the screen
196 // can support.
197 //
198 // [In the diagram below, S = screen, L = lens]
199 //
200 // screen_center_to_lens_distance
201 // |--|
202 //
203 // -------------------------
204 // | SSSSSSSSSSSS |
205 // | | | | |
206 // | /----/ | \----\ |
207 // | | | | |
208 // | LLL LLL |
209 //
210 // |---------------|
211 // inter_lens_distance
212 //
213 optional float screen_center_to_lens_distance = 2;
214
215 // Optional x-dimension physical pixels per inch of the external display,
216 // assuming landscape orientation. If set, this will override OS-reported
217 // values.
218 optional float x_ppi_override = 3;
219
220 // Optional y-dimension physical pixels per inch of the external display,
221 // assuming landscape orientation. If set, this will override OS-reported
222 // values.
223 optional float y_ppi_override = 4;
224
225 // Optional string identifying the device's accelerometer and gyroscope.
226 // If either field is filled out, the corresponding sensor (gyroscope or
227 // accelerometer) will be used for head tracking.
228 //
229 // Valid strings are usually found in:
230 // vendor/<vendorname>/<devicename>/xxx/sensors.cpp
231 //
232 // For dynamic sensors, this string will be provided in a separate way.
233 //
234 // NB: Vendors and manufacturers should make the name of the sensor as
235 // specific as possible, since if multiple sensors with the same name are
236 // connected, the first will be used.
237 optional string accelerometer = 5;
238 optional string gyroscope = 6;
239}
240
241/**
242 * Message describing the additional properties of a Daydream-ready headset that
243 * are not used for a normal cardboard viewer. These parameters are not intended
244 * to be used, or consumed, by developers and may or may not be supported or
245 * changed without notice on new releases of the Cardboard SDK or VR Toolkit.
246 */
247message DaydreamInternalParams {
248 // The version of the Daydream-ready specification to which this device
249 // conforms.
250 optional int32 version = 1;
251
252 // Optionally, specifies the collection of screen alignment markers in the
253 // headset.
254 repeated ScreenAlignmentMarker alignment_markers = 2;
255}
256
257/**
258 * Message describing a single screen alignment marker.
259 *
260 * A screen alignment marker is a capacitive touch point affixed to the headset
261 * which is capable of making contact with the screen. The location of the touch
262 * point is given in meters, measured along a horizontal axis which passes
263 * through the center of both lenses, and a vertical axis which is equidistant
264 * from the centers of the lenses. A positive vertical value indicates that the
265 * point lies above the horizontal axis, and a positive horizontal value
266 * indicates that the point lies to the right, as seen by a user of the headset,
267 * of the vertical axis. For example, if the following is a representation of a
268 * headset, viewed from the point of view of a user, with three points marked by
269 * the numbers 1, 2, and 3.
270 *
271 * *****************************************************************************
272 * * ^ *
273 * * _____ | _____ *
274 * * / \ 1 / \ *
275 * * / \ | / \ *
276 * * / \ | / \ *
277 * * / \ | / \ *
278 * * / \ | / \ *
279 * *---------|-------*-------|----------+------2---|-------*-------|---------->*
280 * * \ / | \ / *
281 * * \ / | \ / *
282 * * \ / 3 | \ / *
283 * * \ / | \ / *
284 * * \_____/ | \_____/ *
285 * * | *
286 * * | *
287 * *****************************************************************************
288 *
289 * Then the coordinates of point 1 could be horizontal = 0.0, vertical = 0.035;
290 * point 2 could be horizontal = 0.02; and point 3 could be horizontal = -0.01
291 * vertical = -0.012
292 */
293message ScreenAlignmentMarker {
294 // The horizontal coordinate of the touch point.
295 optional float horizontal = 1;
296
297 // The vertical coordinate of the touch point.
298 optional float vertical = 2;
299}