8
\$\begingroup\$

My question is: There's any way of having GameObjects sharing pieces of same Material, not a clone, but an extension of one? For example, in these case nine game objects sharing just the same material enlarged to fulfill the size of nine ones:

Grass

And in the case, I delete for example one in the middle, it will keep the same material enlarged with the blank space inside:

Grass2

For this purpose, I used one material per object, but my intention is to use it just one texture for multiple objects, or for example, more of one texture in different parts of the same one. (Like the painting button we have in the custom Unity3D Terrains).

\$\endgroup\$
0
\$\begingroup\$

You can create a sprite atlas from one texture, create a child object for your plane or whatever shape you are using, drag in created sprite cutouts, Rotate and place the child within the plane gameobject however you like, and voila, look at the pic below to see what I mean,

sprite atlases

It might be tedious work but it seems like this solution fits what you want.

\$\endgroup\$
0
\$\begingroup\$

Have you looked into using Unity's Shadergraph to make your own shader for the material? You might be able to achieve what you want by using the worldspace position for texture/uvs. I am not good at explaining it and am not great at shaders but I mocked up a quick example for you as a water shader because I was bored and already playing around in my project dedicated for experiments.

This picture is showing that the overlapping planes appear to share the same material example materials

This is the example made in shadergraph Shadergraph example

Quick summary of the shader nodes from my example as I understand them

  1. These nodes are grabbing the x and z values in worldspace and combining them in a vector 2
  2. This node is using the xz values and offsetting them based on nodes in 3
  3. using Time and a Vector 2, to scroll the uv offset. gives a wave effect
  4. Multiplying the value based on Normal Tiling value.
  5. Takes the UV data from 4 and a normal map
  6. Normal strength. changes the strength of effect
  7. Takes all the data from 1 - 6 and the water texture and feeds into albedo in 8
  8. all the nodes feed into here for the shader to change how each of these properties affects the material.

If anyone thinks anything I have said or done is incorrect or could be improved, please feel free to correct me. I am still learning and a nudge in the right direction is always welcomed. I have uploaded the example scene to google drive for you mess around with. unsure if attribution is required but the water asset used is free and from gametextures.com

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.