Coder Social home page Coder Social logo

Comments (10)

fmoo avatar fmoo commented on September 24, 2024

For what it's worth, I thought of another workaround - to write a behavior/API to "unoptimize" the mesh on first access. For any vertex/uv that has already been seen, it can append a copy and update triangles with the new index. I'll test it out tomorrow.

from tiled2unity.

fmoo avatar fmoo commented on September 24, 2024

And I just realized the mesh import property sheet is a unity-specific thing, and not a tiled2unity one.

Working around this probably means some crazy heroics when generating the .dat files, which probably isn't woth it. I think the "unoptimizer" workaround is probably not too difficult, so I'm going to just close this out unless you feel strongly otherwise.

from tiled2unity.

Seanba avatar Seanba commented on September 24, 2024

What are the .dat flies you're talking about?

I wonder if it is something that could be solved by Tiled2Unity aferall?
Like if I forced every face on the mesh to have unique vertices? I wouldn't
want to turn that on for everybody but if it fixes your case it won't be
too hard to add.

Best,
Sean

On Thu, Jun 2, 2016 at 11:40 AM, Peter Ruibal [email protected]
wrote:

And I just realized the mesh import property sheet is a unity-specific
thing, and not a tiled2unity one.

Working around this probably means some crazy heroics when generating the
.dat files, which probably isn't woth it. I think the "unoptimizer"
workaround is probably not too difficult, so I'm going to just close this
out unless you feel strongly otherwise.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#37 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AGqEFu1C4dcf4nnJc-qrO6nBB41TuI_Gks5qHweVgaJpZM4IsQjS
.

from tiled2unity.

fmoo avatar fmoo commented on September 24, 2024

The .dat files are the files that unity imports the meshes from inside the prefabs. I'm afk at the moment, but I believe they land in Assets/Tiled2Unity/Meshes/

As long as every quad had at least 4 unique vertices (6 unique for each triangle should work as well if that's simpler) that would solve my problem either way.

I got my "MeshUnoptimizer" and UV calculation logic sorted, so there's no rush.

I've got a Makefile I use to automatically run Tiled2UnityLite against my .tmx files and can add whatever custom flags I'd need to make that work. I'm a coder so I can test a patch or provide a Behavior that reproduces the issue if it helps.

from tiled2unity.

Seanba avatar Seanba commented on September 24, 2024

Hi again, Peter. I expect meshes to be exported as Wavefront OBJ files
(with the .obj extension). I've never seen any .dat files get generated.

If you can send me a behaviour that reproduces the issue that would help me
understand what you're trying to achieve and how Tiled2Unity may be able to
help (and if the fix would be general enough to help others).

Best,
Sean

On Thu, Jun 2, 2016 at 9:24 PM, Peter Ruibal [email protected]
wrote:

The .dat files are the files that unity is imports the meshes from inside
the prefabs. I'm afk at the moment, but I believe they land in
Assets/Tiled2Unity/Meshes/

As long as every quad had at least 4 unique vertices (6 uniqueness each
triangle should work as well if that's simpler) that would solve my problem
either way.

I got my "MeshUnoptimizer" and UV calculation logic sorted, so there's no
rush.

I've got a Makefile I use to automatically run Tiled2UnityLite against my
.tmx files and can add whatever custom flags I'd need to make that work.
I'm a coder so I can test a patch or provide a Behavior that reproduces the
issue if it helps.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#37 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AGqEFoZTk8bLezIdFhxawu-ajjhr6qwKks5qH5BogaJpZM4IsQjS
.

from tiled2unity.

fmoo avatar fmoo commented on September 24, 2024

Sorry for the confusion, they're definitely .obj files, not .dat files.

I've created a gist that explains the issue a bit better and provides the behavior and support classes to repro here: https://gist.github.com/fmoo/5f5787d2a22a3252405d3c75f3ef15ff

The behavior swaps out 10 random quads on the target layer with 10 random tiles selected from the source layer every behavior Update().

Here's a screenshot of the issue when the mesh is not preprocessed to remove optimizations:
selection_919

As you can see, while some of the tiles render correctly, others have been corrupted with the source texture stretched at weird angles. As stated before, this is because those tiles on the original mesh had previously been adjacent to their same neighbors as on the source texture, so the underlying mesh shared vertices (and uv values); When one neighbor gets swapped to a tile that is no longer adjacent, the neighbors' shared uvs move to the non-neighboring part of the source texture, causing the texture to render an unexpected region to the neighboring triangles.

from tiled2unity.

Seanba avatar Seanba commented on September 24, 2024

Thanks, my schedule may keep me away from checking this is out as soon as
I'd like but I'll see if there's an easy fix eventually.

Best,
Sean

On Fri, Jun 3, 2016 at 11:49 AM, Peter Ruibal [email protected]
wrote:

Sorry for the confusion, they're definitely .obj files, not .dat files.

I've created a gist that explains the issue a bit better and provides the
behavior and support classes to repro here:
https://gist.github.com/fmoo/5f5787d2a22a3252405d3c75f3ef15ff

The behavior swaps out 10 random quads on the target layer with 10 random
tiles selected from the source layer every behavior Update().

Here's a screenshot of the issue when the mesh is not preprocessed to
remove optimizations:
[image: selection_919]
https://cloud.githubusercontent.com/assets/143504/15785992/13fb69de-296f-11e6-8cb5-66c797ca7ca3.png

As you can see, while some of the tiles render correctly, others have been
corrupted with the source texture stretched at weird angles. As stated
before, this is because those tiles on the original mesh had previously
been adjacent to their same neighbors as on the source texture, so the
underlying mesh shared vertices (and uv values); When one neighbor gets
swapped to a tile that is no longer adjacent, the neighbors' shared uvs
move to the non-neighboring part of the source texture, causing the texture
to render an unexpected region to the neighboring triangles.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#37 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AGqEFtQPpVSCItFBhe4c_4nWEdtet4lyks5qIFr_gaJpZM4IsQjS
.

from tiled2unity.

fmoo avatar fmoo commented on September 24, 2024

Thanks Sean, I'll reopen this just so it's less likely to get lost. Feel free to close it out if it looks like it's an optimization unity is making on their end and doesn't make sense to try to work around.

from tiled2unity.

Seanba avatar Seanba commented on September 24, 2024

Sorry I haven't fully resolved this yet but I do have a working solution I hope to put into Tiled2Unity soon.

What I'd really like to do is have the model importer settings automatically assigned for you during export (Optimize Mesh disabled, Vertices Readable/Writable enabled, Keep Quads enabled, etc.) when you choose this option. Unfortunately, Unity does not make the "Keep Quads" option available through script. However, I did enter a bug with Unity and have heard back that they plan to address that soon.

I probably won't wait on that bug fix before deploying this but I'll keep an eye out for it regardless.

Anyways, more to come, soon.

from tiled2unity.

Seanba avatar Seanba commented on September 24, 2024

FWIW, I haven't lost sight of this. I still need Unity to make the "isWriteable" flag exposed to scripting on the ModelImporter class.

from tiled2unity.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.