We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
在查看一个模型时,常常需要展示不同的层次效果。例如 glTF-WebGL-PBR 中鼠标悬停到渲染公式的某一部分时会单独展示这部分的效果。在具体实现中是通过 uniform 在 fragment shader 中控制该部分贡献值。
uniform
而 marmoset viewer 可以同时展示多层效果。而且其中的 wireframe 就需要用到重心坐标系了:
The text was updated successfully, but these errors were encountered:
之前总结过一篇 「Wireframe 的实现」。 其中遗留了一个问题是如果存在顶点的共享(使用 indice),会出现共享的顶点无法分配重心坐标的问题:
最近阅读 clay.gl 的代码时,发现解决这个问题也很简单,就是根据 indice 生成非共享的顶点数据:
generateBarycentric: function () { if (!this.isUniqueVertex()) { this.generateUniqueVertex(); } } generateUniqueVertex: function () { var attributes = this.attributes; var indices = this.indices; var attributeNameList = this.getEnabledAttributes(); var oldAttrValues = {}; for (var a = 0; a < attributeNameList.length; a++) { var name = attributeNameList[a]; oldAttrValues[name] = attributes[name].value; attributes[name].init(this.indices.length); } var cursor = 0; for (var i = 0; i < indices.length; i++) { var ii = indices[i]; for (var a = 0; a < attributeNameList.length; a++) { var name = attributeNameList[a]; var array = attributes[name].value; var size = attributes[name].size; for (var k = 0; k < size; k++) { array[cursor * size + k] = oldAttrValues[name][ii * size + k]; } } indices[i] = cursor; cursor++; } this.dirty(); }
Sorry, something went wrong.
feat: add wireframe #1
082fd87
xiaoiver
No branches or pull requests
在查看一个模型时,常常需要展示不同的层次效果。例如 glTF-WebGL-PBR 中鼠标悬停到渲染公式的某一部分时会单独展示这部分的效果。在具体实现中是通过
uniform
在 fragment shader 中控制该部分贡献值。而 marmoset viewer 可以同时展示多层效果。而且其中的 wireframe 就需要用到重心坐标系了:
The text was updated successfully, but these errors were encountered: