co3moz / minecraft-render

Minecraft block rendering with node.js
MIT License
42 stars 21 forks source link

[Bug] Some blocks are rendered incorrectly #4

Open ShirasawaSama opened 3 years ago

ShirasawaSama commented 3 years ago

Chain: chain

CommandBlock: chain_command_block

sea_lantern: sea_lantern

Besides, some blocks such as grass_block are not colored.

tehbeard commented 3 years ago

Command block and sea lantern is due to animation not being handled, the texture is using the wrong UV coords.

I have a hack fix in my fork, that works if you want unanimated. Working out how to allow animations and compute the correct number of frames.

Grass and leave colour comes from biomemaps, not sure how you'd map that with three.js

Not sure what's wrong with chain, maybe similar to the scaffolding legs?

ShirasawaSama commented 3 years ago

@tehbeard

  1. I think we can add an option to render the animation or not.
  2. Like the grass block in an inventory, it has a default color.
tehbeard commented 3 years ago

After experimenting, the chain render is correct, it's just the camera angle that makes it look off.

The chain model is two planes perfectly perpendicular, going from corner to corner of the block. The camera angle is at the block corner so that only sees one plane.

I'd recommend for any application usage, to just grab the item model/texture of the chain instead as that will look closer to what is seen in the inventory screen.

tehbeard commented 3 years ago

Biome colours proving hard to do.

I've got it working for textures that are fully gray-scale (leaves etc) but the side of the grass block is proving difficult as the biome colour messes with the dirt colour.

Also the Azalea and dripleaf render issues seem to stem from culling, but I can't work out how to fix it without breaking glass rendering.

tehbeard commented 3 years ago

Scaffolding appears to be having some issues with UV mapping where the entire side texture is being mapped instead of just part of it on the legs and sides. scaffolding_stable

Edit: from the wiki article, https://minecraft.fandom.com/wiki/Model , It seems like the default UV map is at fault.

Defines the area of the texture to use according to the scheme [x1, y1, x2, y2]. If unset, it defaults to values equal to xyz position of the element. The texture behavior is inconsistent if UV extends below 0 or above 16. If the numbers of x1 and x2 are swapped (e.g. from 0, 0, 16, 16 to 16, 0, 0, 16), the texture flips. UV is optional, and if not supplied it automatically generates based on the element's position.

ShirasawaSama commented 3 years ago

@tehbeard Can you implement the rendering of Chest, Shulker_Box, Ender_Chest and Trapped_Chest ?