8thwall / web

8th Wall Web projects and resources.
518 stars 326 forks source link

update playcanvas shader properties #234

Closed evanmcarlson closed 3 months ago

evanmcarlson commented 3 months ago

The shader properties for playcanvas have changed in latest engine update - if you could please update this function this is the fix required below

xrcontroller.prototype.makeShadowMaterial = function({ pc, material }) {
const n = material.resource || material
n.chunks.APIVersion = pc.CHUNKAPI_1_65
n.chunks.endPS = "\n      litArgs_opacity = mix(light0_shadowIntensity, 0.0, shadow0);\n      gl_FragColor.rgb = vec3(0.0);\n    "
n.blendType = pc.BLEND_PREMULTIPLIED
n.update()
}

https://forum.8thwall.com/t/playcanvas-shader-material-not-working-xrextras-playcanvas-makeshadowmaterial/2177

atomarch commented 3 months ago

Is this backwards compatible with previous versions of the PlayCanvas engine? Wondering we can/should check engine version to determine which version of the shader is appropriate?