Hi, I’m making a mobile game and I’m planning ahead how should I handle the graphics of my game.
I know I need mixed lighting so I want to save all I can in terms of textures being loaded to the gpu.
Most of the surfaces in my game will have a plain color for each polygon so my mind jumped straight to implement in the standard shader the ability to sample the albedo color from the vertices (which by the way I have no idea how to do).
Another approach that I thought of is using a low res texture with a fixed pallette and build my models mapping the uvs to different colors, this way most of the models would share the same material.
I know that with my second solution baking will work fine while with my first solution (easier to work with due to the possibility to edit the vertex colors quickly) I’m not even sure if it’s possible.
How would you approach this situation? Any solution I didn’t think of? Thanks!
I’m currently using this approach. Original design called for 32 characters and a complete flat shaded low poly environment to be textured by ONE only 256x256 texture for all assets, excluding special FX.
No complaints here so far. Although lighting is a @#$%! when everything is animated - going to mobile.
I’m not a coder - so I can’t comment on any shader techniques - though I briefly considered vertex colors - but realized I can UV a low poly model and map it in the same amount of time it takes to map the vertex colors - so I just went with the technique I’m most comfortable with.
The texture you used is a pallette or a gradient? Your points are good, I guess I’ll end up doing that but I have to figure out how to organize the colors
I use blender, didn’t know about this feature. Does it support previously created textures? Like if I use the same texture for two models with already used colors
I use a palette only although I can add gradients if I want to without effort. I still have a lot of room left on the sole texture. I may reduce down to 128 or even lower.
For mobile I would highly suggest using vertex colors, or read from a texture in the fragment shader, over reading from a texture in the vertex shader. It’s totally possible to read a texture in the vertex shader, but this can actually be slower than just doing it in the fragment shader due to the way mobile GPUs handle textures, especially older gles 2.0 devices. However if you are reading a texture in the fragment shader, and you’re doing a low resolution swatch or gradients, be careful that it might look much worse on device because of texture mipping and compression.
Vertex colors should be way faster than either option using a texture. If you want to do the coloring using UVs and a texture in your modeling program and baking that down into the vertex colors, that’s totally fine. Use a whatever method you’re most comfortable with using.
I think I’ll try to edit the standard shader to work with vertex colors. I say “try” because I know it will end badly I’ve been studying a bit about shaders but I’m nowhere near the full comprehension of that monster