three.js - Erroneous bindTexture(TEXTURE_2D, null); call, or bad shader? Texture disapparing with three.ShaderMaterial -


in 2 cases, have three.shadermaterial doesn't doesn't correctly render object, omitting texture. on both examples, middle object basic three.meshphongmaterial

example1: http://jsfiddle.net/sg9mp/4/ object that's closest screen never shows. on one, works renderer.render(...) not composer.render(...).

renderer.render( scene, camera ); //composer.render();   

example2: http://jsfiddle.net/sg9mp/5/ here i'm trying duplicate meshphongmaterial shader base can modify it. tried replicate perfectly. copied uniform, vert, frag, , replicated what's in object. can't see different, don't why it's not working same standard three.js phong shader.

so it's 2 cases i'm using three.shadermaterial , it's not rendering shader correctly, , can't figure out why. on second example(which 1 need fixed. first old test), in webgl inspector see scene looks fine until there "bindtexture(texture_2d, null);" call happens under hood three.js. though draws without it. in first example, it's drawing without it.

i feel must missing sort of flag in renderer, or composer, or something. or in second example, i'm trying copy three.js phong shader, maybe didn't copy perfectly.

the goal here copy phong shader, can modify uniform, vert, , frag on it. sadly, can't .clone() since vert , frag can't modified after it's compiled.

it looks while shadermaterial.map being set, shadermaterial.uniforms.map.value not consistently set.

i don't understand this, though. in cases had issues not setting things @ top level under shadermaterial. other cases have issues not setting uniforms.

in material, went , added this:

    for(var k in phongmat){         if( typeof phongmat.uniforms[k] != 'undefined' ){             phongmat.uniforms[k].value = phongmat[k];         }     } 

Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -