Author Topic: Problems with Crocotile 3D and Unity?  (Read 723 times)

Jake

  • Newbie
  • *
  • Posts: 9
    • View Profile
Problems with Crocotile 3D and Unity?
« on: March 29, 2017, 05:03:48 PM »
Hey everyone,

I've created a outside scene in Crocotile 3D as a test to import into Unity and mess around with. I used TexturePacker to create the spritesheet and in Crocotile 3D my scene looks perfect, as it should be. However when I export (only thing I select is to make sure the textures are exported too) and then import into Unity, the model imports fine, however the textures are all.. odd. I get strange lines at the edges of each tile, that didn't exist in Crocotile 3D. Is anyone familiar with this issue and does anyone have any solutions? Looking at Giromancy's Silent Hill project that was developed in Unity with Crocotile 3D tells me that there must be a solution!  ;)

I searched these forums and found this topic that was interesting, I believe this user might have a had a similar issue as I do. http://c3d.xyz/index.php?topic=156.0 However, his solution to disable anti-aliasing isn't really that ideal, as it seems to be glancing over the problem than actually fixing it and the issue still remains, it's just slightly harder to notice. I've also messed about with the UV Padding and set it to '1' or '2'. This, along with messing around with Unity's settings does remove the line problem, however, it also messes up some other textures in my scenes as well.

The reason I'm asking here instead of at the Unity forums is in case I made some mistake with Crocotile 3D and the export process. I'll admit I am a very new to Unity, so it's highly probable I'm to blame here, but was hoping if any other users who use Crocotile 3D and Unity would be able to help me out?

I've attached some images to show you my problems.
The first image is how my scene appears in Crocotile 3D.
http://imgur.com/QLR7mTM

The other two images are taken directly from the Unity Editor, it's in these images you can see the lines I was talking about.
http://i.imgur.com/377OaLY.png
http://imgur.com/weSFrjc

Sorry for the long post! I'm loving Crocotile 3D atm though  8)
« Last Edit: March 29, 2017, 05:06:31 PM by Jake »

Alex

  • Administrator
  • Sr. Member
  • *****
  • Posts: 284
    • View Profile
Re: Problems with Crocotile 3D and Unity?
« Reply #1 on: March 30, 2017, 01:59:23 AM »
I'm not that familiar with how Unity handles stuff, so I'm not sure how much help I can give.
Maybe the uv coordinates are being rounded somehow when imported.. maybe it is how unity renders textures.. maybe the textures have been optimized when importing, or the textures have a certain setting that ends up blurring the pixels, therefor pixels from one tile crossover and bleed into other tiles.
If you attach the obj,textures,etc- I could try looking at and messing with it in unity if you are unable to find any solutions.

Jake

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: Problems with Crocotile 3D and Unity?
« Reply #2 on: March 30, 2017, 09:05:13 PM »
I'm not that familiar with how Unity handles stuff, so I'm not sure how much help I can give.
Maybe the uv coordinates are being rounded somehow when imported.. maybe it is how unity renders textures.. maybe the textures have been optimized when importing, or the textures have a certain setting that ends up blurring the pixels, therefor pixels from one tile crossover and bleed into other tiles.
If you attach the obj,textures,etc- I could try looking at and messing with it in unity if you are unable to find any solutions.

Unfortunately I haven't had much luck in figuring out a solution, I've attached a zip file containing an obj of my test scene, the mtl file and texture. Maybe you'll have better success? If not, it isn't the end of the world. Thanks for offering to help me out  :)

EDIT: I also converted the .obj to an .fbx and imported it into the Unreal Engine and get the same result. Could this be an issue with Crocotile 3D or my export settings? (which was just export only with textures). Or maybe the fault is with the spritesheet I created with TexturePacker. Hmm.
« Last Edit: March 30, 2017, 11:29:11 PM by Jake »

