我想渲染一个点云,并希望每个点渲染不同的大小。如果使用着色器,该怎么办?
SCNGeometry *pointCloud = [SCNGeometry geometryWithSources:@[ positionSource, colorSource ] elements:@[ element ]];
pointCloud.firstMaterial.lightingModelName = SCNLightingModelLambert;
NSString* vertexShader = @" out.fragmentSize = 10.0; ";
NSString* fragmentShader = @" _output.color.rgb = _output.color.rgb - 0.1; ";
pointCloud.firstMaterial.shaderModifiers =@{SCNShaderModifierEntryPointGeometry:vertexShader, SCNShaderModifierEntryPointFragment: fragmentShader };
该代码不起作用!每个点都有相同的大小。