javascript - Three.js imported obj incorrect shadow rendering -
i imported object blender, set every mesh of cast , receive shadows, shadows rendered incorrect. merged meshes of object thinking resolve problem, result same. problem seems resolved when using side: three.doubleside, makes materials darken.
light settings
light = new three.directionallight( 0x666666, 1 ); light.position.set( 2*400, 2*300.75, 2*400); light.position.multiplyscalar( 1.3 ); light.castshadow=true; light.shadowmapwidth = 2048; light.shadowmapheight =2048; var d = 1300; light.shadowcameraleft = -d; light.shadowcameraright = d; light.shadowcameratop = d; light.shadowcamerabottom = -d; light.shadowcamerafar = 10000; light.shadowbias = 0.0001; light.shadowdarkness = 0.5;
material settings
var childtilestexture = three.imageutils.loadtexture('texture/wood_t.jpg?v1'); childtilestexture.wraps = childtilestexture.wrapt = three.repeatwrapping; child.material = new three.meshphongmaterial( { map:childtilestexture, shininess:5, metal: false} );
screenshots
http://i.stack.imgur.com/bsknu.jpg
another screenshot
as can see, handles casting shadow through object box.
the property shadowbias
can used remedy self-shadowing problems. try varying it.
try both small negative values, , small positive values.
three.js r.71
Comments
Post a Comment