Topic was automatically imported from the old Question2Answer platform.
Asked By
sante
Hello everybody.
I’m asking for something about ShadersMaterials performances vs. SpatialMaterial…
Suppose one have to do a simple work, like apply a single diffuse texture to a mesh, doing it with a couple row shader is better (in speed terms) respect using a simple and confortable SpatialMaterial or performance are the same?
Naturally I’m speaking in “pratical situation”, rather then theory…
Practically I wouldn’t worry about it. There are usually a lot of other things that affect performance way more, like not sharing material between objects.
There is no difference between a SpatialMaterial and a ShaderMaterial if they do the same operation and produce the same material. If you right click a SpatialMaterial and convert it into a ShaderMaterial they should have more or less identical performance.
Now, if you don’t need everything the SpatialMaterial does, you can write a ShaderMaterial that does less operations, and in turn will have better performance. But I’m pretty sure the difference will be negligible, unless you have hundreads of non-shared material instances.
For example, the shader below will have better performance than the default SpatialMaterial, due to making less operations.