Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
libRendering
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
STORM
repos
Radium
libRendering
Commits
332a0f4e
Commit
332a0f4e
authored
4 years ago
by
Mathias Paulin
Browse files
Options
Downloads
Patches
Plain Diff
Prototype of LIC function
parent
361cdaf8
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/libRender/RadiumNBR/Shaders/ImageProcessingPass/ImageProcess.frag.glsl
+41
-3
41 additions, 3 deletions
...iumNBR/Shaders/ImageProcessingPass/ImageProcess.frag.glsl
with
41 additions
and
3 deletions
src/libRender/RadiumNBR/Shaders/ImageProcessingPass/ImageProcess.frag.glsl
+
41
−
3
View file @
332a0f4e
...
...
@@ -54,11 +54,47 @@ vec4 lic(in sampler2D desc,in bool invertdir) {
*/
vec4
lic
(
in
sampler2D
desc
,
in
bool
invertdir
,
in
vec2
imgSize
)
{
const
int
halfsize
=
10
;
vec2
coord
=
varTexcoord
;
vec2
dir
=
texture
(
desc
,
coord
).
xy
;
if
(
length
(
dir
)
<
0
.
0001
)
return
vec4
(
0
);
if
(
invertdir
)
dir
=
vec2
(
dir
.
y
,
-
dir
.
x
);
float
res
=
whiteNoise
(
dir
,
imgSize
);
vec2
currentdir
=
dir
;
for
(
int
i
=
1
;
i
<=
halfsize
;
i
++
)
{
coord
=
coord
+
currentdir
;
//*halfsize;
currentdir
=
texture
(
desc
,
coord
).
xy
;
res
+=
whiteNoise
(
currentdir
,
imgSize
);
if
(
invertdir
)
currentdir
=
vec2
(
currentdir
.
y
,
-
currentdir
.
x
);
}
coord
=
varTexcoord
;
currentdir
=
dir
;
for
(
int
i
=
1
;
i
<=
halfsize
;
i
++
)
{
coord
=
coord
-
currentdir
;
//*halfsize;
currentdir
=
texture
(
desc
,
coord
).
xy
;
res
+=
whiteNoise
(
currentdir
,
imgSize
);
if
(
invertdir
)
currentdir
=
vec2
(
currentdir
.
y
,
-
currentdir
.
x
);
}
res
=
res
/
(
2
.
0
f
*
float
(
halfsize
)
+
1
.
0
f
);
return
vec4
(
vec3
(
res
),
0
);
}
void
main
()
{
vec2
imgSize
=
vec2
(
textureSize
(
image_sampler
,
0
));
/*
// 4x4 filtering for test
const int half_width = 2;
vec2 texelSize = 1.0 / vec2(
textureSize(image_sampler, 0)
);
vec2 texelSize = 1.0 / vec2(
imgSize
);
vec3 result = vec3(0.0);
for (int x = -half_width; x < half_width; ++x)
{
...
...
@@ -70,8 +106,10 @@ void main() {
}
out_color = vec4(result / (4 * half_width * half_width), 1);
*/
vec2
imgSize
=
vec2
(
textureSize
(
image_sampler
,
0
));
/*
out_color = vec4( vec3( whiteNoise( varTexcoord, imgSize) ), 1);
*/
out_color
=
lic
(
image_sampler
,
false
,
imgSize
);
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment