Open GoogleCodeExporter opened 8 years ago
Turns out the mtl file was blocked by IIS. Once approved it load fine. But
still only the diffuse map. How do I get the normal map as well?
Original comment by petersav...@variousskies.com
on 14 Mar 2014 at 3:41
Oh, bump mapping is not supported at this moment. The obj/mtl parser simply
bypasses the bump textures defined in the material library if any. I have
tried to add that feature to Jsc3d, but the software implementation turned out
to be not efficint enough. Maybe it will appear in future release with only
webgl implementation.
Original comment by Humu2...@gmail.com
on 14 Mar 2014 at 4:14
Aha, that explains it. Thanks for the help!
Original comment by petersav...@variousskies.com
on 17 Mar 2014 at 12:48
Hi , i'm implementing a 3d web viewer it doesn't need to be fast i was
wondering if you could share your normal map code you have written.
Original comment by anasv...@gmail.com
on 30 Jun 2014 at 1:01
I'm sorry. It seems I didn't keep the mentioned experimental branch. Maybe I'll
write a WebGL implementation for that after I've finished some more important
features :-)
Original comment by Humu2...@gmail.com
on 1 Jul 2014 at 6:36
the problem is i understand nothing from your rendering code! so its very hard
for me to add normal mapping to this code is there anything you could help me
with?
Original comment by anasv...@gmail.com
on 1 Jul 2014 at 4:23
[deleted comment]
It may be too hard a job to insert this new feature into current implementation
of Jsc3d. Its rasterization pipeline has been growing rather complicated and
many simplifications and tricks are used to improve the performance. Any
modification into the code must be made very carefully to avoid breaking the
existing mechanism. Anyway, if you would like to take a try, I'm glad to
provide some hints:
1. As general practice in implementing normal mapping, the TBN spaces must be
set up on each vertices. The vertex normals have benn computed by Jsc3d and
stored in mesh.vertexNormalBuffer. You should calculate the tangent vectors and
the binormal vectors from the normal vectors and the texture coordinates for
each vertex.
2. Add new properties for Jsc3d.Mesh object to hold the necessary data for
normal mapping, inluding but not limited to the tangent vectors, the binormal
vectors, the secondary texture coordinates on the bump map and the bump texture
itself. So after adding these, a mesh may have the following additional
properties:
mesh.vertexTangentBuffer;
mesh.vertexBinormalBuffer;
mesh.bumpmapTexcoordBuffer;
mesh.bumpTexture;
3. In each rasterization routine (renderSolidSmooth(), renderTextureSmooth()
and renderSolidSphereMapped()), interpolate the TBN vectors between and inside
each scanline, computing TBN spaces for each fragment. The bump/normal vectors
should be grabbed from the bump texture though the bump texture coordinates and
transformed from the TBN spaces to the view space. Then the transformed normal
vectors (or just the z components since Jsc3d only utilizes parellel
projection) can be used to compute the brightness on each fragment.
4. You'd better also implement bilinear filtering for getting bump/normal
vectores out of the bump texture. Otherwise, the effect may not be satisfactory.
I hope these would be helpful ... really a lot of coding work to complete :-)
Original comment by Humu2...@gmail.com
on 2 Jul 2014 at 5:55
Original issue reported on code.google.com by
petersav...@variousskies.com
on 14 Mar 2014 at 2:21