Jump to content

Disable Render Targets and clear frame


gamefan
 Share

Recommended Posts

Hi,

I find renderTargetsOptimization very helpful. Is there a way a renderTarget frame can be cleared so that the last frame before render targets are disabled doesn't stay?

I can set ReflectionTextureEnabled = false, but I want to have reflection textures that don't use render targets.

http://www.babylonjs-playground.com/#1YAIO7#37

In this playground I have disabled render targets after 3 seconds but the ball reflection remains static

Thanks

Link to comment
Share on other sites

You can set each render target with the refresh rate you want:

probe.refreshRate = BABYLON.RenderTargetTexture.REFRESHRATE_RENDER_ONCE;

probe.refreshRate = BABYLON.RenderTargetTexture.REFRESHRATE_RENDER_ONEVERYFRAME;

probe.refreshRate = BABYLON.RenderTargetTexture.REFRESHRATE_RENDER_ONEVERYTWOFRAMES; 

Link to comment
Share on other sites

Hi Deltakosh,

Thank you for your reply but this is not what I want. I want the render targets textures to disappear after renderTargets optimization is done. The scene looks awkward when the render target textures just stay there at their last rendered frame. It looks awkward even for renders at intermittent frames with the use of refreshRate.

I want a result similar to what "StandardMaterial.ReflectionTextureEnabled = false" does.

Thanks

 

Link to comment
Share on other sites

Reflections made by MirrorTexture and ReflectionProbe. We want something like what

material.reflectionTexture = null

would do. (As disabling render targets won't update the reflection texture in the next render frames)

StandardMaterial.ReflectionTexturesEnabled = false 

is the right thing to do but I don't want to disable reflection textures that aren't using render targets.

I think scene.renderTargetsEnabled should render/hide the render target texture. What affect this has now is equivalent to (an imaginary) scene.pauseRenderTargets.

Edited by gamefan
After Thought
Link to comment
Share on other sites

Ok make sense. I'm afraid you will have to go through scene.materials and get reflectionTexture property and then test if texture.isRender is true

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.

Guest
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.

Loading...
 Share

  • Recently Browsing   0 members

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