-
-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make names of the methods for mesh materials more consistent #2589
Comments
About the fragment/vertex shader problem, the two shader types can be added as different functions in one shader script. And yes, I know this doesn't fix your main problem but I hope it helps... |
That seems like a problem if you needed to use the same vertex shader for several objects with different fragment shaders. |
Here is a relevant discussion To summarize here, In your described use-case, you should always be using The confusion here arises because the API does not make it clear that each Accordingly, there are two possible changes that may help the confusion you are having:
|
Yea I didn't know that. Both those suggestions sound reasonable. It could also be simplified to get_override_material() just be sure that whatever it is named that there is a mirror to that in the multimesh class. That is unless is some reason that only meshes need over ride materials but multimeshes don't. |
The name needs to specify that it overrides a particular surface or else it will get confused with |
one thing I don't understand is why there needs to be surface material overrides in the mesh instance in the first place. Seeing as how you can already make the original mesh materials local to scene and over ride them using the code associated with the resource. |
This allows you to share a For example, I might have a forest of trees, for performance reasons I want each tree to use the same This is not only much better for performance, but it also really simplifies the organization of your scene. In other words, for medium to large scenes it will be way too complex to have a separate I hope renaming the property and the associated setter will help clear up the confusion you are experiencing for other users. |
Maybe I should start a new feature proposal for this, but it is relevant here. Perhaps rather than override it should be overlay. Such that you could apply a translucent material over the material from the mesh resource. In your example you could just apply a layer of blue when selected with an alpha of .5. You could still have a boolean with the option to over ride but I think having the option to overlay would be extremely powerful. Because you aren't getting rid of the previous information it would even help with the 1000 fish project I'm trying to do. I could use the material overlay function inherited from the geometry class to overlay a vertex shader, that way I can still use all the textures from the materials from the mesh resource |
@lukostello That is an interesting idea and yeah, it would certainly require another proposal. Off the cuff, a few comments:
|
Ctrl C Ctrl V |
@clayjohn Also I think the mesh resource surfaces don't need a row just for the name. It could look the same way it looks in the mesh instance "materials" then to change the name you just double click on the number on the left hand side and write it there. In fact you should be able to do this in the mesh resource default surface drop down or the mesh instance override surface drop down and the names would be shared between them. |
I'm not sure I follow what you are suggesting. A surface and a material are two different things. A surface is a collection of vertex attributes (arrays of position, normal, uv etc.) combined with a material. The MeshInstance has no way of overriding specific surfaces. It overrides the material associated with a particular surface. In 3.4 the "Material" dropdown menu in the MeshInstance is now named "surface material override" to make it clear it is a material override for each surface. |
@clayjohn "surface material override" is very similar to my suggestion of "override surface material" doing that will satisfy the main nitpick I had. and I think you already changed the methods to match that. One thing I added is calling the surface materials from the mesh resource "default surface materials" if you want to distinguish the difference on both sides. Other than that I noticed the row used in the mesh resource "surfaces" for name isn't necessary. The names could be on the left and the materials could be on the right similar to how it is with the mesh instance "materials" then to give it a new name you just double click on the name (which by default would be a number) and type to change it. These names would be shared between both the mesh resource default surface materials and mesh instance override surface materials and could be used in methods like get_surface_material(surface_name) because I think you can only access them by number right now and I'm not entirely sure what the names are for atm. |
or perhaps better yet "default_surface_material" and "instance_surface_material" that way if we ever switch to the overlay method, the name stays the same |
poop, I just realized I do infact need instance surface materials for a multimesh instance in my game. edit: nvm was able to do what I wanted using other means. I was under the impression that if you needed to feed parameters to a shader the shader had to be on the override material. But you can just make it unique with the mesh resource material. In fact I'm realizing that it would be very odd to need a material over ride for multimesh instance. Because the over ride on the mesh instance is for when there are many meshes with the same material except for a few. If you've got many multimeshes with the same material except for a few; I'd wager you could be using those multimeshes more effectively such for each shader being used by a multimesh you'd only need one multimesh implements them |
Describe the project you are working on
I'm trying to follow along with the 1000 fish demo for the multimesh tutorial
Describe the problem or limitation you are having in your project
I couldn't apply the shader I used for a single mesh for the multimesh
Describe the feature / enhancement and how it helps to overcome the problem or limitation
the mesh instance provides a get_surface_material method that I used when making the shader for the single mesh and if the multimesh also had the same method I wouldn't need to create 2 codes one for the single mesh instance and another for the multimesh instance. Instead I had to do multimesh.mesh.surface_get_material(0) which you'll notice references the mesh resource which has yet another convention.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
I think mesh instance, multi-mesh instance and the mesh resource should all use the same convention. Not just with the get_surface_material but also set_surface_material and probably other methods as well.
If this enhancement will not be used often, can it be worked around with a few lines of script?
You'd have to create and maintain 2 seperate scripts which would be tedious and unnecessary.
Is there a reason why this should be core and not an add-on in the asset library?
its just some name changes.
P.S. would be handy to have a downloadable finished version of the 1000 fish demo. I'm still having trouble figuring out how to apply a vertex shader to something that already has a fragment shader and retain the fragment shader properties.
The text was updated successfully, but these errors were encountered: