{"record":{"id":"8213ba9283de0ed2","repo":"stride3d/stride","slug":"only-texture-cube-are-currently-supported-as-input-of-8213ba","errorCode":null,"errorMessage":"Only texture cube are currently supported as input of 'LambertianPrefilteringNoCompute' effect.","messagePattern":"Only texture cube are currently supported as input of 'LambertianPrefilteringNoCompute' effect\\.","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"sources/engine/Stride.Rendering/Rendering/ComputeEffect/LambertianPrefiltering/LambertianPrefilteringSHNoCompute.cs","lineNumber":66,"sourceCode":"            : base(context, \"LambertianPrefilteringSHNoCompute\")\n        {\n            firstPassEffect = new ImageEffectShader(\"LambertianPrefilteringSHNoComputeEffectPass1\");\n            secondPassEffect = new ImageEffectShader(\"LambertianPrefilteringSHNoComputePass2\");\n\n            HarmonicOrder = 3;\n        }\n\n        protected override void DrawCore(RenderDrawContext context)\n        {\n            var inputTexture = RadianceMap;\n            if (inputTexture == null)\n                return;\n\n            var coefficientsCount = harmonicalOrder * harmonicalOrder;\n            var faceCount = inputTexture.ViewDimension == TextureDimension.TextureCube ? 6 : 1;\n            if (faceCount == 1)\n            {\n                throw new NotSupportedException(\"Only texture cube are currently supported as input of 'LambertianPrefilteringNoCompute' effect.\");\n            }\n            firstPassEffect.Parameters.Set(SphericalHarmonicsParameters.HarmonicsOrder, harmonicalOrder);\n            firstPassEffect.Parameters.Set(LambertianPrefilteringSHNoComputePass1Keys.RadianceMap, inputTexture);\n\n            // Create a tree of power-of-two textures for summing up coefficients\n            var intermediateSize = new Int2(MathUtil.NextPowerOfTwo(inputTexture.Width), MathUtil.NextPowerOfTwo(inputTexture.Height));\n            var intermediateTextures = new List<Texture>();\n\n            intermediateTextures.Add(NewScopedRenderTarget2D(intermediateSize.X, intermediateSize.Y, PixelFormat.R32G32B32A32_Float));\n            while (intermediateSize.X > 1 || intermediateSize.Y > 1)\n            {\n                if (intermediateSize.X > 1)\n                    intermediateSize.X >>= 1;\n                if (intermediateSize.Y > 1)\n                    intermediateSize.Y >>= 1;\n\n                intermediateTextures.Add(NewScopedRenderTarget2D(intermediateSize.X, intermediateSize.Y, PixelFormat.R32G32B32A32_Float));\n            }","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/engine/Stride.Rendering/Rendering/ComputeEffect/LambertianPrefiltering/LambertianPrefilteringSHNoCompute.cs#L48-L84","documentation":"LambertianPrefilteringSHNoCompute is the raster (non-compute) variant of SH prefiltering and likewise only accepts cubemap inputs. DrawCore throws NotSupportedException when the input texture is not a TextureCube.","triggerScenarios":"Drawing the effect with inputTexture whose ViewDimension is Texture2D (or null handling path returning early not taken).","commonSituations":"Same as the compute variant: passing a panorama/2D environment texture; a configuration mix-up in the lighting precompute step.","solutions":["Supply a cubemap texture as input.","Convert 2D environment maps to cubemaps first.","Guard with inputTexture.ViewDimension == TextureDimension.TextureCube before invoking."],"exampleFix":"// before\nnoComputePrefilter.Draw(context, equirectTexture);\n// after\nif (equirectTexture.ViewDimension != TextureDimension.TextureCube) equirectTexture = ConvertToCubemap(context, equirectTexture);\nnoComputePrefilter.Draw(context, equirectTexture);","handlingStrategy":"validation","validationCode":"if (inputTexture?.ViewDimension != TextureDimension.TextureCube) throw new ArgumentException(\"LambertianPrefilteringNoCompute requires a TextureCube input\");","typeGuard":"bool IsCube(Texture t) => t?.ViewDimension == TextureDimension.TextureCube;","tryCatchPattern":"try { prefilter.Draw(context, inputTexture); } catch (NotSupportedException ex) { log.Error(ex, \"SH NoCompute prefiltering needs a cubemap input\"); }","preventionTips":["Reuse a shared cubemap-conversion utility for all prefilter effects.","Check ViewDimension when loading environment assets."],"tags":["stride","rendering","cubemap","spherical-harmonics"],"backgroundTag":"incompatible-source-type","analyzedSha":"96fad776d210c221682aac1ccdf4c79dc046fc38","analyzedAt":"2026-09-14T02:59:31.279Z","contentChangedAt":"2026-09-14T02:59:31.279Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}