You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
When I try to use multiple render target, the preset materials doesn't work. Then I try to replace something in onBeforeCompile, like layout(location = 1) out highp vec4 pc_fragColor1;, The shader fail to complie and the error message is 'pc_fragColor' : must explicitly specify all locations when using multiple fragment outputs. The main reason is the code in https://github.com/mrdoob/three.js/blob/dev/src/renderers/webgl/WebGLProgram.js#L725 add the extra code into shader source, and there is no way to modify it.
Describe the solution you'd like
For now, I directly modify some code in three.js, and it is a bad idea.
Describe alternatives you've considered
modify the code in WebGLProgram.js#L725, maybe like this ( parameters.glslVersion === GLSL3 ) ? '' : 'layout(location = 0) out highp vec4 pc_fragColor;', I don't know if this will cause a compatible issue, and if not, why not?
the onBeforeCompile method can get the shader source but not the final shader source. And I wonder if it's possible to have a api to modify the final shader source. Maybe there has some ways, I just don't know.
Additional context
emm...
The text was updated successfully, but these errors were encountered:
Then I try to replace something in onBeforeCompile, like layout(location = 1) out highp vec4 pc_fragColor1;
I'm afraid that does not work since you don't have access to this particular part of the shader program. It's kind of a foundation for all built-in materials (and ShaderMaterial) which is not supposed to be changed by the user.
If you need full controls over the entire shader source, you have to build your material based on RawShaderMaterial.
modify the code in WebGLProgram.js#L725, maybe like this
( parameters.glslVersion === GLSL3 ) ? '' : 'layout(location = 0) out highp vec4 pc_fragColor;', I don't know if this will cause a compatible issue, and if not, why not?
Is your feature request related to a problem? Please describe.
When I try to use multiple render target, the preset materials doesn't work. Then I try to replace something in
onBeforeCompile
, likelayout(location = 1) out highp vec4 pc_fragColor1;
, The shader fail to complie and the error message is'pc_fragColor' : must explicitly specify all locations when using multiple fragment outputs
. The main reason is the code in https://github.com/mrdoob/three.js/blob/dev/src/renderers/webgl/WebGLProgram.js#L725 add the extra code into shader source, and there is no way to modify it.Describe the solution you'd like
For now, I directly modify some code in three.js, and it is a bad idea.
Describe alternatives you've considered
( parameters.glslVersion === GLSL3 ) ? '' : 'layout(location = 0) out highp vec4 pc_fragColor;',
I don't know if this will cause a compatible issue, and if not, why not?onBeforeCompile
method can get the shader source but not the final shader source. And I wonder if it's possible to have a api to modify the final shader source. Maybe there has some ways, I just don't know.Additional context
emm...
The text was updated successfully, but these errors were encountered: