Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ShaderMaterial: Extension fragDepth no longer working. #18576

Closed
4 of 12 tasks
dragly opened this issue Feb 7, 2020 · 5 comments · Fixed by #18577
Closed
4 of 12 tasks

ShaderMaterial: Extension fragDepth no longer working. #18576

dragly opened this issue Feb 7, 2020 · 5 comments · Fixed by #18577
Labels

Comments

@dragly
Copy link
Contributor

dragly commented Feb 7, 2020

Description of the problem

In the latest version of three.js, the fragDepth extension no longer works.

Here is an example that simply sets the fragment depth in version r110, which works fine:

https://jsfiddle.net/5o9s8kru/

Here is a corresponding example using version r113:

https://jsfiddle.net/5o9s8kru/1/

The relevant shader material is set up as follows:

    var material = new THREE.ShaderMaterial( {
        extensions: {
          fragDepth: true,
        },
        fragmentShader: `
        void main() {
        	gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
          gl_FragDepthEXT = 0.5;
        }
        `,
        vertexShader: `
        void main()	{
            gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0 );
        }`
    } );

In the most recent version, the shader compilation fails with

ERROR: 0:110: 'GL_EXT_frag_depth' : extension is disabled

The error is caused by a typo introduced in #18279, where fragDepth is replaced with frawbuffer:

#18279 (comment)

Three.js version
  • Dev
  • r113
Browser
  • All of them
  • Chrome
  • Firefox
  • Internet Explorer
OS
  • All of them
  • Windows
  • macOS
  • Linux
  • Android
  • iOS
dragly added a commit to dragly/three.js that referenced this issue Feb 7, 2020
Otherwise, it is no longer possible to enable the fragDepth extension.

Fixes mrdoob#18576
@Mugen87 Mugen87 added the Bug label Feb 7, 2020
@Mugen87 Mugen87 changed the title Material extension fragDepth no longer working ShaderMaterial: Extension fragDepth no longer working. Feb 7, 2020
@Mardonis
Copy link

Mardonis commented Feb 7, 2020

Hello,

Upon doing an excellent threejsfundementals.org tutorial https://threejsfundamentals.org/threejs/lessons/threejs-fundamentals.html, where at the bottom it shows you three cubes spinning, I am getting two warnings as follows for v113 but if you change it to v112 or below say v110 it is fine errors go away as stated by @dragly. Is this part of that bug? Hope this helps.

THREE.WebGLRenderer: EXT_frag_depth extension not supported.
get | @ | three.module.js:16000
  | WebGLPrograms.getParameters | @ | three.module.js:18725
  | initMaterial | @ | three.module.js:24971
  | setProgram | @ | three.module.js:25161
  | WebGLRenderer.renderBufferDirect | @ | three.module.js:24193
  | renderObject | @ | three.module.js:24953
  | renderObjects | @ | three.module.js:24923
  | WebGLRenderer.render | @ | three.module.js:24702
  | render | @ | main.js:84
  | requestAnimationFrame (async) |   |  
  | main | @ | main.js:89
  | (anonymous) | @ | main.js:92

THREE.WebGLRenderer: EXT_shader_texture_lod extension not supported.
get | @ | three.module.js:16000
  | WebGLPrograms.getParameters | @ | three.module.js:18727
  | initMaterial | @ | three.module.js:24971
  | setProgram | @ | three.module.js:25161
  | WebGLRenderer.renderBufferDirect | @ | three.module.js:24193
  | renderObject | @ | three.module.js:24953
  | renderObjects | @ | three.module.js:24923
  | WebGLRenderer.render | @ | three.module.js:24702
  | render | @ | main.js:84
  | requestAnimationFrame (async) |   |  
  | main | @ | main.js:89
  | (anonymous) | @ | main.js:92

Thanks
Mardonis

@Mugen87
Copy link
Collaborator

Mugen87 commented Feb 7, 2020

I don't think these warnings are related to this issue. Seems like the mentioned extensions are not supported by your platform.

@Mardonis
Copy link

Mardonis commented Feb 7, 2020

I thought the same thing as well but find it odd that it would work for v112 but not v113. If you goto a codepen example for that link I gave with the three cubes and click on the console and change to v113 what does it say on your platform?

@Mugen87
Copy link
Collaborator

Mugen87 commented Feb 7, 2020

Do you mean the live examples on threejsfundamentals? Well, I've changed one example to import * as THREE from 'https://threejs.org/build/three.module.js'; which means the latest version R113 is now used. I see no warnings after doing this

Also note that this issue only affects custom materials which enable a specific extension. This is not relevant for the examples at threejsfundamentals.

@Mardonis
Copy link

Mardonis commented Feb 7, 2020

Ok thank you, I will try and look more into this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants