0

I am currently working on voxel game (not another copy of Minecraft) but i have problem with rendering.

Image 1+2 (I don't have sufficient reputation to post images and more then 2 links)

I draw red line (by hand) where i think is edge because I think I can see through top face.

On 2nd image is same problem with water (I think it is done by same problem).

I used AlexStv's voxel tutorial (I cannot post link because low reputation). I cannot ask him/her for help because I am currently using only small part of tutorial's code.

I've uploaded my code here but please, don't use it anywhere else. I did the code as simple as I can so I believe it's readable for every Unity3D C# programmer/coder.

I recognized this problem today with water (and then I find problem from 1st image).

In the end I have to say that I found shader somewhere on internet (and I modify it for my usage but I don't understand language of shaders).

PS: I didn't try Unity Answers because I used that once and they didn't help me (and marked my question as duplicate).

  • Post the relevant part of your code here instead of linking to it. – JohanShogun Jul 29 '15 at 18:04
  • @JohanShogun But I don't know which code to post. Shader? Mesh builder script for blocks? configurator of Mesh Renderer? – AbitDeveloper Jul 29 '15 at 18:08
  • 1
    @AbitDeveloper can you post a screenshot with the wireframe showing? I am thinking it is with the mesh builder portion of the code but I cannot download it at the moment. – agriffin Jul 29 '15 at 18:40
  • @AndrewGriffin There is wireframe of one of my chunks: [link](http://ctrlv.cz/shots/2015/07/29/is7s.png) – AbitDeveloper Jul 29 '15 at 18:53

1 Answers1

0

It appears that your problem is caused by using a transparent shader for your opaque terrain blocks.

This occurs often in Unity (and most engines) when transparent meshes render on top of other transparent objects or itself. What you need to do is split out the water to its own mesh renderer and make sure that the non-transparent terrain blocks use a non-transparent shader. This will also improve performance as transparent shaders can be costly. You will probably still encounter overlap issues on the water (or other blocks using transparent shaders) if the water is not flat. I would suggest you look into this article which may help. However, this is a common issue with transparent shaders.

agriffin
  • 541
  • 5
  • 10