Dynamically turn on/off antialiasing and shadows i

2020-02-15 08:48发布

How can I dynamically turn on and off antialiasing and shadows in WebGLRenderer?

Simply changing the properties of anti-aliasing and shadowMapEnable does not work. I looked in the source and found a method updateShadowMap () but it was removed in release 69.

UPDATE: OK, the answer to the second half of the question I found here https://github.com/mrdoob/three.js/issues/2466

As a result the following code works fine:

renderer.shadowMapEnabled = false;

for(var i in tiles.children)
tiles.children[i].material.needsUpdate=true;

renderer.clearTarget( sun.shadowMap );

1条回答
倾城 Initia
2楼-- · 2020-02-15 09:16

You can't enable/diable antialiasing from a WebGL context after creation. The only way is to create a new context and submit all the buffers and textures again.

So, ideally you would only need to create a new WebGLRenderer with the antialias boolean. This doesn't work yet thought, but I'm working to have it working ASAP.

查看更多
登录 后发表回答