-
Notifications
You must be signed in to change notification settings - Fork 182
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
KDE Rendering Experimental Program #804
base: master
Are you sure you want to change the base?
Conversation
thank you for your feedback. we will look at all this links. |
Codecov Report
@@ Coverage Diff @@
## master #804 +/- ##
==========================================
- Coverage 84.43% 84.38% -0.05%
==========================================
Files 43 43
Lines 10274 10274
Branches 1393 1393
==========================================
- Hits 8675 8670 -5
- Misses 1239 1243 +4
- Partials 360 361 +1 |
After a pair with @devmessias, we made some progress on the FBO setup issue. Now, the FBO is sucessfully generated, and it seems ready to be drawn to. Apparently, the issue was that the context needed to have the window interactor initialized with |
|
||
|
||
frag_decl = """varying vec2 out_tex; | ||
uniform vec2 res0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JoaoDell you should declare in vec3 normalizedVertexMCVSOutput;
here
frag_decl = """varying vec2 out_tex;
in vec3 normalizedVertexMCVSOutput;
uniform vec2 res0;
uniform vec3 point0;"""
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like the problem was somewhere else, but i have just updated the PR with some changes that don't conflict with the shaders
|
||
# Render every point existing inside loop | ||
for i in range(n_points): | ||
shader_custom_uniforms(billboard, "fragment").SetUniform3f("point0", points[i, :]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't believe this action is feasible as it would attempt to create new instances of 'point0' and 'res0' variables. This leads to an error. The error message I received :
2023-06-26 19:22:22.899 ( 0.328s) [ B8DAB000] vtkShaderProgram.cxx:453 ERR| vtkShaderProgram (0x558732a3cb20): 0:109(15): error: `res0' redeclared
0:110(15): error: `point0' redeclared
We have a old PR that deals with that
#424 maybe we need to look into this again @skoudoro and @filipinascimento
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting, I didn't know how VTK handled uniforms so I thought the SetUniform
methods only passed uniform values to the shader. That seems like something worth checking out indeed 👍
Hey @devmessias thanks for pointing those out, I have just updated this PR with my current progress:
Maybe @filipinascimento could have a better idea of what is happening as well. |
uniform sampler2D screenTexture; | ||
|
||
void main(){ | ||
vec4 texture = texture(screenTexture, out_tex); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
texture should be 2D vec right?
try this
void main(){
//vec2 texture = texture(screenTexture, out_tex);
// gl_FragColor = texture;
vec3 normalColor = texture2D(screenTexture, out_tex).rgb;
gl_FragColor = vec4(normalColor.r, normalColor.g, normalColor.b, 1);
//gl_FragColor = vec4(0.0, 0.0, 1.0, 1.0);
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was passing out_tex as texture coordinates, but I will try what you recommended
Hey everyone, I just updated and completely refactored this PR as, as well as it is base program, as it went on a slight different direction in comparison to its original intetion. Everything seems to be working now, my only question is if it would be better if I closed this PR and opened a new one with a new branch containing only the recent commits, as the older ones have been completely replaced, or should I rebase it, I don't know. What should I do? Anyway, this version is ready for review 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @JoaoDell,
I need to take a deeper look at your work, but I've left some comments below. Overall is looking good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @JoaoDell ,
Giving a first look I found out these below points. Some of them would require more discussion from mentors to clarify few things.
If you think any of these comments doesn't align according to your approach while implementing it feel free to ping me or mentors at the comment.
Thanks in advance!
window : window.RenderWindow, | ||
texture_name : str, | ||
target_actor : actor.Actor, | ||
blending_mode : str = "None", | ||
wrap_mode : str = "ClampToBorder", | ||
border_color : tuple = ( | ||
0.0, | ||
0.0, | ||
0.0, | ||
1.0), | ||
interpolate : bool = True): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure whether we use typedhint
for the function parameters as we basically mention them in our docs.
Maybe @skoudoro or @filipinascimento can clarify this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not yet, but we should go toward this direction.
Actually, I think we should make it a standard for FURY and start slowly the process for all module
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, so should I leave it like that and keep using typedhint
for my future commits or should I stay on today's standards and not use it for now until the make it standard decision for FURY is made @skoudoro?
@ganimtron-10 I have fixed and updated most of your recommendations. Indeed, |
Also, I just realised there is a native colormap generator in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @JoaoDell,
Thank you for this. This experimental is much more advanced than the other experimental.
I would recommend to start adding some text and explanation and then, we can move it to the examples folder. Maybe we can create a new section named "advanced Topic".
To discuss....
window : window.RenderWindow, | ||
texture_name : str, | ||
target_actor : actor.Actor, | ||
blending_mode : str = "None", | ||
wrap_mode : str = "ClampToBorder", | ||
border_color : tuple = ( | ||
0.0, | ||
0.0, | ||
0.0, | ||
1.0), | ||
interpolate : bool = True): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not yet, but we should go toward this direction.
Actually, I think we should make it a standard for FURY and start slowly the process for all module
Okay @skoudoro, I will be looking into the existing examples to understand how I should explain and detail this one so we can try using it as an example then, thanks for the opinion! |
[UPDATED]
Hello everyone, this PR contains an experimental implementation of Kernel Density Estimation calculations for a set of points. This uses some of fury's existing APIs and some straight vtk ones. This program may be a good example of shader usage and how to apply post-processing effects inside FURY. The result from running that should be:
Below, what is the idea here:
In more details, what is done:
SetOffscreenRendering(True)
.shaders.shader_apply_effects()
is used to tell OpenGL additive blending is desired for this code.matplotlib.colormaps
and passed to the billboard as a texture named"colormapTexture"
with the functioncolormap_to_texture()
window_to_texture()
Some minor details that may be useful for a better understanding of it: