- Home /
How to make dynamically texturable object model?
Basically I've had experience in a previous project. That project took place in the GTASA engine.
In my new unity project I'm attempting to make a similar material system. In GTASA object models are very basic and manually changing the textures is a really easy process (given you already have knowledge in modding or scripting servers). Each model has textures assigned to indexes.
For example you could have a sidewalk, the concrete slabs would be texture index 0 and the grass would be texture index 1 of the object. The textures were indexed on each object. This was a very simple and useful system for things like SA:MP (https://wiki.sa-mp.com/wiki/SetObjectMaterial, you could set textures in the game at runtime or even just change the color of a texture on the object).
What would be a good way of having a similar access to textures in Unity? I would like to make it so players could paint house walls and make cool colored sculptures while in game with my project.
Is there a way to make a shader that can hold perhaps like 24 different texture indexes? Then the textures could be selected by the material or perhaps a script on the object. I'm not sure what the best approach would be. Multiple materials on one object that can be changed during runtime, textures that can be changed and updated by the shader, mind boggled here.
I found these similarly relative links:
Shader with multiple textures and material options for each of the four (max 4 per mat) https://assetstore.unity.com/packages/vfx/shaders/multi-texture-shader-56137
Similar question, unanswered and not exactly what I want but the most similar I could find https://answers.unity.com/questions/1207394/multiple-textures-on-single-game-object.html
The textures themselves will be generally 256x256 or 512x512. Thus, potentially I could have just a really large texture atlas of like 4096x4096 yielding 256 different textures (16 by 16 textures, each 256 by 256px). This seems like it's like the better option but would this be more efficient than my above thought process?
SanAndreas ran quite efficiently even on dinosaur computers... and that's basically what I'm looking for. $$anonymous$$aybe if Unity had some sort of similar support for texture archives ins$$anonymous$$d of relying on texture atlasing for less GPU calls.
Your answer
Follow this Question
Related Questions
How to add texture to Blender objects properly? 2 Answers
Material not updating on Image 2 Answers
Set image as material 0 Answers
Texture problems with Mixamo and Unity 0 Answers
Having wrong texture on my model? 1 Answer