Hello, and I am using the code found in the following playground to:
Create a default rendering pipeline
Create a custom post process and post effect
Attach the post effect to the default rendering pipeline.
Switch between scene cameras
The post process is introducing aliasing issues with my final image, in my own code base, but not in the playground which I have shared (see attached image for the issue).
https://www.babylonjs-playground.com/#2FGYE8#15
I have tried changing the texture sampling, the texture format (to float), and increasing the samples on the post process. None of those changes create any impact, but I do see improvements which I increase PostProcessOptions.
Without the custom post process, switching between cameras (in my own base) works without creating new aliasing issues. Printing the pipeline.samples shows that it is correct in all cases. It looks like the issue is coming from the texture being used for the custom post effect.
To further clarify, after I add cameras to the scene and switch to them, the custom post process shows different aliasing than scenes without it. Printing the values shows they haven’t changed.
Is there a mechanism being used internally to ensure that new cameras are correctly added to the stack of post effects or someway to force an update of the child process? Before adding and switching cameras, the custom process appears correct.
I have read about power of two texture issues related to full screen effects, and my canvas is 800x800 px. The playground I shared doesn’t show any issues with non pow2 resolutions, but it is not clear if there are observables handling updates which need to include my custom process.
r
I don’t really understand the PGs you linked in your first and third post and the connection with your problem?
I don’t understand your problem neither… You said it is working in the PG but not in your project: have you tested the same scene in the PG than in your project? The Playground is creating the engine by passing true
as the 2nd parameter (meaning antialiasing = on), but I think your are doing the same(?)
It would help that you setup a PG that repro the problem, that way we could help more easily.
Hey, and thanks for helping look into this.
I found a problem in the first PG (didn’t attach camera switch) which I corrected in the second. Pardon me for not making that more clear.
The issue that I am having is with attaching custom post processes to the default rendering pipeline, and ensuring that those custom effects are connected correctly when the camera is switched.
Here is a PG with some comments added, and switches to toggle the shutter effect(‘s’) or switch cameras (‘space’). In typescript I have been unable to find a way to set the camera of the custom PostProcess after switching cameras, and I am finding that the custom process is introducing aliasing issues (also after switch).
https://www.babylonjs-playground.com/#2FGYE8#27
In the PG I am not getting the aliasing issues that I am seeing in my own code, and I am looking for ways to debug the settings of the custom process within typescript, but member access appears different. The code for enabling and disabling effects (using postProcessRenderPipelineManager) do not have any effect in the scene when I run it. In both cases the code has been copied and modified only to ensure it runs.
Thanks again for your help, and let me know if you have any ideas,
Robert
I have been trying to audit the values of the newly created PostProcess, and having trouble getting the camera which I have attached. Typescript does not make the camera accessor available, and the getCamera command always returns undefined.
(comments added at line 127-128)
https://www.babylonjs-playground.com/#2FGYE8#29
I have also been looking at the width and height parameters of the texture attached to the PostProcess. In the case of the PG, the width and height settings are [-1] before attaching the pipeline, and evaluate the the correct canvas size after attach. In the case of my own code (attaching the pipeline the same way using postProcessRenderPipelineManager.attachCamerasToRenderPipeline), the height and width setting of the PostProcess remain [-1] after calling attach.
Is there a way to set the camera value of the PostProcess in typescript? Or a better way to ensure that the target texture of the newly created postprocess is set to the right camera?
Robert
camera
does not exist as a property in the PostProcess
class, only _camera
, but it is a private property that should not be accessed.
Have you tried to use camera.attachPostProcess
/ camera.detachPostProcess
to manage attaching/detaching post processes to your cameras?
Hey, and this issue turned out to be coming from the creation order of the different scene components, and was also the reason my PG was different than the code base I extracted it from.
I am attaching the cameras to the pipeline when they are created using postProcessRenderPipelineManager.attachCamerasToRenderPipeline, but it does not propagate the attached camera to the custom PostProcess I have attached to it. I will try camera.attachPipeline, and thanks.
In my own code, the custom PostProcess is being created before a camera has been added to the scene, and this causes the width and height settings to remain [-1]. I could guess that this is a result of the camera not being attached, to correctly set the dimensions of the PostProcess renderTexture. It might also make sense to look at the code which postProcessRenderPipeline is using to attach cameras, and I will do that as well. For now, I can create my camera ahead of the post process and rely on it.
Thanks again for your help,
Robert
1 Like