shama / voxel-texture Goto Github PK
View Code? Open in Web Editor NEW:game_die::sunrise: A texture helper for http://voxeljs.com.
Home Page: http://shama.github.com/voxel-texture
License: MIT License
:game_die::sunrise: A texture helper for http://voxeljs.com.
Home Page: http://shama.github.com/voxel-texture
License: MIT License
eg: texture.animate(['water1', 'water2', 'water3'])
use canvas or something like this example.
Only transparent behind textures that are transparent. Read which textures are transparent from the atlas manifest (which will be populated when meshing and determined (again) with https://github.com/hughsk/opaque).
This will fix the transparency oddness with mipmaps in the distance.
itd be cool to use https://gist.github.com/maxogden/5588883 (the minecraft textures at the correct indexes as per the minecraft level format)
right now it throws TypeError: Cannot read property 'top' of null
To load a single texture packed with smaller textures. Crop them up and load them into the materialIndex with canvas.
See max-mapper/voxel-engine#34. Instead of trying to solve this at the voxel mesh level we might be able to handle it here. Here is the idea:
If a voxel face is transparent, make the opposite face double sided. Then apply the neighboring voxel face texture as the inside face.
/cc @vogonistic @maxogden
heya, i'd like to use something like this for wireframed flat color voxels (should render super fast):
var material = [
new CubeMaterial( { vertexColors: THREE.VertexColors, opacity: 0.5 } ),
new THREE.MeshBasicMaterial( { color: 0x000000, wireframe: true } )
]
THREE.SceneUtils.createMultiMaterialObject( cube, material )
That way we don't need to re-mesh when changing a block types > 0.
Make the texture grow only by powers of two to not break mipmaps.
I should add this to the voxel-engine readme but using CubeGeometry won't work with more than a couple hundred voxels because each CubeGeometry is a separate mesh that has to get sent to the GPU. In voxel-engine we create composite meshes so there are about 32,000 voxels per chunk (each chunk is a mesh) and we then make 16 chunks in most of the demos so it is only 16 objects that have to get sent to the GPU.
however this module is still awesome for certain use cases
Add a JSON key export to atlaspack so a pre-built atlas and JSON/object key can be specified in voxel-texture.
can you please update to v0.3.2 in both npm and package.json?
Strict mode doesn't allow deleting local variables, but this library does it anyway here:
https://github.com/shama/voxel-texture/blob/master/index.js#L309
Results in an error when trying to use the module in a build:
node_modules/voxel-texture/index.js (284:6)
282: }, function() {
283: self._afterLoading();
284: delete canvases;
^
285: self.materials = self.materials.concat(textures);
286: cb(textures);
SyntaxError: Deleting local variable in strict mode (284:6) in /Users/bailey_stoner/.local/share/go/src/git.sr.ht/~monokrome/blek/node_modules/voxel-texture/index.js
heya,
so it turns out that textures are by far the biggest issue in voxel.js performance. I believe that voxel-texture isn't smart about not duplicating textures if the textures are the exact same url, so if you say textures.load('grass') it will make ['grass', 'grass', 'grass', 'grass', 'grass', 'grass'] and duplicate it 6 times
do you have any other ideas for perf improvements beyond this?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.