Jump to content

Latency in procedural Texture


Recommended Posts

Hi everybody !


I want to experiment my own SSAO, and render it in a proceduralTexture instead of using postProcess (for several things).

It works pretty well, but i have some "latency" when i move around my object. I guess this is due to the speed calculation difference between the procedural texture and the main frame.

Can i force the engine to "wait" my procedural Texture each frame ?

Link to comment
Share on other sites

Thank you for your answers !


@RaananW, there is no problem with the framerate, 60fps on deskop, a little bit lower on mobile, but it still acceptable.

@Deltakosh, i should get the same result as using post process method ? Even if i use multiple procedural textures in the effect pipeline ? (one fore the main SSAO, one for the blur pass)

Maybe i should make a little playground to show you the problem.

Link to comment
Share on other sites

First of all thanks for the PG, this is far easier now :)

This issue comes from the following fact: procedural textures are generated BEFORE depth renderer.


Procedural textures are generated before any camera rendering (because they are independant). Then render targets (including depth renderer) are generating for every camera


Link to comment
Share on other sites

Okaaaayyyy, thank you, you're a damn wizzard, I understand now :)

I don't want to use renderTargetTexture because it implies to render the scene multiple times, and it's useless since i just need to deal with the DepthRender in my texture.

Furthermore, I target mobile devices, and I want to optimize the perf.


The last solution that i see is to use Post effects, but I've noticed that when I use it, webgl antialiasing seems to be disabled.


So, what can I use instead of Procedural Textures ?

Link to comment
Share on other sites

  • 2 weeks later...

Hello everybody,

I follow your advise, I tried to use renderTarget Texture instead of procedurals. Unfortunatly, it took too much ressources for my purpose :/

Is there a way to "wait" the depth Texture to be ready, before refreshing procedural texture ?

( for instance, generate SSAO in a depthbuffer onAfterRender function, or something else ?)

Link to comment
Share on other sites

Unfortunatly, i'm not able to share the entire project (which is necessary to show you the effective perf cost).

However, i have an idea. In my opinion, the main problem is that i push the entire scene in the renderlist (like your depthbuffer). But it is totaly useless in my case.

So, if I push a simple plane facing the screen in my render list instead of the entire scene, and apply SSAO shader on it, it should works, right ?

Link to comment
Share on other sites


i wanna make a  latency effect and need to make close my   imagining  and yours  i wanna  know more about your imagining

(any video sample or other media ) for latency effect ( like speed blur for objects or all scene texture have this effect when camera move ?)

Link to comment
Share on other sites

Hi NasimiAsl,

All scene have this effect when camera move (you can see it in my two playgrounds).

I understand what happens. Each frames, my texture is refreshed before the depth Buffer, but it should be did after.

This implies an offset of 1 frame between the two textures (my texture use the previous result of the depth Buffer since it is not refreshed yet).

I am actually playing with the refresh rate of the depth Buffer, but obviously it is not a good idea.

Is there a way to manage the renderTarget Textures order ?

Link to comment
Share on other sites

test this

1. create scene with all texture

2. create render target for depth Buffer

3. make two postprocess

  one for get your real texture

and 2 for make your second material

4 use getTextureFromPostProcess to give it back

i have a sample (long time ago )

http://www.babylonjs-playground.com/#1HECPU#46 real textures and make post process and render target

http://www.babylonjs-playground.com/#1HECPU#45  color

http://www.babylonjs-playground.com/#1HECPU#4  set effect for my wanted color 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...