Skip to content

Commit 99ef87c

Browse files
fix the normal attribute setting bug in OBJ loader
1 parent 3f03135 commit 99ef87c

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

examples_tests/41.VisibilityBuffer/shadeVBuffer.comp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,11 +154,10 @@ void main()
154154
normal += nbl_glsl_fetchVtxNormal(vertexIDs[2],drawGUID)*lastBary;
155155
}
156156

157-
color.rgb = uintIDToColor(drawGUID);
158-
color.rgb = uintIDToColor(triangleID);
159-
color.rgb = pos;
157+
// deferred texturing
160158
color.rgb = nbl_sample_Kd(uv,dUVdScreen).rgb;
161-
//color.rgb = 0.5*normal+vec3(0.5);
159+
// TODO: normals seem be to screwed
160+
color.rgb = 0.5*normal+vec3(0.5);
162161
}
163162

164163
imageStore(frameBuffer,fragCoord,vec4(nbl_glsl_oetf_sRGB(color.rgb),color.a));

src/nbl/asset/interchange/COBJMeshFileLoader.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -245,8 +245,6 @@ asset::SAssetBundle COBJMeshFileLoader::loadAsset(io::IReadFile* _file, const as
245245
bool notempty = mbs.size()!=0ull;
246246
{
247247
auto mb = notempty ? core::smart_refctd_ptr_static_cast<ICPUMeshBuffer>(*mbs.begin()) : core::make_smart_refctd_ptr<ICPUMeshBuffer>();
248-
if (notempty)
249-
mb->setNormalAttributeIx(NORMAL);
250248
submeshes.push_back(std::move(mb));
251249
}
252250
indices.emplace_back();
@@ -265,7 +263,6 @@ asset::SAssetBundle COBJMeshFileLoader::loadAsset(io::IReadFile* _file, const as
265263
dummyMaterialCreated = true;
266264

267265
submeshes.push_back(core::make_smart_refctd_ptr<ICPUMeshBuffer>());
268-
submeshes.back()->setNormalAttributeIx(NORMAL);
269266
indices.emplace_back();
270267
recalcNormals.push_back(false);
271268
submeshWasLoadedFromCache.push_back(false);
@@ -459,6 +456,7 @@ asset::SAssetBundle COBJMeshFileLoader::loadAsset(io::IReadFile* _file, const as
459456
continue;
460457

461458
submeshes[i]->setPositionAttributeIx(POSITION);
459+
submeshes[i]->setNormalAttributeIx(NORMAL);
462460

463461
submeshes[i]->setIndexBufferBinding({submeshes[i]->getIndexBufferBinding().offset,ixBuf});
464462
const uint64_t offset = submeshes[i]->getIndexBufferBinding().offset;

0 commit comments

Comments
 (0)