ScreenSpaceReflectionPostProcess: Exception in HostFunction: ERROR: 0:8: 'step' : redefinition
Reporting back https://github.com/BabylonJS/Babylon.js/issues/11298 from @igorroman777
I just wanted to integrate ScreenSpaceReflectionPostProcess into babylonjs react native.!
My Code is:
var ssr = new ScreenSpaceReflectionPostProcess("ssr", scene, 1.0, camera);
ssr.reflectionSamples = 32;
ssr.strength = 2;
ssr.reflectionSpecularFalloffExponent = 3;
Repro
- Current result:
ERROR BJS - [21:39:25]: Error: Exception in HostFunction: ERROR: 0:8: 'step' : redefinition ERROR: 1 compilation errors. No code generated.
Android phone:
- Samsung
- Babylonjs react native
- Version: "@babylonjs/core": "5.0.0-alpha.44", "@babylonjs/loaders": "5.0.0-alpha.44", "@babylonjs/react-native": "0.4.0-alpha.33",
@darraghjburke Looks like something is wrong in the shader translation code.
There is a uniform called step
https://github.com/BabylonJS/Babylon.js/blob/5e6321d887637877d8b28b417410abbbeb651c6e/src/Shaders/screenSpaceReflection.fragment.fx#L14
It's a reserved keyword. Changing the name in the shader will fix it. I find it weird that there is no error reported by the browser.
BTW, is there a way to get all shaders from BJS (with variants) and get them through glslang/spirv translation? With UnitTests? I'm sure there are other shaders with such kind of issue. I've already fixed one or two some months ago.
@CedricGuillemet nice find! Will submit a PR for BJS.
As far as testing, that sounds like something we should do, but what would we be testing? If it's the visual output, it should be a validation test probably. If it's the shader output, how would we generate the correct outputs to compare it to?
Was the error caused by glslang? The driver? Can we close this issue?
I have tested with:
"@babylonjs/core": "5.0.0-alpha.57",
"@babylonjs/loaders": "5.0.0-alpha.57",
"@babylonjs/react-native": "0.4.0-alpha.39",
I am now getting another problem:
LOG BJS - [18:40:26]: Babylon Native (v5.0.0-alpha.57) launched
ERROR BJS - [18:40:26]: PrePassRenderer needs WebGL 2 support.
Maybe you tried to use the following features that need the PrePassRenderer :
+ Subsurface Scattering
@igorroman777 To support SSR,we need to add support for the PrePassRenderer to Babylon Native. We're taking a look at what we need to do to make this happen. Thanks for bringing this to our attention!
@CedricGuillemet the error came from program.addShader() online 32 in ShaderCompilerD3D, so glslang. My best guess would be that glslang is just more strict about shader compilation than WebGL
There are options in glslang that we could perhaps play with that may reduce the strictness.
Hey @igorroman777,
The changes to support this feature will be nontrivial. This relies on the createMultipleRenderTarget function, which we don't currently support in Babylon Native. We want to support it eventually, but it isn't currently on our radar.
Is it a must-have for your project?
I have created an issue to track progress on this feature (#945).
some postprocess now works https://github.com/BabylonJS/BabylonNative/pull/1354 SSR not working yet