Jump to content

Freezing materials on instances


jeremybyington
 Share

Recommended Posts

I read in another topic/question here that you should not freeze materials of instances, and from personal experience I see (or should I say, "do not see") the problem...the instances are transparent. Is it better to give the instances their own material to share and freeze it, or to not freeze the material for that mesh and its instances? Also, what is causing the problem of the instances not being visible when the material is frozen? I have no background in 3d, so it could be something obvious, but I am still curious.

Link to comment
Share on other sites

Hello

first of all instances must share the same material as the source mesh. If this is a problem you can still use clone (but they are less efficient)

You cannot freeze the mesh material when instances are used because of how instances are rendered (Let me know if you want me to dig more into details :))

Link to comment
Share on other sites

Oh, yes, please! I love details. From what I gathered so far I understand that instances are all handled in a single draw call rather than an individual draw call for each one if they were their own unique meshes. Is that the same draw call as their source mesh or an additional draw call? 

Link to comment
Share on other sites

Ok so let's go for gory details :)

- Instances are rendered with only one draw call

- The visible instances and the root mesh (if in the frustum) generates a list of matrices (the world matrices)

- The geometry (shared by all instances and the root mesh) is then rendered using the list of matrices to compute the various positions

- The new material system could probably work even if you freeze the material of instances (but need to be tested)

Link to comment
Share on other sites

By "new material system" do you mean the new standard material being created for the instances or do you mean there is a new material in development?

My current project uses an art style that is no lighting and emissive colors only and there is a palette of like 10 colors so I was thinking there must be a way to reduce it down from the 300 materials that currently exists after importing several scenes. Many of them need to be duplicate materials to be controlled separately to change only their color, but around 200 materials are duplicates that should be merged somehow and frozen since there is no lighting or shadows. Is there something in the docs I am missing about merging materials or is there another material I should be using instead of Standard Material for the emissive-only style?

Thanks for the help!

Link to comment
Share on other sites

I changed the material in 3.0 and you can already test it if you pick the latest bits :)

200 materials duplicated: this is a HUGE idea to merge them into one :D

If they all are the same, then only create one material and affect it to all meshes

 

Regarding options like no emissive or whatever, this is automatic: the shader will always have the right content for you (we strip out everything which is not required)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...