Home Unreal Engine

1 shader displaying random textures per instance

Is there a way in UDK to set up a shader to display random textures (from a list) per static mesh instance?

IE, A a room with 4 tv's, using the same static mesh for each, but each one displaying a different image on the screen?

Replies

  • Visceral
    Options
    Offline / Send Message
    why dont you try with material instancing and then replacing the texture for each material instance? or do you mean they should animate to show random textures?
  • kdm3d
    Options
    Offline / Send Message
    no, not animate. And even with the material instances, I'd have to make a new static mesh for each material. I was hoping to have 1 static mesh that picked a texture for each static mesh instance in the world.
  • haiddasalami
    Options
    Offline / Send Message
    haiddasalami polycounter lvl 14
    kdm3d, I think I have a rough idea of what you want. Gonna try tommorow and see if I can whip something up with Kismet and material editor. I remember on my UDN wiki rampage that a static parameter can be accessed through kismet. Though my Kismet is not as good as some of the others around here....
  • Neox
    Options
    Offline / Send Message
    Neox godlike master sticky
    maybe you can use the world position to randomize stuff or use kismet, but i'm not sure, hmmmm definitely a thing to play around, never did that before
  • McGreed
    Options
    Offline / Send Message
    McGreed polycounter lvl 15
    Yeah, I'm pretty sure you will be using Kismet for this, creating a parameter texture node in your shader with a name, and use that name to reference in Kismet to randomize from an array of textures. (roughly the idea)
  • Parkar
    Options
    Offline / Send Message
    Parkar polycounter lvl 18
    kdm3d wrote: »
    no, not animate. And even with the material instances, I'd have to make a new static mesh for each material. I was hoping to have 1 static mesh that picked a texture for each static mesh instance in the world.

    You don't need to create multiple static meshes. just drag and drop the material you want to use to the mesh instance. The materials assigned for the static mesh is just the defaults. If you have multiple materials per instance you may have to go into the properties of the instance and assign the material that way.

    I could see the random stuff be useful when you have a huge amount of meshes though.
  • moose
    Options
    Offline / Send Message
    moose polycount sponsor
    all you need is 4 Material instances, and use the method Parkar described.

    Create a Master material that has been parameterized
    - create your 4 MICs and assign the tv texture to each
    - for extra flair add some more parameters to change animation per tv - scrolling images, static, flickering, extra params for normal/spec textures to make busted tvs, etc.

    place your 4 meshes, and assign the MICs to each of them in the world, either by drag/drop, or by going into the properties, SM Component > Rendering > Material, and adding your material.

    If you add some params to each of them, you can change/animate them via ksimet/matinee, but the simplest solution is 4 materials assigned to the same SM in the world.
  • kdm3d
    Options
    Offline / Send Message
    perfect, I didn't know you could assign materials per instance, that will work for what i need to do with just a few materials. I would be interested in seeing if the other would be possible.

    I know at Bungie we had a way of doing that, just having different permutations of just a region of each mesh then that either gets swapped out randomly, or you could set it per instance.

    Thanks guys, Let me know if you come up with something!
Sign In or Register to comment.