<p dir="auto">I'm updating the Matrix4 docs and there's a method called Matrix4.makePerspective( fov, aspect, near, far )</p>
<p dir="auto">Internally this calculates the values of left, right, top and bottom and calls<br>
Matrix4.makeFrustum( left, right, bottom, top, near, far )<br>
and it looks like it is intended for use in PerspectiveCamera.updateProjectionMatrix()</p>
<p dir="auto">However the PerspectiveCamera calculates its own versions of left, right, top and bottom in a slightly more complex way, taking into account zoom, view (if set) and filmOffset, and then calls Matrix4.makeFrustum directly.</p>
<p dir="auto">So it seems that Matrix4.makePerspective() is superfluous - is there a use case that I am missing?</p>
<h5 dir="auto">Description of the problem</h5>
<p dir="auto">When using a NodeMaterial, setting <code class="notranslate">needsUpdate</code> to <code class="notranslate">true</code> because of a change made to the material will not yield the expected result as it's not recompiled. The change related to <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="525720159" data-permission-text="Title is private" data-url="https://github.com/mrdoob/three.js/issues/17968" data-hovercard-type="pull_request" data-hovercard-url="/mrdoob/three.js/pull/17968/hovercard" href="https://github.com/mrdoob/three.js/pull/17968">#17968</a> produces this result, and when reverting <a href="https://github.com/mrdoob/three.js/pull/17968/commits/b521945d95d261f200c11c1c6ecf5fe8840eda46#diff-e7ff19643959b771a35742c5e98f7c5fL120">this blob in specific</a>, the material updates as expected. This issue is present from r111 and up, possibly relating to the fact that the <code class="notranslate">needsUpdate</code> flag is never reset to <code class="notranslate">false</code>.<br>
In relation, <a href="https://github.com/mrdoob/three.js/issues/18347#issuecomment-572404500" data-hovercard-type="issue" data-hovercard-url="/mrdoob/three.js/issues/18347/hovercard">this proposed change by @sunag</a> (coming from <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="547265887" data-permission-text="Title is private" data-url="https://github.com/mrdoob/three.js/issues/18347" data-hovercard-type="issue" data-hovercard-url="/mrdoob/three.js/issues/18347/hovercard" href="https://github.com/mrdoob/three.js/issues/18347">#18347</a>) seems to work as well:</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="this.onBeforeCompile = function ( shader, renderer ) {
	var materialProperties = renderer.properties.get( this );

	if ( this.version !== materialProperties.__version ) {

		this.build( { renderer: renderer } );

		shader.uniforms = this.uniforms;
		shader.vertexShader = this.vertexShader;
		shader.fragmentShader = this.fragmentShader;

		this.needsCompile = false;
	}
};"><pre class="notranslate"><span class="pl-smi">this</span><span class="pl-kos">.</span><span class="pl-en">onBeforeCompile</span> <span class="pl-c1">=</span> <span class="pl-k">function</span> <span class="pl-kos">(</span> <span class="pl-s1">shader</span><span class="pl-kos">,</span> <span class="pl-s1">renderer</span> <span class="pl-kos">)</span> <span class="pl-kos">{</span>
	<span class="pl-k">var</span> <span class="pl-s1">materialProperties</span> <span class="pl-c1">=</span> <span class="pl-s1">renderer</span><span class="pl-kos">.</span><span class="pl-c1">properties</span><span class="pl-kos">.</span><span class="pl-en">get</span><span class="pl-kos">(</span> <span class="pl-smi">this</span> <span class="pl-kos">)</span><span class="pl-kos">;</span>

	<span class="pl-k">if</span> <span class="pl-kos">(</span> <span class="pl-smi">this</span><span class="pl-kos">.</span><span class="pl-c1">version</span> <span class="pl-c1">!==</span> <span class="pl-s1">materialProperties</span><span class="pl-kos">.</span><span class="pl-c1">__version</span> <span class="pl-kos">)</span> <span class="pl-kos">{</span>

		<span class="pl-smi">this</span><span class="pl-kos">.</span><span class="pl-en">build</span><span class="pl-kos">(</span> <span class="pl-kos">{</span> <span class="pl-c1">renderer</span>: <span class="pl-s1">renderer</span> <span class="pl-kos">}</span> <span class="pl-kos">)</span><span class="pl-kos">;</span>

		<span class="pl-s1">shader</span><span class="pl-kos">.</span><span class="pl-c1">uniforms</span> <span class="pl-c1">=</span> <span class="pl-smi">this</span><span class="pl-kos">.</span><span class="pl-c1">uniforms</span><span class="pl-kos">;</span>
		<span class="pl-s1">shader</span><span class="pl-kos">.</span><span class="pl-c1">vertexShader</span> <span class="pl-c1">=</span> <span class="pl-smi">this</span><span class="pl-kos">.</span><span class="pl-c1">vertexShader</span><span class="pl-kos">;</span>
		<span class="pl-s1">shader</span><span class="pl-kos">.</span><span class="pl-c1">fragmentShader</span> <span class="pl-c1">=</span> <span class="pl-smi">this</span><span class="pl-kos">.</span><span class="pl-c1">fragmentShader</span><span class="pl-kos">;</span>

		<span class="pl-smi">this</span><span class="pl-kos">.</span><span class="pl-c1">needsCompile</span> <span class="pl-c1">=</span> <span class="pl-c1">false</span><span class="pl-kos">;</span>
	<span class="pl-kos">}</span>
<span class="pl-kos">}</span><span class="pl-kos">;</span></pre></div>
<h5 dir="auto">Three.js version</h5>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> Dev</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> r113</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> r112</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> r111</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> r110</li>
</ul>
<h5 dir="auto">Browser</h5>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> All of them</li>
</ul>
<h5 dir="auto">OS</h5>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> All of them</li>
</ul>
<p dir="auto">Paging <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/sunag/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/sunag">@sunag</a>.</p>