Open GoogleCodeExporter opened 8 years ago
The png file must be corrupted with incorrect transparent pixels. Use other
file formats which do not contain alpha channel instead. Or you can add the
following snippet to manually diable alpha blending on textures for all meshes:
viewer.onloadingcomplete = function() {
var scene = viewer.getScene();
if (scene) {
scene.forEachChild( function(mesh) {
if (mesh.texture)
mesh.texture.hasTransparency = false;
} );
}
};
Original comment by Humu2...@gmail.com
on 15 Aug 2014 at 2:07
[deleted comment]
thanks very much for the reply, great author,
anyway after testing the script,seems the script didn't work as expected to
remove transparecy,besides
I don't not know how many file types of texture jsc3d supported..
basically,as far as i know, common texture file types are
(bmp, png, tga, dds, etc with alpha channel) && (jpeg without alpha channel) if
i'm right, although the above transparent issue can be easily fixed by using
jpeg file since save in jpeg won't contain alpha ,no transparency would be
shown.
The problem is just that why the 3d tools can render the supposed corrupted png
texture without seeing transparency while in jsc3d i've not found any demos
that have been use png as material texture (map_Kd xxxx.png) without showing
transparency yet.
if we suppose png corrupted , can we find any existing url demo which can
explain that a png file that contains alpha channel to show both
transparentcy(alpha=0) & nontransparency (alpha =1) at the same time on loading
one obj+mtl(map_Kd xxx.png).
Original comment by haibo...@solstice.sg
on 16 Aug 2014 at 12:51
Is it because the materials also have transparency defined? Then try this one:
viewer.onloadingcomplete = function() {
var scene = viewer.getScene();
if (scene) {
scene.forEachChild( function(mesh) {
// turn off transparency on texture
if (mesh.texture)
mesh.texture.hasTransparency = false;
// turn off mateial transparency as well
if (mesh.material)
mesh.material.transparency = 0;
} );
}
};
Jsc3d depends on the host browser to decode images. Basically, png, gif and
jpeg are well supported by almost all browsers. Other formats such as tiff,
bmp, tga, etc. may be supported by specific browsers like Firefox or IE. I
don't think you should build your application on such assumption.
Original comment by Humu2...@gmail.com
on 18 Aug 2014 at 7:18
Original issue reported on code.google.com by
haibo...@solstice.sg
on 14 Aug 2014 at 9:22Attachments: