Closed GothParrot closed 1 year ago
Thanks for reporting @GothParrot ! This is super strange. I'm not sure why the shade would be failing to compile like this. I believe this is the shader that's failing:
https://github.com/OmarShehata/webgl-outlines/blob/main/threejs/src/CustomOutlinePass.js#L99
Does the crash happen for you when opening this demo: https://omarshehata.github.io/csb-l01dp/ ?
If so, I would try debugging the shader to figure out where the crash is coming from (removing parts of it until it starts to work).
If it is NOT crashing, I suspect the issue perhaps is how the shader code is being loaded in your project? maybe add a console.log(this.fragmentShader)
in this line: https://github.com/OmarShehata/webgl-outlines/blob/main/threejs/src/CustomOutlinePass.js#L207
or just replace the big fragment shader with a simple one to confirm whether or not it is the cause of the crash.
Closing for now but if you still have issues/are able to reproduce etc feel free to follow up!
Hi, @OmarShehata ! Thank you for your awesome project! I am trying to implement the customOutlinePass in my project (the project is based on "@react-three/fiber").
But I ran into the same problem.(https://github.com/OmarShehata/webgl-outlines/issues/5) I wrote a checklist and checked that it is working well, but I do not know the cause of the bug.
So I attach the test project. Could you please check the issue on the project? I really want to use your outline solution.
@eatdesignlove thank you for sharing your project! It was super helpful in figuring this out.
So there are two issues in your file:
CustomOutlinePass.js
: ' } else {,',
This must be changed to:
' } else {',
saturate()
function for some reason. I can get it to work by renaming it to saturateValue(
and updating the places where it is called in this file. I pushed an update here that does the saturate()
rename so it should work for you/others in the future who run into this:
https://github.com/OmarShehata/webgl-outlines/commit/42e210346abdb2dab78de20df9dffc369297340f
WOW, @OmarShehata !!!! Your quick response was really helpful. 🙏
The first problem was that I thought the cause of the problem might be template literals, so I tried to convert it to an array, but there was a typo. Thanks to that, I found it and fixed it!
The second problem also worked properly as you said, by changing it to saturateValue. Thanks to that, I was able to confirm the desired result.
Now I can apply it to my real project 🔥 I was almost lost for about 3 days because of this.😇 I am very happy now. Thank you so much!!!
Hi Omar, thanks so much for putting this out there!!! Wonderful work. I tried to reproduce it in my own project, but am getting this error on both firefox and Chrome. My browsers support webGL 1 and 2:
It seems like the fragment shader can't be recognized? I simply copied the CustomOutlinePass.js.
Below is what my renderer code looks like. If I comment out the last line,
this.composer.render();
and use the original renderer, the rendering works.