-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Tapani J. edited this page Mar 18, 2014
·
32 revisions
- Examples
- General http://threejs.org/examples/#webgl_materials2
- Normal map
- Bump map http://threejs.org/examples/#webgl_materials_bumpmap
- Create a normalmap shader with THREE.ShaderLib
- Modify uniforms
- normal map needs following
uniforms[ "tNormal" ].value = THREE.ImageUtils.loadTexture( "models/MAP_deer_G-03_NRM.png" );
- specular needs following
uniforms[ "enableSpecular" ].value = true;
- set texture to "tSpecular" and color to "specular"
uniforms[ "tSpecular" ].value = THREE.ImageUtils.loadTexture( "models/MAP_deer_G-03_SPEC.png" );
uniforms[ "specular" ].value.setHex( specular ); // specular = 0xffffff
- If your model is black or texture is not visible then "uniforms[ "enableAO" ].value = true;" might cause it
- Apply material to Three.Mesh
- If youre using single texture (+diffuse, specular) or single material (check from blender) then you're fine by just directly applying the material to a mesh
jsonLoader.load( "models/White_Tail_Deer_all.js", function( geometry ) { addModelToScene(geometry, material)} )
-->new THREE.Mesh( geometry, material );
- If you're model uses multiple textures then you may use MeshFaceMaterial
var material = new THREE.MeshFaceMaterial( materials ); // parameter should be an array of materials
deer = new THREE.Mesh( geometry, material );
- use converter three.js\utils\converters\obj\convert_obj_three.py
- help included in the py file. Blender section talks about export settings that do not exist anymore. That's a problem
- you probably need to use python26
- Bones might cause errors
- Morph targets
- http://threejs.org/examples/webgl_morphtargets.html
- Morph targets are sets of geometry vertices positions for automatic interpolation between them. You can change geometry appearance in real time, using different vertices positions written in morphTargetInfluences[0], morphTargetInfluences[1], morphTargetInfluences[nSet]. You can mix many appearances (morphTargetInfluences) of geometry at the same time. Best way is JSONLoader format, wchich you can export from 3DSMax for example: frame0 as morphTargetInfluences[0], frame1 as morphTargetInfluences[1], ect.
The original geometry vertices are untouched, which you can check using geometry.computeBoundingBox();geometry.boundingBox);
- gl error invalid operation
- solution: geometry.computeTangets() in the beginning of your loader callback