Sign in to follow this  
royibernthal

Triggering Shader Compilation

Recommended Posts

I could, but are the rest of the stuff in particleSystem.isReady() even relevant to the shader compilation? If so, out of curiosity - which?

Also, please notice in my previous reply that I'm not even able to trigger the shader compilation.

Share this post


Link to post
Share on other sites

You can see that the effect if created here:

https://github.com/BabylonJS/Babylon.js/blob/master/src/Particles/babylon.particleSystem.ts#L691

so calling _getEffect() should work (All code is there)

 

And isReady should be enough:

https://github.com/BabylonJS/Babylon.js/blob/master/src/Particles/babylon.particleSystem.ts#L853

Share this post


Link to post
Share on other sites

I could argue: Please take a minute to read the code which is available on GitHub but I won't go down this easy road

Anyway, my response still applies, only file links change=>

 

You can see that the effect if created here:

https://github.com/BabylonJS/Babylon.js/blob/master/src/Particles/babylon.gpuParticleSystem.ts#L512

so calling isReady should be enough (until it returns true):

https://github.com/BabylonJS/Babylon.js/blob/master/src/Particles/babylon.gpuParticleSystem.ts#L292

 

 

Share this post


Link to post
Share on other sites
On 6/6/2018 at 7:35 AM, Deltakosh said:

I could argue: Please take a minute to read the code which is available on GitHub but I won't go down this easy road

Sorry if I sounded rude in my last reply. I did by the way read the code on GitHub, hence my previous questions about how things work internally.

On 6/6/2018 at 7:35 AM, Deltakosh said:

Anyway, my response still applies, only file links change=>

 

You can see that the effect if created here:

https://github.com/BabylonJS/Babylon.js/blob/master/src/Particles/babylon.gpuParticleSystem.ts#L512

so calling isReady should be enough (until it returns true):

https://github.com/BabylonJS/Babylon.js/blob/master/src/Particles/babylon.gpuParticleSystem.ts#L292

I still don't understand why we need to emulate emitter and texture instead of directly calling the internal functions that trigger compilation, an explanation would be nice if/when you have time.

Anyway, let's just do that, I guess it doesn't make much of a difference.

Here's an updated PG, I don't think the effect is being compiled. What am I missing?

http://www.babylonjs-playground.com/#7UJDBL#7

Share this post


Link to post
Share on other sites
On 6/11/2018 at 7:53 PM, Deltakosh said:

And your code was wrong it is particleTexture and not texture:

http://www.babylonjs-playground.com/#7UJDBL#8

My bad, thanks.

 

On 6/11/2018 at 7:53 PM, Deltakosh said:

Looking back at my replies I wasn't clear, so I'll try to rephrase. My question was:

In this case where I only need to precompile, why emulate texture and emitter and call particleSystem.isReady() rather than call

this._recreateUpdateEffect();

this._recreateRenderEffect();

and wait for this._updateEffect.isReady() && this._renderEffect.isReady()

so that I don't need to emulate texture and emitter? In practicality this doesn't make a difference but I'm just curious.

http://www.babylonjs-playground.com/#7UJDBL#11

 

Assuming the latter is also viable, I noticed I simply don't see anything for it in compiledEffects even though isReady() returns true, same as when emulating texture and emitter:

http://www.babylonjs-playground.com/#7UJDBL#8

 

I recall you told me something about it at some point, I can't remember what.

1) Does the compilation of GPU particle system effect use a different function than all other effects? I tried to log name in Engine/createEffect() and I don't see any hint of a GPUParticleSystem related effect.

2) Is it possible to create a completely empty texture for temporary purposes like in this case? If so, how do I do that?

Share this post


Link to post
Share on other sites

Well you are right regarding _recreateUpdateEffect and _recreateRenderEffect: you can call then and then wait for each effect to be ready. it is perhaps a little bit more hacky

The problem is that onBeforeShaderCompilationObservable is called before the shader gets compiled and thus before it is added to the _compiledEffect

 

Regarding a temp texture, you can create a 1x1 RawTexture I guess

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.