Alex

  • Administrator
  • Sr. Member
  • *****
  • Posts: 284
    • View Profile
Re: Problems with Crocotile 3D and Unity?
« Reply #3 on: March 30, 2017, 11:14:14 PM »
Unfortunately I haven't had much luck in figuring out a solution, I've attached a zip file containing an obj of my test scene, the mtl file and texture. Maybe you'll have better success? If not, it isn't the end of the world. Thanks for offering to help me out  :)

EDIT: I also converted the .obj to an .fbx and imported it into the Unreal Engine and get the same result. Could this be an issue with Crocotile 3D or my export settings? (which was just export only with textures). Or maybe the fault is with the spritesheet I created with TexturePacker. Hmm.

Okay, I found the problem and solution.
It is related to the texture dimensions. If the width or height of the image isn't a power of 2, then it will produce the problem. If you simply add more space to your texture so that it is a power of two dimensions, then it will look perfect in Unity. I also change the filter mode of the texture to Point, and also the format to True color.
 :)

Jake

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: Problems with Crocotile 3D and Unity?
« Reply #4 on: March 31, 2017, 11:58:17 AM »
Hi Alex,

Thanks for the help so far, I really appreciate it!  :)

It looks like you've got it figured out, the screenshot you've uploaded looks perfect. That being said, I've tried what you've suggested but have hit a brick wall. I've added more space to the sprite sheet (using Paint.NET), the dimensions are now 512 x 128. I then imported my assets into Unity, loaded the OBJ into my scene. Created a new Legacy Shader > Diffuse. Loaded the sprite sheet onto it. Then applied it to my OBJ. I also changed the filter mode to point, couldn't find a true colour format though (I think I'm using a newer version than you are). This is the result I got (http://imgur.com/QThzX8k).

Was there something I did wrong or that I missed that you did? Thanks again for your help  :)

Alex

  • Administrator
  • Sr. Member
  • *****
  • Posts: 284
    • View Profile
Re: Problems with Crocotile 3D and Unity?
« Reply #5 on: March 31, 2017, 02:41:48 PM »
Yeah, You have to resize the texture in crocotile3d. When you resize it in crocotile3d, it will also readjust the UV coordinates of every tile to correctly map the new texture dimensions. Then you will need to export it from crocotile3d to get an obj file that contains the updated UV coordinates. Then you'll have to reimport everything into unity.

Jake

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: Problems with Crocotile 3D and Unity?
« Reply #6 on: March 31, 2017, 03:05:49 PM »
Yeah, You have to resize the texture in crocotile3d. When you resize it in crocotile3d, it will also readjust the UV coordinates of every tile to correctly map the new texture dimensions. Then you will need to export it from crocotile3d to get an obj file that contains the updated UV coordinates. Then you'll have to reimport everything into unity.

Sorry to bother you again. Okay, so I resized my sprite sheet in Crocotile 3D. These are the settings that I applied: http://imgur.com/a/GE07Q
Then I exported it like so: http://imgur.com/kony6WL (I also later did the same but with 'use power of 2 textures' but made no difference).

And then I imported into Unity like before, model comes in fine, I slap the texture on and it's back to where I was originally. The textures are where they should be, but I still get those damn lines everywhere  :o
« Last Edit: March 31, 2017, 03:12:34 PM by Jake »

Alex

  • Administrator
  • Sr. Member
  • *****
  • Posts: 284
    • View Profile
Re: Problems with Crocotile 3D and Unity?
« Reply #7 on: March 31, 2017, 03:44:28 PM »
Can you provide a screenshot of it in unity? If you click on the texture in unity, does it show it having the correct dimensions? I'm wondering if it was imported correctly. I know that when I reimported, I had to delete the previous files in unity for them to correctly update..
You can also attach the obj,etc again if you want me to take a look at that and try importing it myself.
« Last Edit: March 31, 2017, 03:46:12 PM by Alex »

