Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
blender
monado
Commits
17beaf8a
Commit
17beaf8a
authored
Jan 23, 2021
by
Jakob Bornecrantz
Browse files
u/distortion: A stab in the dark to try and improve Index chromatic aberration
parent
7d755427
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/xrt/auxiliary/util/u_distortion_mesh.c
View file @
17beaf8a
...
...
@@ -144,6 +144,10 @@ u_compute_distortion_vive(struct u_vive_values *values, float u, float v, struct
float
r2
=
m_vec2_dot
(
texCoord
,
texCoord
);
float
d_inv
=
((
r2
*
val
.
coefficients
[
i
][
2
]
+
val
.
coefficients
[
i
][
1
])
*
r2
+
val
.
coefficients
[
i
][
0
])
*
r2
+
1
.
0
;
// The scaled part of DISTORT_DPOLY3_SCALED, seems to improve chromatic abberation.
d_inv
-=
val
.
coefficients
[
i
][
3
];
float
d
=
1
.
0
/
d_inv
;
struct
xrt_vec2
offset
=
{
0
.
5
,
0
.
5
};
...
...
src/xrt/auxiliary/util/u_distortion_mesh.h
View file @
17beaf8a
...
...
@@ -75,8 +75,8 @@ struct u_vive_values
//! r/g/b
struct
xrt_vec2
center
[
3
];
//! r/g/b, a/b/c
float
coefficients
[
3
][
3
];
//! r/g/b, a/b/c
/d
float
coefficients
[
3
][
4
];
};
/*!
...
...
src/xrt/drivers/ohmd/oh_device.c
View file @
17beaf8a
...
...
@@ -634,32 +634,38 @@ oh_device_create(ohmd_context *ctx, ohmd_device *dev, const char *prod)
ohd
->
distortion
.
vive
[
0
].
coefficients
[
0
][
0
]
=
-
0
.
188236068524731
f
;
ohd
->
distortion
.
vive
[
0
].
coefficients
[
0
][
1
]
=
-
0
.
221086205321053
f
;
ohd
->
distortion
.
vive
[
0
].
coefficients
[
0
][
2
]
=
-
0
.
2537849057915209
f
;
ohd
->
distortion
.
vive
[
0
].
coefficients
[
0
][
3
]
=
0
.
0
f
;
// blue
ohd
->
distortion
.
vive
[
0
].
coefficients
[
1
][
0
]
=
-
0
.
073165
90815739493
f
;
ohd
->
distortion
.
vive
[
0
].
coefficients
[
1
][
1
]
=
-
0
.
023324007
89561968
f
;
ohd
->
distortion
.
vive
[
0
].
coefficients
[
1
][
2
]
=
0
.
0246
9959434698275
f
;
ohd
->
distortion
.
vive
[
0
].
coefficients
[
1
][
3
]
=
0
.
0
f
;
// red
ohd
->
distortion
.
vive
[
0
].
coefficients
[
2
][
0
]
=
-
0
.
02223
805567703767
f
;
ohd
->
distortion
.
vive
[
0
].
coefficients
[
2
][
1
]
=
-
0
.
04
931309279533211
f
;
ohd
->
distortion
.
vive
[
0
].
coefficients
[
2
][
2
]
=
-
0
.
07
862881939243466
f
;
ohd
->
distortion
.
vive
[
0
].
coefficients
[
2
][
3
]
=
0
.
0
f
;
// right
// green
ohd
->
distortion
.
vive
[
1
].
coefficients
[
0
][
0
]
=
-
0
.
1906209981894497
f
;
ohd
->
distortion
.
vive
[
1
].
coefficients
[
0
][
1
]
=
-
0
.
2248896677207884
f
;
ohd
->
distortion
.
vive
[
1
].
coefficients
[
0
][
2
]
=
-
0
.
2721364516782803
f
;
ohd
->
distortion
.
vive
[
1
].
coefficients
[
0
][
3
]
=
0
.
0
f
;
// blue
ohd
->
distortion
.
vive
[
1
].
coefficients
[
1
][
0
]
=
-
0
.
07346071
902951497
f
;
ohd
->
distortion
.
vive
[
1
].
coefficients
[
1
][
1
]
=
-
0
.
021
89527566250131
f
;
ohd
->
distortion
.
vive
[
1
].
coefficients
[
1
][
2
]
=
0
.
05
81378652359256
f
;
ohd
->
distortion
.
vive
[
1
].
coefficients
[
1
][
3
]
=
0
.
0
f
;
// red
ohd
->
distortion
.
vive
[
1
].
coefficients
[
2
][
0
]
=
-
0
.
01755
850332081247
f
;
ohd
->
distortion
.
vive
[
1
].
coefficients
[
2
][
1
]
=
-
0
.
0451724563337341
9
f
;
ohd
->
distortion
.
vive
[
1
].
coefficients
[
2
][
2
]
=
-
0
.
0928909347763
f
;
ohd
->
distortion
.
vive
[
1
].
coefficients
[
2
][
3
]
=
0
.
0
f
;
// clang-format on
ohd
->
base
.
compute_distortion
=
compute_distortion_vive
;
...
...
src/xrt/drivers/survive/survive_driver.c
View file @
17beaf8a
...
...
@@ -895,16 +895,15 @@ _json_get_int(const cJSON *json, const char *name)
static
void
_get_color_coeffs
(
struct
u_vive_values
*
values
,
const
cJSON
*
coeffs
,
uint8_t
eye
,
uint8_t
channel
)
{
// this is 4 on index, all values populated
// assert(coeffs->length == 8);
// only 3 coeffs contain values
// For Vive this is 8 with only 3 populated.
// For Index this is 4 with all values populated.
const
cJSON
*
item
=
NULL
;
size_t
i
=
0
;
cJSON_ArrayForEach
(
item
,
coeffs
)
{
values
->
coefficients
[
channel
][
i
]
=
(
float
)
item
->
valuedouble
;
++
i
;
if
(
i
==
3
)
{
if
(
i
==
4
)
{
break
;
}
}
...
...
src/xrt/drivers/vive/vive_config.c
View file @
17beaf8a
...
...
@@ -30,16 +30,15 @@
static
void
_get_color_coeffs
(
struct
u_vive_values
*
values
,
const
cJSON
*
coeffs
,
uint8_t
eye
,
uint8_t
channel
)
{
// this is 4 on index, all values populated
// assert(coeffs->length == 8);
// only 3 coeffs contain values
// For Vive this is 8 with only 3 populated.
// For Index this is 4 with all values populated.
const
cJSON
*
item
=
NULL
;
size_t
i
=
0
;
cJSON_ArrayForEach
(
item
,
coeffs
)
{
values
->
coefficients
[
channel
][
i
]
=
(
float
)
item
->
valuedouble
;
++
i
;
if
(
i
==
3
)
{
if
(
i
==
4
)
{
break
;
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment