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

getting uvundefined and constructor errors #44

Open
pranavmalikk opened this issue Apr 9, 2024 · 2 comments
Open

getting uvundefined and constructor errors #44

pranavmalikk opened this issue Apr 9, 2024 · 2 comments

Comments

@pranavmalikk
Copy link

pranavmalikk commented Apr 9, 2024

I get a couple of errors when i'm calling SSGI in the latest version of the repo. I built this myself since npm was a little behind. I also tested this on the older npm version and i get the same errors. I'm using a couple gltf's and a boxGeometry. I thought this had to do with uv's but it seems boxGeometry has accurate uv's so that can't be the issue. And my GLTF's rendered fine in the previous version but now they don't render at all with the updated build.

THREE.WebGLProgram: Shader Error 0 - VALIDATE_STATUS false

Material Name: undefined
Material Type: MeshPhysicalMaterial

Program Info Log: Vertex shader is not compiled.

VERTEX

ERROR: 0:400: 'uvundefined' : undeclared identifier
ERROR: 0:400: 'constructor' : not enough data provided for construction


  395: void main() {
  396: #if defined( USE_UV ) || defined( USE_ANISOTROPY )
  397: 	vUv = vec3( uv, 1 ).xy;
  398: #endif
  399: #ifdef USE_MAP
> 400: 	vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;
  401: #endif
  402: #ifdef USE_ALPHAMAP
  403: 	vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;
  404: #endif
  405: #ifdef USE_LIGHTMAP
  406: 	vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;

I tried these configurations

Latest Github Repo build:

<postEffectsComposer ref={composerRef} args={[gl]}>
        <postRenderPass args={[scene, camera]} attach={(parent, self) => parent.addPass(self)} />
        <velocityDepthNormalPass
          ref={velocityDepthNormalPassRef}
          args={[scene, camera]}
          attach={(parent, self) => parent.addPass(self)}
        />
        {velocityDepthNormalPassRef.current && composerRef.current && (
          <postEffectPass
            args={[camera, new SSGIEffect(composerRef.current, scene, camera, velocityDepthNormalPassRef.current)]}
            attach={(parent, self) => parent.addPass(self)}
          />
        )}

Previous NPM install 1.1.2:

<postEffectsComposer ref={composerRef} args={[gl]}>
      <postRenderPass args={[scene, camera]} attach={(parent, self) => parent.addPass(self)} />
      <velocityDepthNormalPass
        ref={velocityDepthNormalPassRef}
        args={[scene, camera]}
        attach={(parent, self) => parent.addPass(self)}
      />
      {velocityDepthNormalPassRef.current && (
        <postEffectPass
          args={[camera, new SSGIEffect(scene, camera, velocityDepthNormalPassRef.current)]}
          attach={(parent, self) => parent.addPass(self)}
        />
      )}
  )

One thing i want to note is that i'm able to successfully utilize the following:

{velocityDepthNormalPassRef.current && composerRef.current && (
          <postEffectPass
            args={[
              camera,
              // new HBAOEffect(composerRef.current, camera, scene),
              new MotionBlurEffect(velocityDepthNormalPassRef.current),
              new SharpnessEffect(0.5),
              // new TRAAEffect(scene, camera, velocityDepthNormalPassRef.current),
              (() => {
                const effect = new SMAAEffect({
                  preset: SMAAPreset.MEDIUM,
                  edgeDetectionMode: EdgeDetectionMode.COLOR,
                  predicationMode: PredicationMode.DEPTH,
                });
                if (effect.edgeDetectionMaterial) {
                  const edgeDetectionMaterial = effect.edgeDetectionMaterial;
                  edgeDetectionMaterial.edgeDetectionThreshold = 0.02;
                  edgeDetectionMaterial.predicationThreshold = 0.002;
                  edgeDetectionMaterial.predicationScale = 1;
                }
                return effect;
              })(),
            ]}
            attach={(parent, self) => {
              parent.addPass(self);
              return () => {
              };
            }}
          />
        )}

specifically MotionBlur and SharpnessEffect

@pranavmalikk pranavmalikk changed the title getting uv getting uvundefined and constructor errors Apr 9, 2024
@pranavmalikk pranavmalikk reopened this Apr 10, 2024
@pranavmalikk
Copy link
Author

pranavmalikk commented Apr 10, 2024

i've tried multiple solutions, but none seem to work. For some reason i'm able to do processes like HBAOEffect, MotionBlurEffect, TRAAEffect. Just the SSGI is giving me the above error. I've tried reworking the threejs libraries to get the right versioning, tried multiple different rendering codes, and pretty much everything available but it doesn't work. It states my error is here:

useFrame((state, delta) => {
gl.autoClear = true;
composerRef.current?.render(delta);
}, 1);

specifically on composerRef.current?.render(delta); but it's strange that the code works perfectly with the other post processing just not ssgi

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

2 participants
@pranavmalikk and others