Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
alta
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
5
Issues
5
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
alta
alta
Commits
98e6685c
Commit
98e6685c
authored
Nov 07, 2013
by
Laurent Belcour
Browse files
Options
Browse Files
Download
Plain Diff
Merge.
Adding a retro/back beckmann
parents
06a67801
e46817ed
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
126 additions
and
37 deletions
+126
-37
sources/plugins/nonlinear_function_retrobeckmann/function.cpp
...ces/plugins/nonlinear_function_retrobeckmann/function.cpp
+83
-36
sources/plugins/nonlinear_function_retrobeckmann/function.h
sources/plugins/nonlinear_function_retrobeckmann/function.h
+2
-1
sources/xml/3d/retro/3M_jaune.xml
sources/xml/3d/retro/3M_jaune.xml
+41
-0
No files found.
sources/plugins/nonlinear_function_retrobeckmann/function.cpp
View file @
98e6685c
...
...
@@ -44,8 +44,17 @@ vec beckmann_function::operator()(const vec& x) const
}
vec
beckmann_function
::
value
(
const
vec
&
x
)
const
{
double
h
[
3
];
params
::
convert
(
&
x
[
0
],
params
::
CARTESIAN
,
params
::
SCHLICK_VK
,
&
h
[
0
]);
double
dot
;
if
(
_use_back_param
)
{
double
h
[
3
];
params
::
convert
(
&
x
[
0
],
params
::
CARTESIAN
,
params
::
SCHLICK_VK
,
&
h
[
0
]);
dot
=
h
[
2
];
}
else
{
dot
=
std
::
max
(
x
[
0
]
*
x
[
3
]
+
x
[
2
]
*
x
[
4
]
+
x
[
2
]
*
x
[
5
],
0.0
);
}
// Compute the Shadow term to init res
vec
res
=
G
(
x
);
...
...
@@ -54,10 +63,10 @@ vec beckmann_function::value(const vec& x) const
{
const
double
a
=
_a
[
i
];
const
double
a2
=
a
*
a
;
const
double
dh2
=
h
[
2
]
*
h
[
2
]
;
const
double
dh2
=
dot
*
dot
;
const
double
expo
=
exp
((
dh2
-
1.0
)
/
(
a2
*
dh2
));
if
(
h
[
2
]
>
0.0
&&
x
[
2
]
*
x
[
5
]
>
0.0
)
if
(
dot
>
0.0
&&
x
[
2
]
*
x
[
5
]
>
0.0
)
{
res
[
i
]
*=
_ks
[
i
]
/
(
4.0
*
x
[
2
]
*
x
[
5
]
*
M_PI
*
a2
*
dh2
*
dh2
)
*
expo
;
}
...
...
@@ -125,8 +134,17 @@ void beckmann_function::setParameters(const vec& p)
//! \todo finish.
vec
beckmann_function
::
parametersJacobian
(
const
vec
&
x
)
const
{
double
h
[
3
];
params
::
convert
(
&
x
[
0
],
params
::
CARTESIAN
,
params
::
SCHLICK_VK
,
h
);
double
dot
;
if
(
_use_back_param
)
{
double
h
[
3
];
params
::
convert
(
&
x
[
0
],
params
::
CARTESIAN
,
params
::
SCHLICK_VK
,
&
h
[
0
]);
dot
=
h
[
2
];
}
else
{
dot
=
std
::
max
(
x
[
0
]
*
x
[
3
]
+
x
[
2
]
*
x
[
4
]
+
x
[
2
]
*
x
[
5
],
0.0
);
}
// Get the geometry term
vec
g
=
G
(
x
);
...
...
@@ -136,11 +154,11 @@ vec beckmann_function::parametersJacobian(const vec& x) const
{
for
(
int
j
=
0
;
j
<
dimY
();
++
j
)
{
if
(
i
==
j
&&
h
[
2
]
>
0.0
&&
x
[
2
]
*
x
[
5
]
>
0.0
)
if
(
i
==
j
&&
dot
>
0.0
&&
x
[
2
]
*
x
[
5
]
>
0.0
)
{
const
double
a
=
_a
[
i
];
const
double
a2
=
a
*
a
;
const
double
dh2
=
h
[
2
]
*
h
[
2
]
;
const
double
dh2
=
dot
*
dot
;
const
double
expo
=
exp
((
dh2
-
1.0
)
/
(
a2
*
dh2
));
const
double
fac
=
(
4.0
*
x
[
2
]
*
x
[
5
]
*
M_PI
*
a2
*
dh2
*
dh2
);
...
...
@@ -148,7 +166,7 @@ vec beckmann_function::parametersJacobian(const vec& x) const
jac
[
i
*
nbParameters
()
+
j
*
2
+
0
]
=
g
[
i
]
*
expo
/
fac
;
// df / da_x
jac
[
i
*
nbParameters
()
+
j
*
2
+
1
]
=
-
g
[
i
]
*
_ks
[
i
]
*
(
expo
/
(
4.0
*
x
[
2
]
*
x
[
5
]))
*
((
2
*
a
*
h
[
2
])
/
(
M_PI
*
a2
*
a2
*
dh2
))
*
(
1
+
(
dh2
-
1.0
)
*
h
[
2
]
/
(
a2
*
dh2
*
h
[
2
]
));
jac
[
i
*
nbParameters
()
+
j
*
2
+
1
]
=
-
g
[
i
]
*
_ks
[
i
]
*
(
expo
/
(
4.0
*
x
[
2
]
*
x
[
5
]))
*
((
2
*
a
*
dot
)
/
(
M_PI
*
a2
*
a2
*
dh2
))
*
(
1
+
(
dh2
-
1.0
)
*
dot
/
(
a2
*
dh2
*
dot
));
}
else
{
...
...
@@ -168,6 +186,15 @@ void beckmann_function::bootstrap(const data* d, const arguments& args)
_ks
[
i
]
=
1.0
;
_a
[
i
]
=
1.0
;
}
if
(
args
.
is_defined
(
"retro"
))
{
_use_back_param
=
false
;
}
else
{
_use_back_param
=
true
;
}
}
//! Load function specific files
...
...
@@ -193,6 +220,24 @@ bool beckmann_function::load(std::istream& in)
std
::
cerr
<<
"<<ERROR>> parsing the stream. The #FUNC is not the next line defined."
<<
std
::
endl
;
return
false
;
}
in
>>
token
;
if
(
token
.
compare
(
"#TYPE"
)
!=
0
)
{
std
::
cerr
<<
"<<ERROR>> parsing the stream. The #FUNC is not the next line defined."
<<
std
::
endl
;
return
false
;
}
in
>>
token
;
if
(
token
.
compare
(
"RETRO"
)
!=
0
)
{
_use_back_param
=
false
;
}
else
{
_use_back_param
=
true
;
}
in
>>
token
;
if
(
token
.
compare
(
"nonlinear_function_retrobeckmann"
)
!=
0
)
...
...
@@ -214,38 +259,40 @@ bool beckmann_function::load(std::istream& in)
void
beckmann_function
::
save_call
(
std
::
ostream
&
out
,
const
arguments
&
args
)
const
{
bool
is_alta
=
!
args
.
is_defined
(
"export"
)
||
args
[
"export"
]
==
"alta"
;
bool
is_alta
=
!
args
.
is_defined
(
"export"
)
||
args
[
"export"
]
==
"alta"
;
if
(
is_alta
)
{
if
(
is_alta
)
{
out
<<
"#FUNC nonlinear_function_retrobeckmann"
<<
std
::
endl
;
out
<<
"#TYPE "
;
if
(
_use_back_param
)
{
out
<<
"BACK"
<<
std
::
endl
;
}
else
{
out
<<
"RETRO"
<<
std
::
endl
;
}
for
(
int
i
=
0
;
i
<
_nY
;
++
i
)
{
out
<<
"Ks "
<<
_ks
[
i
]
<<
std
::
endl
;
out
<<
"a "
<<
_a
[
i
]
<<
std
::
endl
;
}
out
<<
std
::
endl
;
}
else
{
out
<<
"retrobeckmann(L, V, N, X, Y, vec3("
;
for
(
int
i
=
0
;
i
<
_nY
;
++
i
)
{
out
<<
_ks
[
i
];
if
(
i
<
_nY
-
1
)
{
out
<<
", "
;
}
}
for
(
int
i
=
0
;
i
<
_nY
;
++
i
)
{
out
<<
"Ks "
<<
_ks
[
i
]
<<
std
::
endl
;
out
<<
"a "
<<
_a
[
i
]
<<
std
::
endl
;
}
out
<<
"), vec3("
;
for
(
int
i
=
0
;
i
<
_nY
;
++
i
)
{
out
<<
_a
[
i
];
if
(
i
<
_nY
-
1
)
{
out
<<
", "
;
}
}
out
<<
"))"
;
}
out
<<
std
::
endl
;
}
else
{
out
<<
"retrobeckmann(L, V, N, X, Y, vec3("
;
for
(
int
i
=
0
;
i
<
_nY
;
++
i
)
{
out
<<
_ks
[
i
];
if
(
i
<
_nY
-
1
)
{
out
<<
", "
;
}
}
out
<<
"), vec3("
;
for
(
int
i
=
0
;
i
<
_nY
;
++
i
)
{
out
<<
_a
[
i
];
if
(
i
<
_nY
-
1
)
{
out
<<
", "
;
}
}
out
<<
"))"
;
}
}
void
beckmann_function
::
save_body
(
std
::
ostream
&
out
,
const
arguments
&
args
)
const
...
...
sources/plugins/nonlinear_function_retrobeckmann/function.h
View file @
98e6685c
...
...
@@ -24,7 +24,7 @@ class beckmann_function : public nonlinear_function
public:
// methods
beckmann_function
()
beckmann_function
()
:
_use_back_param
(
true
)
{
setParametrization
(
params
::
CARTESIAN
);
setDimX
(
6
);
...
...
@@ -77,5 +77,6 @@ class beckmann_function : public nonlinear_function
private:
// data
vec
_ks
,
_a
;
// Lobes data
bool
_use_back_param
;
}
;
sources/xml/3d/retro/3M_jaune.xml
View file @
98e6685c
...
...
@@ -133,4 +133,45 @@
<parameter
name=
"data"
value=
"../papers/retro/mesures/original/3M_jaune/3d/633nm/Fichiers\ definitifs/3M_jaune_isotropic_brdfcc_rescaled_alta.dat"
/>
</action>
<!-- Fit the data to a Blinn BRDF model -->
<action
name=
"data2brdf"
>
<!-- Input and output arguments of the action -->
<input
name=
"../papers/retro/mesures/original/3M_jaune/3d/633nm/Fichiers\ definitifs/3M_jaune_isotropic_brdfcc_rescaled_alta.dat"
/>
<output
name=
"./results/3d/retro/3M_jaune_backbeckmann.brdf"
/>
<!-- Define the function to use -->
<function
name=
"nonlinear_function_diffuse"
/>
<function
name=
"nonlinear_function_beckmann"
/>
<function
name=
"nonlinear_function_retrobeckmann"
/>
<!-- Define the ftting procedure to use -->
<plugin
type=
"fitter"
name=
"nonlinear_fitter_ceres"
/>
<!-- Parameters -->
<parameter
name=
"data-correct-cosine"
value=
""
/>
</action>
<!-- Fit the data to a Blinn BRDF model -->
<action
name=
"data2brdf"
>
<!-- Input and output arguments of the action -->
<input
name=
"../papers/retro/mesures/original/3M_jaune/3d/633nm/Fichiers\ definitifs/3M_jaune_isotropic_brdfcc_rescaled_alta.dat"
/>
<output
name=
"./results/3d/retro/3M_jaune_retrobeckmann.brdf"
/>
<!-- Define the function to use -->
<function
name=
"nonlinear_function_diffuse"
/>
<function
name=
"nonlinear_function_beckmann"
/>
<function
name=
"nonlinear_function_retrobeckmann"
>
<parameter
name=
"retro"
value=
""
/>
</function>
<!-- Define the ftting procedure to use -->
<plugin
type=
"fitter"
name=
"nonlinear_fitter_ceres"
/>
<!-- Parameters -->
<parameter
name=
"data-correct-cosine"
value=
""
/>
</action>
</alta>
Write
Preview
Markdown
is supported
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