Open GoogleCodeExporter opened 9 years ago
// additional information, below is the js part setting when i load the obj,
// there must be some light control instead of changing the mtl Kd value right?
var canvas = document.getElementById('cv');
var viewer = new JSC3D.Viewer(canvas);
viewer.setParameter('SceneUrl', 'myobj.obj');
viewer.setParameter('InitRotationX', 0);
viewer.setParameter('InitRotationY', 0);
viewer.setParameter('InitRotationZ', 0);
//viewer.setParameter('ModelColor', '#CAA618');
//viewer.setParameter('ModelColor', '#ffffff');
viewer.setParameter('BackgroundColor1', '#B9EBFF');
viewer.setParameter('BackgroundColor2', '#DFF6FF');
viewer.setParameter('RenderMode', 'textureflat');
viewer.setParameter('MipMapping', 'on');
viewer.setParameter('Renderer', 'webgl');
viewer.init();
viewer.update();
Original comment by haibo...@solstice.sg
on 13 Aug 2014 at 4:10
As you can see in current implementation of the mtl parser
http://code.google.com/p/jsc3d/source/browse/trunk/jsc3d/jsc3d.js#5273, only
'Kd' commands are effective. Both 'Ka' and 'Ks' are simply ignored. If Kd was
set to 1 1 1, the affected facets will be completely white when they are facing
the viewing directin unbiasedly. Otherwise, the facest will be gray. The final
color of a fragment equals to the material color multiplied by the transformed
z value of its normal vector.
I'm afraid there's no way to control the lighting. In fact, there's not a
'light' in the rendering pipeline. The final colors are computed from the
material colors, the texel colors and the normal vectors. The result may looks
slightly different from that from other tools. That's what it is.
Original comment by Humu2...@gmail.com
on 14 Aug 2014 at 3:00
Thank you for your immediate reply.
Great Author, i really like reading the way you explain to every post.
Thank you so much anyway, That greatly saved my time on trying those invalid
parameters, and now I will try all possible methods you mentioned.
by the way is there any plugin js that can be fully compatible to integrate
with jsc3d so as to control lighting features? (the attached file has option
that loads jsc3d obj)
Original comment by haibo...@solstice.sg
on 14 Aug 2014 at 3:37
Attachments:
My pleasure :-)
At this moment Jsc3d just adopts a very basic rendering pipeline. After all, it
begins with software only rendering that is expected to work on some old
browsers with acceptable performance. Though it is not difficult to implement
advanced features with WebGL and shader tricks, the compatibility with software
rendering is considered to be important for this project.
As far as I know, the project you mentioned only uses parts of Jsc3d, to be
exact, the obj loader and the mesh structure. The author wrote his own
implementation for the rendering pipeline with several impressive features such
as ray tracing, etc.
Original comment by Humu2...@gmail.com
on 14 Aug 2014 at 4:28
Original issue reported on code.google.com by
haibo...@solstice.sg
on 13 Aug 2014 at 4:00Attachments: