context.Clip(... not working on Babylon React Native Dynamic Texture context

Hello, I’m trying to implement a canvas pattern using Dynamic Texture in React-Native. I’m facing the issue is context.createPattern(* is undefined.. After that I’m trying to implement context.drawImage as alternative. context.drawImage is working fine but issue is here when I’m use context.clip(* is not working…

Please Help

Hello and welcome to the Babylon community! Let’s check with the @BabylonNative team what context methods are implemented there (most are out for the holidays so it might take a while for an answer)

Hey @Suman , how are you doing?

Can you provide a playground example on how you are using context.clip? This will make easier for us to compare with the current behaviour we have in Native.

1 Like

This is BabylonJS Playground example https://playground.babylonjs.com/#FU0ES5#25 is working as expected. But in React-Native the Clip behaviour is not working.

Thanks

1 Like

Thanks for the sample @Suman! I will take a look!

2 Likes

Hey @Suman , how are you doing?

After some investigation here are my finds:

1 - Regarding context.drawImage not working after context.clip, this is actually a bug. I’ve created a PR and an Issue addressing it and it is now waiting to be reviewed by other memebers of the team. You can follow the progress here:

PR: Fixed interaction between dynamic texture and context.clip() by SergioRZMasson · Pull Request #1185 · BabylonJS/BabylonNative (github.com)

Issue: Dynamic Texture context.drawImage does not work with context.clip · Issue #1184 · BabylonJS/BabylonNative (github.com)

It is probably going to take a while for it to be merged due to the holy days, but once it is done I will make sure to ping this thread and let you know.

2 - context.createPattern is not currently supported in Babylon Native (we don’t have a native implementation for it yet). This is a missing feature and is currently been tracked under Babylon Native’s backlog. We won’t be addressing it immediately since features are dependent on how the Babylon Native team prioritizes things. However, I will make sure to ping this thread once we start working on it.

Let me know if this helps you.

If you have a very urgent demand for context.createPattern let me know, we talk with the team about prioritizing that.

1 Like

Hello,

Pleasure to talk with you. It is very help full if you prioritise context.createPattern ASAP.

Thanks

It is all open source so feel free to jump in if you have any urgent need :slight_smile:

@Suman , just as an update. The PR for context.clip has just been merged. This feature should be on the next version of the Babylon React Native package.

4 Likes

This fix has been release with Babylon React Native version 1.4.4 and Babylon.js version 5.43.0 or latter.

3 Likes

Thank You Very much ! @srzerbetto It’s woking fine, But it’s missed some clipping path when I use it inside a loop, and when I frequently clear the context and call drawImage again the app was crashed. maybe this issue is come from my end.

@Suman if you find something that you can repro consistently, feel free to open a new issue here in the forum and we can take a look! Just be sure to create a Playground to show what the target behavior should be.

2 Likes