Derived from the cocosair-rendering skill and its canonical docs/source pointers; reorganized on 2026-10-11. Source annotations below identify repository inputs, not files guaranteed to ship to npm consumers.
Contracts
- Ordinary directional lights share ONE
scene.renderScene.mainLight(there is noScene.mainLightaccessor; the engine warn text below saysscene.mainLightloosely):_attachToScenecallsaddDirectionalLightthensetMainLightfor every directional it activates (src/cocos/3d/lights/light-component.ts:291,:292), so the LAST activated directional wins and the earlier one stops contributing; the legacy forward camera UBO shadesmainLightonly (src/cocos/render-scene/core/render-scene.ts:100). Registration emits a single warn when the list reaches two (:338), text[AIR_W_DIRECTIONAL_LIGHT_LIMIT] ordinary directionals share one legacy mainLight; extra registered lights do not add illumination. Inspect scene.mainLight..inspectAirDirectionalLights(scene)reports identity and nothing else -status: 'unavailable'withlights: []while the scene has no native render scene (src/air/rendering/engine-contracts.ts:106), thenscope: 'legacy-forward-main-directional',ordinaryDirectionalCapacity: 1,selection: 'native-mainLight'(:107-108) and one entry per registered light witheffective: light === native.mainLight(:110); it applies no brightness threshold. - Shadows need four independent switches and no path warns when one is missing:
scene.globals.shadows.enabled(defaultfalse,src/cocos/scene-graph/scene-globals.ts:987),scene.globals.shadows.type = ShadowMap(the field default isPlanar,:989), the light's ownshadowEnabled(defaultfalse,src/cocos/3d/lights/directional-light-component.ts:55), andrenderer.shadowCastingMode = MeshRenderer.ShadowCastingMode.ON(component defaultOFF,src/cocos/3d/framework/mesh-renderer.ts:339, static enum at:318).ShadowFlow.renderreturns at its guard unlessenabled && type === ShadowMap(src/cocos/rendering/shadow/shadow-flow.ts:116), the map pass then serves onlycamera.scene.mainLight(:140), and culling drops any model whosecastShadowis false (src/cocos/rendering/scene-culling.ts:193) or whose world bounds are missing (:132). - The scene-global object mirrors into the pipeline object on a defined schedule:
SceneGlobals.activatebindssceneData.shadowswhen the scene activates (src/cocos/scene-graph/scene-globals.ts:1709, driven fromsrc/cocos/scene-graph/scene.ts:204) andShadowsInfo.activatethen callsresource.initialize(this)andactivate()(:1022-:1025), which copiesenabledand forces the internalSHADOW_TYPE_NONEwhile disabled (src/cocos/render-scene/scene/shadows.ts:367,:368); after activation theenabled/typesetters push straight through (src/cocos/scene-graph/scene-globals.ts:867,:886; pipeline-side setterssrc/cocos/render-scene/scene/shadows.ts:217,:230).ShadowType,PCFType,CSMLevelandShadowsare not export names on the default bundle face, so Code First callers pass the ordinals0Planar and1ShadowMap (src/cocos/render-scene/scene/shadows.ts:80,:88) and readdocs/manual/shadow-support-matrix.mdfor which light types cast at all. - A render target negotiates with the driver and you only learn the outcome from
info:AirTargetColorFormatis exactly'rgba8' | 'rgba16f' | 'rgba32f' | 'srgb8-alpha8'(src/air/rendering/render-target.ts:14),samplesis exactly the literal set1 | 2 | 4 | 8(:23, validated:105) intersected with the device's color and depthSAMPLESsupport (:114-:117), andsampleFallbackdefaults to'error'(:100) - an unsupported count then throwsAIR_E_RENDER_TARGET_SAMPLESlisting the supported set (:120), while'lower'silently selects the largest supported value at or below the request (:119). Even a negotiated value is provisional: a mismatched driverSAMPLESreading after allocation throwsAIR_E_RENDER_TARGET_SAMPLES(:179). The frozeninfogetter (:138-:142) is the only readout, separatingrequestedfromeffectiveand exposingsamples,resolveRequired(trueonly above 1 effective sample,:141),supportedSamples,glSamples,generationanddisposed. - The target owns the native object and its identity changes on resize:
attachCamerastores the camera's priortargetTexture, assigns its own and registersRENDER_CAMERA_BEGIN/RENDER_CAMERA_ENDlisteners - the end listener callingresolve()so the next camera samples in the same frame - then returns thedetach()closure (src/air/rendering/render-target.ts:200,:203,:204,:213).resolve()is a no-op at 1 sample (:218). A successful resize builds a new nativeRenderTextureand rebinds attached cameras by reassigningcamera.targetTexture(:192); code assigningcamera.targetTextureby hand must follow the new object itself (docs/manual/rendering-contracts.md:32).texture/depthTextureare borrowed views anddispose()unbinds, detaches and repeats safely (:280,:281). AirTransmissionCaptureallows exactly one capture per scene and says so loudly:onEnablescans the module-level active set and throws when another enabled capture sharesnode.scene(src/air/rendering/transmission-capture.ts:103-:105), because a material instance carries one scene-color binding. AssigningmainCamerare-arms an already-enabled capture so node-activation ordering cannot strand it (:81-:86), the capability is armed only while enabled on a WebGL2 device (:112,:65), andonDisable/onDestroyrelease bindings and restore main-camera visibility before theRenderTexturedies (:120,:130).- Color decisions are preflight only and the accepted pairing set is closed:
decodeisnone | shader-srgb | hardware-srgb(src/air/rendering/color-contract.ts:35), andhardware-srgbis accepted exactly when the resolved format is in the sRGB set - every other pairing throws at:45withhardware-srgb requires an sRGB GPU format; an sRGB format already decodes RGB and must not be software-decoded again, a non-colorusage carrying an sRGB format or any decode other thannonethrows at:44withnormal/roughness/metallic/depth data must remain linear, with no sRGB decode, andusagedisagreeing withisAirDepthFormatthrows at:43. An explicitlyundefinedformat throwsAIR_E_TEXTURE_FORMATinstead of taking the default (:24); every rejection is anAirColorContractError extends TypeErrorformatted[code] property: message(:6-:9). Nothing is repaired: the module never changes texture bytes, standard material decode or framebuffer output (:37). - Post-process reachability is three different layers, and the custom pipeline is compiled but inert by default.
custom-pipelineIS element 10 of the defaultAIR_FEATURESlist (tools/build/build.cjs:27) andrenderingIS a name in the built bundle's export block (src/exports/custom-pipeline.ts:4), but the aggregate source file theairunit builds from never re-exports./custom-pipeline(src/exports/air.ts:6-:42), soimport { rendering }resolves against the built ESM artifact while the aggregate source face does not surface it at all. At runtimegamereads therendering.customPipelinesetting and, being falsy for AIR because bootstrap passes onlyrendering.renderMode(src/air/bootstrap.ts:152), assignscclegacy.rendering = undefined(src/cocos/game/game.ts:804);Root.setRenderPipeline(false)takes the legacy branch and clearsusesCustomPipeline(src/cocos/root.ts:385,:392), and the director wires a custom builder only while that flag andcclegacy.renderingare both live (src/cocos/game/director.ts:857). The single reader ofcamera.usePostProcessis the custom-pipelinePostProcessBuilder(src/cocos/rendering/post-process/post-process-builder.ts:201), registered under'Forward'and'Custom'(src/cocos/rendering/post-process/index.ts:9), so thepostProcessnamespace the aggregate does export (src/exports/air.ts:39) compiles and never runs unless a variant build plus a truthy setting take over;docs/reference/owner-decisions.md:42records those gates and the variant-evidence resolution. - Capability layers stay separate.
createAirRenderTarget,AirRenderTarget,AirTransmissionCapture,TRANSMISSION_LAYER,isTransmissionMaterial,inspectAirDirectionalLights, the color-contract functions, the five light components,renderingandpostProcessall resolve by symbol name in the single export block ofbuild/cocosair.module.js(626 names parsed) - a build lookup, not browser verification.ShadowType,PCFType,CSMLevel,Shadows,LightType,ModelShadowCastingMode,legacy_rendering,FormatandPixelFormatare not export names there: the GFX enums arrive only as the namespacegfx(src/exports/base.ts:34,:46), so a format is writtengfx.Format.RGBA8(ordinal 35) orgfx.Format.SRGB8_A8(37), andAirTargetColorFormat,AirRenderTargetOptions,AirRenderTargetInfo,AirTextureColorContractare declarations only. No recorded browser evidence in this repository covers the default bundle'srenderingface, anddocs/evidence/examples-verified.jsonproves only the candidate fingerprint it records, not today's bytes.