Code Monkey home page Code Monkey logo

Comments (4)

HungryProton avatar HungryProton commented on September 17, 2024

Hi! Thanks for the detailed report!

Version 2.8 doesn't change anything regarding how materials are handled, so it probably won't fix your issue. (But it doesn't hurt to upgrade, especially if you plan to move to Godot 3.4 at some point).

Materials are a pain in Godot, but I think this is probably related to issue #46.

  • Godot doesn't let you edit mesh resources files directly, (when importing an obj for example, you have to create an inherited scene first).
  • MultiMeshInstance doesn't care about this scene and works with the mesh resource directly.
  • Which means, all the materials from the inherited scene are ignored.

The fix was to save a reference to all the materials when the instancing is done the first time, and restore them on _ready each time. The issue is, we can't use Material Override for this because the mesh may have several surfaces, not just one, so we edit the mesh resource instead. But since the add-on just keeps a reference to the original material, not a duplicate, that's probably what's causing the material to become an ExtResource in the last screenshot.

This is a tricky issue, but I'll try to come up with a fix soon.

from scatter.

HungryProton avatar HungryProton commented on September 17, 2024

So, it's rather hard to debug since I haven't figured out the exact steps to recreate the issue (it did happen at some point but I don't know what I did exactly). I haven't managed to trigger the bug again after my changes, so maybe it's fixed? Let me know if it happens again.

I've also added an option under the ScatterItem node, called Merge target meshes.

  • It uses all the meshes from the source scene, rather than just the first one it can find.
  • It still generate a single multimesh but the result is visually identical to what you get when not using instancing.
  • The drawback though is that it creates a brand-new mesh resource, directly stored in the current scene.
    • It's not an issue for small meshes but may or may not cause issues with meshes with a high polycount so it's disabled by default.
    • It's not an issue either if you update the source scene, changes will be updated automatically.
    • You probably won't be able to replicate the material issue when this option is enabled

It's pushed on the master branch, commit 53cb1fa.
I'll probably make a release soon, but let me know if you still have issues!

from scatter.

DeerTears avatar DeerTears commented on September 17, 2024

Thanks so much for the quick fix! I haven't tried it in full, I'll let you know if the issue comes up again or if it seems totally fixed.

At the very least, the ability to make new resources to protect the instantiated one sounds like a really good work-around. I don't use scatter for high-poly meshes, and my build size is mostly dictated by textures rather than models, so the added filesize shouldn't be an issue for me. After experimenting with the new release I might go back to the old version to try and find something more consistent for reproduction, cause I have a few ideas I haven't tried yet.

from scatter.

HungryProton avatar HungryProton commented on September 17, 2024

Closing due to lack of activity. Feel free to re-open it if the fix above didn't solve it completely.

from scatter.

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.