pmndrs / postprocessing

A post processing library for three.js.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

EffectComposer fails to replace the name of affected functions in GLSL

lorow opened this issue · comments

Description of the bug

From what I read from your wiki - it looks like the EffectComposer, when combining shaders, does something with shaders that have more than a couple functions.

It seems that it tries to rename them to avoid conflicts, but fails to replace the actual function name, making the shader fail during compilation.

FRAGMENT

ERROR: 0:430: 'e1_customBlockyNoise' : no matching overloaded function found
ERROR: 0:436: 'e1_customBlockyNoise' : no matching overloaded function found
�

  425: 	if (line > 0.333)
  426: 		mask = vec3(0.0, 3.0, 0.0);
  427: 	if (line > 0.666)
  428: 		mask = vec3(0.0, 0.0, 3.0);
  429: 
> 430: 	float maskNoise = e1_customBlockyNoise(myUv, interlaceIntensity, 90, time) * max(displace, offs.x);
  431: 	maskNoise = 1.0 - maskNoise; // we reverse the mask e1Noise
  432: 
  433: 	if (maskNoise == 1.0)
  434: 		mask = vec3(1.0);
  435: 
  436: 	float dropout = e1_customBlockyNoise(myUv, dropoutIntensity, 11.0, time) * e1_customBlockyNoise(myUv.yx, dropoutIntensity, 90, time);

As you can see, it tried to replace the CustomBlockyNoise function with its own e1_customBlockyNoise.
I've linked a demo on stackblitz below with that issue reproduced.

To reproduce

https://stackblitz.com/edit/postprocessing-v6-1ju1sj

Expected behavior

Shader compiles, probably fails and makes me sad but hopeful that eventually I'll get it to work

Library versions used

  • Three: 0.161.0
  • Post Processing: 6.35.2

Desktop

  • OS: MacOS / Windows / sandboxes
  • Browser Chrome / Firefox
  • Graphics hardware: M2 / Nvidia

Effect merging is working as intended.

Your function customBlockyNoise expects parameters of type (vec2, float, float, float), but you're passing an int(90) in two places. Here's an updated working example:

https://stackblitz.com/edit/postprocessing-v6-xehsfp

Ah, crap, that's a rookie mistake on my part. Sorry about that. I have no idea how I missed it, but thank you very much for the help!

I think we can close the issue then

np, glad I could help!