Javier-Garzo / Marching-cubes-on-Unity-3D

Terrain voxel engine with the use of Marching Cubes implemented in Unity 2020.3.17f1 (LTS).
MIT License
334 stars 43 forks source link

UV issue #5

Closed Somshekardsi closed 3 years ago

Somshekardsi commented 3 years ago

There seems to be an issue with UV. Sometimes texture gets stretched image

Javier-Garzo commented 3 years ago

It's already a known error. The texturization system have problems with the UV scales and the correct texture face orientation (also other UV problem). The problem is inside the BuildChunkJob.cs, line 75-95, where the UV calculation take place in the code. Now is a trivial method, it must use the marching cubes tables (static variables inside the bottom on the same script) .

Somshekardsi commented 3 years ago

Okay, thank you.

emre-sahinn commented 3 years ago

Are there any fix for this bug?

Javier-Garzo commented 3 years ago

Yeah exists two possible solutions, you can see in this stackexchange:

The current project texturization have problems with the UV directions and the UV scales (with interpolations active). I try implementing the marching cube tables for the UV or fix the interpolation bug, but I fail. I must spend more hours trying a fix, but I little busy right now.

emre-sahinn commented 3 years ago

Hi again, are there any updates? I tried implementing my self but no success..

Javier-Garzo commented 3 years ago

I am working on that. Let's see if i can achieve something this week.

emre-sahinn commented 3 years ago

I am working on that. Let's see if i can achieve something this week.

Hi, did you succeed? I really need this update :')

Javier-Garzo commented 3 years ago

Look to the new version, I improve the UV calculations removing the first image UV bug. Also create a little debug helper, you can active on runtime with F4 key.
A image of both improvements (no interpolation terrain, bool inside MeshBuilderManager): Captura debug2

The brick texture still with a bad orientations and the interpolations have some UV problems (affected also by the illumination shader) : Interpolation

However the visual results have improve a lot.

emre-sahinn commented 3 years ago

Thanks a lot! you literally saved me, thanks for the update and awesome project