Dynamically turn on/off antialiasing and shadows in WebGLRenderer

血红的双手。 提交于 2019-11-28 12:13:18

问题


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:


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.



来源:https://stackoverflow.com/questions/27554969/dynamically-turn-on-off-antialiasing-and-shadows-in-webglrenderer

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!