Does anybody know if it is possible to use SV_InstanceID to retrieve the instanceID for a standard Instance Static Mesh in a shader? By default it seems to only be included if MANUAL_VERTEX_FETCH is enabled… what is MANUAL_VERTEX_FETCH?
do you think this could be done in a plugin or per project? i need something like this in a project but don’t want to modify my engine directly because of future proofing etc. so i guess my question is is there a way of overriding that file (possibly autogenerated by applying a patch versus the original on compile time) in a plugin and make the engine somehow “redirect” to that when building shaders?
or maybe even make another vertexfactory that can then be selected to be used in a specific material?
Totally agree with you- would be great to put in a plugin instead of engine patch.
I am uncertain about the ability to override a shader in a plugin - but I believe you could make a custom VertexFactory, although that is probably relatively complicated as you would probably need to implement a custom HISM/ISM to use it.
BTW - If you use HISM (instead of ISM) the technique won’t work, because each LOD Cluster of the HISM has its own array that SV_InstanceID references.
So I ended up going back to encoding in the w-component anyway.
Let me know if you find a way to get it working in a plugin - would be awesome
Shaders can be edited and recompiled manually, it’s the easiest way. Tho you can create a plugin that edits the file then trigger a shader recompile, but don’t wait for it.