What is best method of performance for cheap coloring

Hi all

What is the best way for coloring multiple objects that’s also good for performance.
[1] Material Color
[2] Object Color
[3] Vertex Color
[4] Texture Color (probably not this but just wanted to be sure) :wink:

Cheap? Can do.

You slap a plane on top of the camera, or on an overlay scene if you wanna be fancy about it.
Give it a solid color and set alpha blend mode to add.

One can also use a very small image with one color per pixel.
Basically, you build yourself a pallette and UV map faces to each color individually. Yeah, face by face. Talk about fuuuuuun stuff… but it’s the real way of doing the toon shaded mambo, anything more refined than that is a scam.

Hi @Liebranca

Thx for the reply.

Would single pixel textures be a file size problem (?) (I’m talking about maybe 1000+ materials) :slightly_smiling_face:

You reuse the same texture for every last material, that’s the beauty of it.
With 64*64 image you have 4096 colors to choose from. You can go pretty hardcore with this.

@Liebranca

You would still need INDIVIDUAL material for that to happen, am I wrong (?) :thinking:

Check it.

You could also just snap all faces to a single color square. You could do that on a separate UVMap, then have the texture slot blend with color mode or something like that.

@Liebranca

Ok.
You propose unlimited materials & 1 uv :slightly_smiling_face:

But now I need unique object meshes for different uvs :slightly_frowning_face:

I’m trying to go for same materials & same objects (for good performance)

I work with some pretty obsolete hardware and having an extra cube or UV isn’t a concern.
But if you must use a single material and no UVs, use vertex colors.

Cheap in RAM does not imply cheap in performance.
He’s asking what runs the fastest on the vertex and fragment shaders, and I think it depends on the engine.

Edit: for example, imagine if my shader put red for every non BG pixel, that would be “insanely fast”, even for very dense vertex groups.

@Liebranca + @horusscope

I’m asking for best solutions as SHADERS I use a lot & they take A LOT of my GPU & CPU (I have slow computer) :wink:

I’m aiming for 1000+ objects.
Performance hazard.
But I believe it is possible with my kind of hardware.

You’ve seen the stuff I make, it runs on a toaster.
One can drop shaders and lights altogether. Properties->Render->Shading-> untick stuff.
For ridiculous number of objects on a scene, simple shading is not enough. Use the power of occluders and LODs.

In terms of raw G/CPU performance, a single diffuse color which has no variance is going to run faster than a buffered array of colors. However, I don’t believe this is your performance bottleneck.

Edit: I think Liebranca’s solution is very cool, and I’m not trying to discount it. I don’t believe forgoing textures is the answer to your problem anyway. That’s what I was pointing out, that obviously not using images is going to be faster by natural law, but that can’t possibly be your program’s slow-down.

@Liebranca & @horusscope

Thx BOTH for the good replys.

Materials aren’t really the performance hazard, but they are a problem with RAM.

I’m trying to get tip-top condition for my project as I already stated is HEAVILY done with SHADERS.

Can you give some example code?

@horusscope

SHADER code (?)

I’m using @Thatimster’s SHADER Add-On.

HDR
SSAO
Levels
Bloom

Also I have split-screen going on which is double the visuals so . . .

Ya like… show me the code segment where your CPU is maxing out

@horusscope

I don’t quite know what your meaning by “code segment”

It’s the SHADERS that have True_Pulse on :arrow_down:
That are the most problem.
HDR
SSAO

(Bloom)
&
(Levels)
Our the only SHADERS that I can get away with due to only being on level_pulse.

I mean profile the code and find the areas where the CPU or GPU usage reaches a peak.
Maybe consider things like number of lights which hit an object if you’re a designer and not a programmer. Shadows is another big one, maybe some objects which don’t move you could add their shadow to the ground texture ‘baked’ and use hard shadows for dynamic objects.

@horusscope

On a totally blank new file + smallest window size & resolution + no other programs working
I get 600 fps.

I get lag on the GPU with SHADERS.
But also CPU even tho it’s not always popping-up on the profile.

You mean your game full of assets is running at 600 fps? Which is possible, just trying to be clear because that means you don’t have to optimize anything…

but, when you run a particular shader the FPS drops?