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

RawShaderMaterial in Three.js 0.154.1 appears to have a regression #5339

Closed
DougReeder opened this issue Jul 17, 2023 · 3 comments
Closed

RawShaderMaterial in Three.js 0.154.1 appears to have a regression #5339

DougReeder opened this issue Jul 17, 2023 · 3 comments

Comments

@DougReeder
Copy link
Contributor

DougReeder commented Jul 17, 2023

Description:
When instantiating a RawShaderMaterial, this error is logged:

three.module.js:19914 THREE.WebGLProgram: Shader Error 0 - VALIDATE_STATUS false

Program Info Log: Vertex shader is not compiled.

VERTEX

ERROR: 0:3: 'version' : #version directive must occur before anything else, except for comments and white space
ERROR: 0:4: 'in' : storage qualifier supported in GLSL ES 3.00 and above only
ERROR: 0:5: 'in' : storage qualifier supported in GLSL ES 3.00 and above only
ERROR: 0:8: 'out' : storage qualifier supported in GLSL ES 3.00 and above only

  1: #define SHADER_TYPE RawShaderMaterial
  2: #define SHADER_NAME 
> 3: #version 300 es
  4: in vec2 uv;
  5: in vec3 position;
  6: uniform mat4 projectionMatrix;
  7: uniform mat4 modelViewMatrix;
  8: out vec2 vUV;
  9: void main(void) {

FRAGMENT

ERROR: 0:3: 'version' : #version directive must occur before anything else, except for comments and white space

  • A-Frame Version: master 1.4.2 (Date 2023-07-13, Commit #aacacadd)
  • Platform / Device: Chrome on MacOS
  • Reproducible Code Snippet or URL: showcase/model-viewer/ in master
@nightgryphon
Copy link
Contributor

This about to be fixed. The discussion is here
#5328

@dmarcos
Copy link
Member

dmarcos commented Jul 18, 2023

Fixed by #5328

@dmarcos dmarcos closed this as completed Jul 18, 2023
@sigurof
Copy link

sigurof commented Dec 28, 2023

For anyone stumbling over this looking for an answer to why your ThreeJs RawShaderMaterial refuses to compile with this error: ERROR: 0:3: 'version' : #version directive must occur before anything else, except for comments and white space.

Instead of declaring the GLSL version as part of your shader (e.g. # version 300 es) you need to set the glsl version as one of the configuration properties when instantiating the raw shader material:

    const material = new THREE.RawShaderMaterial({
        glslVersion: THREE.GLSL3,
        vertexShader: myVtxShader,
        fragmentShader: myFragShader,

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

No branches or pull requests

4 participants