question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Changing RenderTarget's texture parameters on the fly

See original GitHub issue

Sometimes, when we want to save some memory, it happens that we have to reuse a render target, by just changing some possible parameters on the fly. I am talking about wrapping and filtering, obviously not format and type. Changing these parameters is (generally) fast enough (depending on the drivers).

However, it is not currently possible to do that, because of this part of the code:

https://github.com/mrdoob/three.js/blob/dev/src/renderers/webgl/WebGLTextures.js#L225-L244

As a WebGLRenderTarget has obviously no image attribute.

Maybe I am missing something, but it looks like the data uploading and the parameters and couple together. Am I the only one looking for a change on this side?

It would be nice to separate the data uploading from the parameters.

Three.js version
  • All of them
Browser
  • All of them
OS
  • All of them

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:1
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
Mugen87commented, Jul 3, 2018

Right now, texture parameters are set via setTextureParameters() in WebGLTextures. This function is used among others in uploadTexture().

But using texParameteri just requires a bindTexture call and not a texImage2D. So yes, it is basically possible to separate parameter settings from the actual texture upload.

0reactions
gradientLordcommented, Apr 6, 2022

I actually got this working in my app for a while, I was able to update anisotropy, min and mag filters of my renderTarget. Would still get the tex2d errors but it worked.

Unfortunately while refactoring I took out some other Render Targets and it randomly stopped working. Couldn’t isolate the exact culprit.

Currently looking for a hack to fix it, so if anyone has any ideas pls let me know!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Introduction to Render Targets - Unreal Engine 4 Tech Art ...
Here we see...- how to create render targets - what the different formats options are- how to draw into them using scene capture...
Read more >
Draw on Render Target Texture - Unreal Engine Forums
Is there any way to draw textures and send them into material. ... because that allows me to pass parameters to it and...
Read more >
Unreal Engine 4 Tutorial: Painting With Render Targets
Next, go to the Set Texture Parameter Value node and set Parameter Name to RenderTarget. This will pass in the render target to...
Read more >
Drawing with Render Targets in the Unreal Engine - Sudo null
Go to the Materials folder . Create an M_Brush material and open it. First set the Blend Mode to Translucent . This will...
Read more >
Tutorial 14 : Render To Texture
What we're going to render to is called a Framebuffer. It's a container for textures and an optional depth buffer. It's created just...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found