Skip to content

Final shader improvements (reopened)#2932

Open
RealEdwardS wants to merge 5 commits intof3d-app:masterfrom
RealEdwardS:final-shader-improvements
Open

Final shader improvements (reopened)#2932
RealEdwardS wants to merge 5 commits intof3d-app:masterfrom
RealEdwardS:final-shader-improvements

Conversation

@RealEdwardS
Copy link

Describe your changes

Added time elapsed from the app start as a uniform property for final shader application.

Issue ticket number and link if any

Checklist for finalizing the PR

  • I have performed a self-review of my code
  • I have added tests for new features and bugfixes
  • I have added documentation for new features
  • If it is a modifying the libf3d API, I have updated bindings
  • If it is a modifying the .github/workflows/versions.json, I have updated docker_timestamp

Continuous integration

Please write a comment to run CI, eg: \ci fast.
See here for more info.

@github-actions
Copy link

github-actions bot commented Mar 11, 2026

You are modifying libf3d public API! ⚠️Please update bindings accordingly⚠️!
You can find them in their respective directories: c, python, java, webassembly.

@mwestphal
Copy link
Member

Still not ok ^^

@RealEdwardS RealEdwardS force-pushed the final-shader-improvements branch from 0de55a3 to 9ab0a67 Compare March 11, 2026 19:47
@mwestphal
Copy link
Member

I can take care of it if you want.

@RealEdwardS
Copy link
Author

I can take care of it if you want.

Yes please

@mwestphal
Copy link
Member

here it is: #2935

Please next time you want to merge/rebase on master, please reach out on discord and I will assist.

@mwestphal
Copy link
Member

Still working on this @RealEdwardS ?

@RealEdwardS
Copy link
Author

Still working on this @RealEdwardS ?

I think it's ready for review, unless there's something I'm missing?

@mwestphal mwestphal self-requested a review March 23, 2026 10:06
@mwestphal
Copy link
Member

I think it's ready for review, unless there's something I'm missing?

You need to ask for review if you want a review :)

@mwestphal
Copy link
Member

mwestphal commented Mar 23, 2026

Well, first you have to recover the branch I provided to you here: #2935, do you need help with that ?

@RealEdwardS RealEdwardS force-pushed the final-shader-improvements branch from 51ed6ae to f3e61bb Compare March 24, 2026 00:23
@RealEdwardS RealEdwardS force-pushed the final-shader-improvements branch from f3e61bb to 3d2d934 Compare March 24, 2026 00:32
@RealEdwardS RealEdwardS force-pushed the final-shader-improvements branch 5 times, most recently from 90c3272 to 58d6baa Compare March 24, 2026 01:18
@RealEdwardS
Copy link
Author

Well, first you have to recover the branch I provided to you here: #2935, do you need help with that ?

I think I was able to fix everything?

@RealEdwardS RealEdwardS force-pushed the final-shader-improvements branch from 58d6baa to 5c2722c Compare March 24, 2026 02:19
Comment on lines +15 to +16
#include "vtkF3DRenderer.h"
#include <vtkRendererCollection.h>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#include "vtkF3DRenderer.h"
#include <vtkRendererCollection.h>
#include "vtkF3DRenderer.h"
#include <vtkRendererCollection.h>

Comment on lines 3 to +15
#include "vtkObjectFactory.h"
#include "vtkOpenGLError.h"
#include "vtkOpenGLFramebufferObject.h"
#include "vtkOpenGLQuadHelper.h"
#include "vtkOpenGLRenderUtilities.h"
#include "vtkOpenGLRenderWindow.h"
#include "vtkOpenGLShaderCache.h"
#include "vtkOpenGLState.h"
#include "vtkRenderState.h"
#include "vtkRenderer.h"
#include "vtkShaderProgram.h"
#include "vtkTextureObject.h"
#include "vtkF3DRenderer.h"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vtk includes should be moved down and <>.

f3d_test(NAME TestFinalShaderNegativeFileName DATA cow.vtp ARGS --filename --final-shader "vec4 pixel(vec2 uv){return vec4(vec3(1.0) - texture(source, uv).rgb, 1.0)\\\\\\\;}" UI)
f3d_test(NAME TestFinalShaderUndefined DATA cow.vtp ARGS --final-shader "undefined" REGEXP "Final shader must define a function" NO_BASELINE)
f3d_test(NAME TestFinalShaderCompilationFailure DATA cow.vtp ARGS --final-shader "vec4 pixel(vec2 uv){}" --verbose REGEXP " build the shader program" NO_BASELINE)
f3d_test(NAME TestFinalShaderTimeUniform DATA cow.vtp ARGS --final-shader "vec4 pixel(vec2 uv){return vec4(texture(source, uv).rgb * (0.5 + 0.5*cos(time+uv.xyx+vec3(0,2,4))), 1.0)\\\\\\\;}")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is no time steps in cow.vtp, so im not sure this test is the right one ?

/**
* Set/Get the total animation time (cumulative time of each frame being rendered) in seconds
*/
vtkSetMacro(TotalTime, double);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

im not sure this is the right name for this property.

vtkRenderer* r = s->GetRenderer();
vtkOpenGLRenderWindow* renWin = static_cast<vtkOpenGLRenderWindow*>(r->GetRenderWindow());
vtkOpenGLState* ostate = renWin->GetState();
vtkF3DRenderer* ren = vtkF3DRenderer::SafeDownCast(renWin->GetRenderers()->GetFirstRenderer());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
vtkF3DRenderer* ren = vtkF3DRenderer::SafeDownCast(renWin->GetRenderers()->GetFirstRenderer());
vtkF3DRenderer* ren = vtkF3DRenderer::SafeDownCast(r);

@@ -25,6 +27,7 @@
vtkRenderer* r = s->GetRenderer();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
vtkRenderer* r = s->GetRenderer();
vtkRenderer* ren = s->GetRenderer();

Copy link
Member

@mwestphal mwestphal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changes needed, but a review from meak too.

@mwestphal mwestphal requested a review from Meakk March 24, 2026 07:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants