Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add custom ShaderMaterial supporting greedy meshing + atlas texturing
Fixes texture stretching when used with greedy voxel mesher (adds tiling) Squashed commit of the following: commit 3baac16 Author: deathcap <[email protected]> Date: Sun Jan 12 05:26:36 2014 -0800 Re-enable atlaspack tilepad. Fixes edge artifacts Ref voxel/voxelmetaverse#19 commit 0f4cf41 Author: deathcap <[email protected]> Date: Sun Jan 12 05:11:42 2014 -0800 Add rotation in GLSL per side. Textures finally correct! At last, texture atlasing with greedy meshing. In summary, used the UV coordinates from three.js (may be a better way to do this?) as the starting tile texture offsets, then repeated with tile UVs from fract() of pos . n. Works but this custom shader is very basic at the moment. Ref voxel/voxelmetaverse#19 commit 02214ea Author: deathcap <[email protected]> Date: Sun Jan 12 04:49:33 2014 -0800 Remove UV coord rotation - side textures are now correct, but need rotation commit c6b3079 Author: deathcap <[email protected]> Date: Sun Jan 12 04:28:23 2014 -0800 Flip texture Y (aka V, aka T) in JS instead of GLSL commit 4430410 Author: deathcap <[email protected]> Date: Sun Jan 12 04:22:08 2014 -0800 Set tileCoord from passed vUv coordinate (topmost only) Gets close to proper material texturing, but not quite. Some block faces render as expected but others have the wrong texture. Still, closest I've gotten so far yet with greedy meshing + atlas uv + vjs.. commit bf7a410 Author: deathcap <[email protected]> Date: Sun Jan 12 04:04:52 2014 -0800 Restore three.js passing UV coords, though unused (commented out - texCoord=vUv stretches) commit bd3a80b Author: deathcap <[email protected]> Date: Sun Jan 12 03:53:49 2014 -0800 Revert "Attempt at passing UV texture coordinates from attributes, instead of uniforms" This reverts commit ce2c76c. commit ce2c76c Author: deathcap <[email protected]> Date: Sun Jan 12 03:53:32 2014 -0800 Attempt at passing UV texture coordinates from attributes, instead of uniforms commit 9311582 Author: deathcap <[email protected]> Date: Sat Jan 11 20:21:49 2014 -0800 Bug: tileOffsets uniform update changes all meshes commit 505e0de Author: deathcap <[email protected]> Date: Sat Jan 11 19:03:22 2014 -0800 Set tileOffsets from atlaspack top UV commit fcab718 Author: deathcap <[email protected]> Date: Sat Jan 11 18:41:14 2014 -0800 Test setting tileOffsets uniforms from paint() commit 47c9236 Author: deathcap <[email protected]> Date: Sat Jan 11 17:46:22 2014 -0800 Pass array of tileOffsets, for each of 6 faces commit 4d7bab0 Author: deathcap <[email protected]> Date: Sat Jan 11 17:13:24 2014 -0800 Use a more convenient faceIndex equation, 3-z-2x-3y commit 4710a16 Author: deathcap <[email protected]> Date: Sat Jan 11 17:06:07 2014 -0800 Calculate face index from normal commit d702869 Author: deathcap <[email protected]> Date: Sat Jan 11 14:13:01 2014 -0800 Pass tileOffset as uniform; cleanup commit ad3bf53 Author: deathcap <[email protected]> Date: Sat Jan 11 13:24:46 2014 -0800 Use dot product for tileUV, fixes vertical faces Formula from http://0fps.wordpress.com/2013/07/09/texture-atlases-wrapping-and-mip-mapping/ commit cf6d721 Author: deathcap <[email protected]> Date: Sat Jan 11 12:56:23 2014 -0800 Working tiling using fract() on position, but only on horizontal faces and with hardcoded material Screenshot: http://i.imgur.com/jLKX9Np.png commit 416548c Author: deathcap <[email protected]> Date: Sat Jan 11 11:59:18 2014 -0800 Back to stretched custom shader material commit fd8c2fb Author: deathcap <[email protected]> Date: Thu Jan 9 19:04:36 2014 -0800 Now I'm just guesisng :/ commit 1fed727 Author: deathcap <[email protected]> Date: Thu Jan 9 18:58:57 2014 -0800 Move tile calculation to vertex shader commit 2b6120b Author: deathcap <[email protected]> Date: Thu Jan 9 18:50:07 2014 -0800 Remove unneeded scale function commit d555e2d Author: deathcap <[email protected]> Date: Thu Jan 9 18:35:26 2014 -0800 Add scale(), but might not be needed commit 3b6fdfa Author: deathcap <[email protected]> Date: Thu Jan 9 18:24:46 2014 -0800 Disable tilepad for now commit 4cc5949 Author: deathcap <[email protected]> Date: Thu Jan 9 18:24:04 2014 -0800 Reorganize constructor to initialize uniforms commit de992da Author: deathcap <[email protected]> Date: Thu Jan 9 18:14:51 2014 -0800 Add atlasSize uniform for clarity commit e176a67 Author: deathcap <[email protected]> Date: Thu Jan 9 18:12:42 2014 -0800 Scale by 16/512 (texture/atlas), now voxel textures are sized correctly but not of the right material commit 42f118e Author: deathcap <[email protected]> Date: Thu Jan 9 18:07:07 2014 -0800 Now each tile displays the entire texture atlas. Progress? commit e75fb66 Author: deathcap <[email protected]> Date: Thu Jan 9 18:00:31 2014 -0800 Start porting https://github.com/mikolalysenko/ao-shader/blob/master/lib/ao.vsh . Only stripes so far commit c218832 Author: deathcap <[email protected]> Date: Thu Jan 9 17:38:00 2014 -0800 Attempt at tiling with fract(), not quite right commit d5eb246 Author: deathcap <[email protected]> Date: Thu Jan 9 13:31:56 2014 -0800 Pass normal and position varyings commit 87a33c2 Author: deathcap <[email protected]> Date: Thu Jan 9 13:14:40 2014 -0800 Simple but working custom shader with textures Custom uniforms, vertex shader, and fragment shader Based on http://stackoverflow.com/questions/12627422/custom-texture-shader-in-three-js commit d4022d1 Author: deathcap <[email protected]> Date: Wed Jan 8 21:28:11 2014 -0800 Test using ShaderMaterial (no texture) https://github.com/deathcap/voxel-texture/tree/shadertest
- Loading branch information