fenomas / noa

Experimental voxel game engine.
MIT License
612 stars 87 forks source link

Texture/Material limit #7

Closed andrewtheone closed 8 years ago

andrewtheone commented 8 years ago

I have a world, with 129-131 (129 which are registered by me, and plus 2 by the engine itself) and 143 materials. My problem is, when I'm about to register/use the next texture, and place a block with the texture and it wont show up. In networking tab I cannot see the new texture it seems like babylon doesnt even try to download it (most of the time), and I get a corresponding ID and can get the material texture and etc from registry by ID, but it just does not show up. Any idea?

andrewtheone commented 8 years ago

image

image

andrewtheone commented 8 years ago

The front and back or left and right sides are not visible from the outside, but from the inside only. same true for bottom and top sides, after the 130th texture

andrewtheone commented 8 years ago

I'm using 128x128 images, I thought I give it a try with 32x32 and 64x64 images. The result is the same. The strangest part is that, Rendering calls the registry asing for texture, even creates a BabylonTexture but it just does not render correctly, and wathis more strange is that:

texture_id 1- wood texture_id 2 - grass ... .... texture_id 128 - cobblestone

when I add something with texture id > 129 or 130 the above image is rendered. when I press f5 (all the blocks and everything is stored on the server, so when it reloads it requests all blocks and displays them, first it loads all the textures and the answers the "worldDataNeeded" event, it takes up like 30-45 secs, until chunks and textures are loading, physics is disabled so player entity would not move, and would not request more and more chunks.)

so after reloading, the texture id 1 and texture id 2 is missig (it gets transparent) but texture id 129..130.. and so on gets displayed (maybe its because of other issues, but the numbers 128,129,130) exspecially 128 is like its being something "signed 1 byte" or something.. I tried searching for "signed, byte, 128, 2^8" and other forms, but i dont find any.

andrewtheone commented 8 years ago

image

gray- terr6 blue - terr128 and the right one which is fully transparent (but texture passed) is supposed to be terr129 (but mesh's name is terr128 turning on clickable labels, show 2 terr128 labels on the blue one, and no label on the most right one)

terr 129 has textures inside of terr3's texture (first terrain displayed with texture, terr1, terr2 is solid colors)

new results: terr129 dispite of the fact that texture has been passed, babylon js does not even try to download the texture (i tried passing it as base64data, still no result)

andrewtheone commented 8 years ago

SOLVED:

chunk.js:332

var maskCache = new Int16Array(4096), aomaskCache = new Uint16Array(4096)

changed 8 bit int and uint arrays to 16 bit arrays now it works :)

fenomas commented 8 years ago

Thanks! I pushed a fix for this. In the future if you want to submit pull requests for fixes like this I'd happily accept them.