I’m trying to use EvaluateAdaptiveProbeVolume in a compute shader to estimate how bright an object is (similar to how LightProbes.GetInterpolatedProbe works). I’m encountering an error related to the bakeDiffuseLighting variable.
I’m getting the following error:
variable ‘bakeDiffuseLighting’ used without having been completely initialized at kernel CSMain (ProbeVolume.hlsl:762)
Alternatively you can just #define PROBE_VOLUMES_L1 or #define PROBE_VOLUMES_L2 before including ProbeVolume.hlsl if you know you’ll be using L1 or L2 probes.
Thanks, this solved the previous issue (used #define PROBE_VOLUMES_L2 as I intend to only use those).
However, now I’m getting “Property (_APVResL0_L1Rx) at kernel index (0) is not set” when I’m trying to dispatch the compute shader. Not sure I’m using it as intended since I’m not too familiar with compute shaders. Any advice?
The GPU data used by APV hasn’t been bound. You can use ProbeReferenceVolume.instance.BindAPVRuntimeResources() to bind it. It assumes you have a CommandBuffer, so if you want to use it, you’ll have to use CommandBuffer.DispatchCompute instead of ComputeShader.Dispatch etc. Alternatively you can look at the body of that function and copy the relevant code, but change CommandBuffer.SetGlobalTexture calls to Shader.SetGlobalTexture. You may also need to call ProbeReferenceVolume.instance.UpdateShaderVariablesProbeVolumes() - don’t quite remember.
We should probably have an example of all this in the docs. I’ll look into at some point.
I’m wondering was there anything added to the docs since this post? I’m currently researching same topic and it seems too complicated for me as I’ve never used compute shaders.