laanlabs / SCNTechniqueGlow

Basic object glowing outline using SCNTechnique
MIT License
81 stars 12 forks source link

Crashing 'renderPipelineState must be set'. Attribute 0 incompatible with MTLStepFunctionPerPatchControlPoint. #11

Open smuravev opened 6 years ago

smuravev commented 6 years ago

Hello,

First thnx a lot for your awesome 'SCNTechniqueGlow' example. I got crash issue on-runtime for some 3D models when I set .categoryBitMask = 2. Let me share the log output - maybe you can recommend something what the possible reason of it ?

2018-08-06 20:58:33.442735+0600 IPD[16763:7814333] [SceneKit] Error: Compiler error while building render pipeline state for node "BODY" (0x137ad9030):
Error Domain=AGXMetalA9 Code=3 "Attribute 0 incompatible with MTLStepFunctionPerPatchControlPoint." UserInfo={NSLocalizedDescription=Attribute 0 incompatible with MTLStepFunctionPerPatchControlPoint.}

2018-08-06 20:58:33.442771+0600 IPD[16763:7814333] [SceneKit] Error: _executeProgram - no pipeline state
-[MTLDebugRenderCommandEncoder validateCommonDrawErrors:instanceCount:baseInstance:maxVertexID:]:3694: failed assertion 'renderPipelineState must be set.'
willperkins commented 4 years ago

Please check out the latest code, and if you're still having this problem re-open this issue

smuravev commented 4 years ago

Hi,

Thank you very much for your update. With your latest update - there is NO runtime crash error anymore - thnx for that. Unfortunately, Attribute 0 incompatible with MTLStepFunctionPerPatchControlPoint. issue still exists :(

Please see attached model.zip - if we put this model in your GameViewController example - it gives the following error in the log output (NO highlighting glow effect unfortunately):

020-02-09 18:17:34.800511+0600 SCNTechniqueGlow[728:118753] [SceneKit] Error: Compiler error while building render pipeline state for node <C3DNode:0x10400c5b0 "SEATING"
  geometry: <C3DGeometry:0x2812c45b0 "(null)"
  mesh: <C3DMesh 0x2810c4460 "(null)"
  element0: <C3DMeshElement 0x2810c4620 type:triangles primCount:3936 channels:1 indexBytes:2 offset:0 acmr:0.918445 inst:1 dataSize:23616 shared:0x0>
  source position (channel:0) : <C3DMeshSource 0x2802c5c70(position) data:(0x2827bdf80) mut:0 count:2292 type:float3 divisor:0 mtl:0 offset:0 stride:12>
  source normal (channel:0) : <C3DMeshSource 0x2802c5ce0(normal) data:(0x2827be010) mut:0 count:2292 type:float3 divisor:0 mtl:0 offset:0 stride:12>
  source texcoord (channel:0) : <C3DMeshSource 0x2802c5d50(texcoord) data:(0x2827be070) mut:0 count:2292 type:float2 divisor:0 mtl:0 offset:0 stride:8>
  renderable element0: <C3DMeshElement 0x2810c4620 type:triangles primCount:3936 channels:1 indexBytes:2 offset:0 acmr:0.918445 inst:1 dataSize:23616 shared:0x0>
  renderable source position: <C3DMeshSource 0x2802c5c70(position) data:(0x2827bdf80) mut:0 count:2292 type:float3 divisor:0 mtl:0 offset:0 stride:12>
  renderable source normal: <C3DMeshSource 0x2802c5ce0(normal) data:(0x2827be010) mut:0 count:2292 type:float3 divisor:0 mtl:0 offset:0 stride:12>
  renderable source texcoord: <C3DMeshSource 0x2802c5d50(texcoord) data:(0x2827be070) mut:0 count:2292 type:float2 divisor:0 mtl:0 offset:0 stride:8>
  renderable source textangent: <C3DMeshSource 0x2802d7020(textangent) data:(0x28274e850) mut:0 count:2292 type:float4 divisor:0 mtl:0 offset:0 stride:16>
>
  mat0: <C3DMaterial 0x2802c5dc0 : "material_2.1", common profile <C3DCommonProfileEffect 0x2812c4750 : lightingModel:SCNLightingModelPhysicallyBased perPixelLit:1 isOpaque:1 transparencyMode:0[Emission] texture:0 xform:0[Diffuse] texture:1 xform:1[Transparent] texture:0 xform:0[Filter] texture:0 xform:0[Normal] texture:1 xform:1[Ambient Occlusion] texture:1 xform:0[Self Illumination] texture:0 xform:0[Metalness] texture:0 xform:0[Roughness] texture:0 xform:0[ClearCoat] texture:0 xform:0[ClearCoatRoughness] texture:0 xform:0[ClearCoatNormal] texture:0 xform:0[Displacement] texture:0 xform:0>>
>
>:
Error Domain=AGXMetalA11 Code=3 "Attribute 0 incompatible with MTLStepFunctionPerPatchControlPoint." UserInfo={NSLocalizedDescription=Attribute 0 incompatible with MTLStepFunctionPerPatchControlPoint.}

model.zip

If possible, can you please reopen the current BUG and share your ideas, recommendations - how to avoid this issue. How to make glow highlighting effect visible with such kind of models.

Thnx, waiting for your reply, here.

willperkins commented 4 years ago

Hi @smuravev , it looks like the problem is related to tessellation. If you disable geometry tessellation on those nodes, you'll see the error doesn't appear. Will let you know if I figure out a workaround.

smuravev commented 4 years ago

Hi @willperkins ,

Thank you for your advices - it's nice you detected the reason of the issue. I will prepare temporary workaround code in our project to disable tesselation attribute in loaded models. But, it's incorrect (hacky) way for us unfortunately, because we need support all kind of loaded models on runtime. We use ASSIMP library on runtime to convert different 3D formats (such as: .gltf, .dae, .fbx, etc) to Apple .scn on runtime (when model downloaded from server). This means, we can't guarantee right visulisation of geometries (of converted models) if we disable tesselation property. So, please let me know if you fix this issue in your .metal code - this really helps me then.

I also, provided some extra testing (if I disable tesselation in the models), please see results of testing and my QUESTION#01 in the attached screenshots.

emulator-scenekit

real-device-scenekit

real-device-arkit