Announcement

Collapse
No announcement yet.

Using SV_InstanceID to retrieve instance id

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • replied
    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.

    Leave a comment:


  • replied
    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

    Leave a comment:


  • replied
    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?
    Last edited by nonchip; 02-26-2020, 01:58 PM.

    Leave a comment:


  • replied
    [Update] I was able to get this to work by changing 2 lines in LocalVertexFactory.ush:

    Click image for larger version

Name:	lvfdiff.PNG
Views:	228
Size:	42.1 KB
ID:	1715726

    Leave a comment:


  • started a topic Using SV_InstanceID to retrieve instance id

    Using SV_InstanceID to retrieve instance id

    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?

    Thanks for any feedback
Working...
X