NativeEngine render target texture not working with MSAA

working on it. stay tuned and thanks for the support.

@bghgary pretty sure this is somewhat unrelated but we are getting an Unsupported texture format or type: format 6, type 0 . Im not sure what format 6 and type 0 is. Could this be related to:

which is that 16 bit textures are not supported by Native? (we will try converting to 8 bit)

Right, this is what I mentioned earlier. If this is what you are seeing, I can try to fix it, but it has nothing to do with MSAA. The post process is trying to create a texture with a format that isn’t handled yet.

well… we actually found some textures were using in assets that are 16bpp so we are converting those to 8 (those textures should be 8bpp anyway so that was our bad) and we will run our test again. I have a feeling that will get rid of that error. I dont think we have any PP stuff using 16bpp textures but regardless it would be good to support 16bit images long term. I dont want you to do wasted work so let me run this test with our converted assets and hopefully we wont get that error and can get back to debugging AA :slight_smile:

Okay, sounds good. Just to add more information, format 6 and type 0 is TEXTUREFORMAT_RED and TEXTURETYPE_UNSIGNED_BYTE which I believe is coming from the depth of field in the post process.

1 Like

These are the formats we currently support:

If bgfx supports more, we can easily add more to this list if needed.

yep we are using DOF and we have the defaultRenderingPipeline enabled and enable DOF from there. We will try to turn off DOF and try that. We will also try removing the defaultRenderingPipeline entirely from the scene and see if the error will go away.

@bghgary looks like we were able to overcome our AA hurdles. Do you know when your AA fixes will be on main branch of babylon native? One unrelated question is regarding tonemapping operators. We’re using ACES and this doesn’t seem to be supported in Native. Am I correct on that and if so do you know what the status is on that? Docs say “some” postprocess are supported but does not go into specifics .

I’m actually waiting for you to confirm it works before I merge. :slight_smile: It sounds like it’s working, so I will merge ASAP.

I am investigating the post process from the PG you linked above. There are definitely some gaps and possibly bugs in the implementation. I haven’t looked into ACES. Can you send a PG of what you are doing?

@bghgary here is how we do the ACES tone mapping currently. there is no difference on how we handle it on the front end vs. back end… all goes through DefaultRenderingPipeline. Let me know if you have any questions or need anything else,

Thanks, I will investigate this today and get back to you.

BTW, is DOF important for your scenario?

This PR will make ACES work: Enable texture float rendering by bghgary · Pull Request #14096 · BabylonJS/Babylon.js · GitHub

Sorry for the delay. I ran into some issues with the Babylon.js PR. I think everything is working now. You should use the following:

  • Babylon.js npm package 6.14.2 or later
  • BabylonNative at this commit or later
  • BabylonNatvieExamples still in PR here

One thing I will note for ACES tone mapping is that you might want to use the following code instead of a separate post process pipeline. Using a separate post process pipeline will affect the background which is probably not what you want. Doing it using the following code will only affect the model.

    scene.imageProcessingConfiguration.toneMappingEnabled = true;
    scene.imageProcessingConfiguration.toneMappingType = BABYLON.ImageProcessingConfiguration.TONEMAPPING_ACES;

BabylonNativeExamples PR is merged now. Both MSAA and ACES should be working now. Let me know if you run into issues.

2 Likes

@bghgary thank you guys for the excellent support on this, all seems to be working great so far. we are venturing into actually rendering mp4 video using native so if we run into snags there i’ll keep you updated. exciting times.

1 Like

@bghgary Hello again, it appears that MSAA is broken again in Native. Not sure if this was a regression. we tried rolling back to 6.14.2 but still broken. I dont think anything on our end has changed in terms of the setup. Pretty much follows the example. We’re using samples:4 in the output texture. We are still using the default rendering pipeline but ive tested this with and without that. I’ll try to just run the example again and see if its happening in the example.

Is it broken even when you reverted ??? this sounds weeeeeirrrrdddd :slight_smile:

Let us know how it goes with the example and if it is related to recent change in babylon.

Looks like this is not to do with Native or BJS. Examples work and it also works on some of our scenes but some scenes dont work. So its something within our scene setup. Some of the scenes use defaultRenderingPipeline but we’ve removed that and still it breaks. So something else with the scene is breaking msaa. I’ll update this post when I find the issue.

1 Like