Jake

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: Problems with Crocotile 3D and Unity?
« Reply #8 on: March 31, 2017, 04:35:06 PM »
Here is the screenshot of it in Unity: http://imgur.com/K1rPEvb
It looks like the new dimensions I created in Crocotile 3D appear in Unity. Each time I import the model and texture I create a new project, so there aren't any previous files there. I'll attach the obj and the texture with the new dimensions in a zip, just to be on the safe side  :P

EDIT: If nothing appears to be wrong, I could always upload or link to the Unity project, so you could have a deeper look and see what settings I've used.
« Last Edit: March 31, 2017, 05:22:19 PM by Jake »

Alex

  • Administrator
  • Sr. Member
  • *****
  • Posts: 284
    • View Profile
Re: Problems with Crocotile 3D and Unity?
« Reply #9 on: March 31, 2017, 05:08:08 PM »
I imported them into Unity and changed Filter Mode to point, and it looks fine. I attached a screenshot.
I use Unity 4 because Unity 5 doesn't work on my computer.
You originally mentioned that you don't want to disable anti-aliasing. I checked my anti-aliasing settings: Edit/Projectsettings/Quality
I have mine disabled. And when I turn it on, I do get some lines showing. Is there a reason you don't want to disable anti-aliasing?
If it is aliased, the edges will blur together, causing pixels that sit on the outside of the tile to bleed into it.

Jake

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: Problems with Crocotile 3D and Unity?
« Reply #10 on: March 31, 2017, 05:37:36 PM »
You originally mentioned that you don't want to disable anti-aliasing. I checked my anti-aliasing settings: Edit/Projectsettings/Quality
I have mine disabled. And when I turn it on, I do get some lines showing. Is there a reason you don't want to disable anti-aliasing?
If it is aliased, the edges will blur together, causing pixels that sit on the outside of the tile to bleed into it.

No reason, really. I just thought that was a more 'hack' type method of treating the symptom of the problem, rather than the root cause. Even with anti-aliasing disabled, I still get lines (although nowhere near as noticeable) when running the game. It's just odd, I've never come across this problem before, but then again, I've never really messed around with 3D tiles before  :)

Maybe I should have a look at padding again. Seen as that removed the line problem last time (but also introduced some textures in the wrong place too). Well, thank you for your help anyway! I appreciate the time and effort you've spent trying to help me  8)
« Last Edit: March 31, 2017, 05:42:53 PM by Jake »

Alex

  • Administrator
  • Sr. Member
  • *****
  • Posts: 284
    • View Profile
Re: Problems with Crocotile 3D and Unity?
« Reply #11 on: March 31, 2017, 06:27:23 PM »
I think this sort of issue is a common one that people face when dealing with creating 3d models/textures. I think it just becomes more apparent in our case because of the nature of it being tiled and the uvs of tiles being right next to each other. There might be solutions to this sort of issue if you do some general searches online related to this sort of thing. I'm not sure what they would be.
Anyways, hope I've helped some. If you figure out a better solution, feel free to let me know about it!

Jake

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: Problems with Crocotile 3D and Unity?
« Reply #12 on: March 31, 2017, 09:20:35 PM »
I think this sort of issue is a common one that people face when dealing with creating 3d models/textures. I think it just becomes more apparent in our case because of the nature of it being tiled and the uvs of tiles being right next to each other. There might be solutions to this sort of issue if you do some general searches online related to this sort of thing. I'm not sure what they would be.
Anyways, hope I've helped some. If you figure out a better solution, feel free to let me know about it!
I appreciate all the help you've given!  8)

I've searched far and wide online, I've noticed there have been a few users who had similar issues with this. Fixes seem varied, but I'll keep looking! In the meantime, I've messaged Giromancy (the user on this forum who made the Silent Hill maps using Unity). I'm hoping he might have an answer, but there's no guarantee he'll reply!

If I come across a better solution I'll be sure to let you know!  :)