Home Unreal Engine

Editing Vertex Colours during runtime

passerby
polycounter lvl 12
Offline / Send Message
passerby polycounter lvl 12
is there any way possible to to edit vertex colours during run-time in UDK, with a script or actor somesort, i want to try and make something based on some natural selection 2 art and want to find a way to do infestation that is slowly over taking the map.

which visually i can pully off easily with a vertex paint shader and some tessellation, but i can olny paint that in, im hoping there is a way i can make it spread at runtime.

Replies

  • tharle
    Options
    Offline / Send Message
    tharle polycounter lvl 9
    i dont think vertex colours are able to be edited at runtime i'm afraid. can you not just use a time and sine node to gradually increase the spread of the texture based on the static vertex colours? you could combine in things like world position and some texture masks to get quite a good effect. i guess you'd have to have some sort of limit to stop the infection from receding again which is probably just doable with an if node and the time as the control. let me know if that doesnt make sense and i'll see if i can whip up a quick example.

    cheers
  • passerby
    Options
    Offline / Send Message
    passerby polycounter lvl 12
    tharle wrote: »
    i dont think vertex colours are able to be edited at runtime i'm afraid. can you not just use a time and sine node to gradually increase the spread of the texture based on the static vertex colours? you could combine in things like world position and some texture masks to get quite a good effect. i guess you'd have to have some sort of limit to stop the infection from receding again which is probably just doable with an if node and the time as the control. let me know if that doesnt make sense and i'll see if i can whip up a quick example.

    cheers

    ya i could do that paint in some vertex data, than animate a scaler value that it is multiplied by by the painted in vertex data. but in that case it would all fade it around the whole map at the same rate, instead of starting in 1 location and spreading out, unless i try to paint the vertex data in as gradients, and if i wanted to make it climb something i could mess about with a vector and the world position, but i'm not sure how i could make it spread outwards on the floor.

    i was really hopeing there was some way to access vertex colour data during runtime so i could just script a actor that changes vertex colour data around a user set radius.

    im sure there prolly is some way possible using world position and vectors, but not sure how i would go about it.
  • tharle
    Options
    Offline / Send Message
    tharle polycounter lvl 9
    yeah, you'd have to paint in gradients with the vertex data, but you've got up to 4 channels of information you can use and any number of maps and masks etc. to multiply it by. for example you could paint in blue as the base infection and then green as the rate and combine the 2 in a way to make it easier to control the spread.

    it would be the same every time i guess unless you linked in some random variable that was generated at runtime (i'm not 100% on how to do this but i'm sure it's possible with kismet) or did you want the infection to be dynamic based on the player? you could probably do that with some trigger volumes affecting the material somehow (again not 100% - havent used kismet that much but i'd bet it's possible)

    how exactly did you want to animate the vertex colour data without using gradients?

    if you post up the concept you want i'll try and have a look at knocking up a shader tomorrow if i have time.
  • passerby
    Options
    Offline / Send Message
    passerby polycounter lvl 12
    ya thanks for the ideas, i haven't started the environment yet, since i wanted to figure out what is possible first.

    If i just make this for portfolio reasons i could just fudge it with the vertex colour gradients and the worldpostion, dot product and animated vector. but ya i really was more just wondering if there was some dynamic way to access the vertex colour data, was thinking if i could get the data and figure out how it works i could write some uscript that essentially re-colours a vertex than spreads to the vertex's it's attached to and repeats the the whole function with maybe a radius around the actor where this stops happening, since it would have been cool if it was a dynamic effect that would happen around say a alien structure that was placed by the player.

    and yes it is possible in both Uscript and kismet to take a make a random number and place it into a scaler material paramater, and the same can be done with vectors in uscript but not kismet.

    dont worry about trying to make a shader up most of these work arounds i have already used the core elements from in other shaders of my and have experience with those ideas.

    thinking i may be able to take advtange of this, http://udn.epicgames.com/Three/ScriptedTextures.html

    edit: found a realy easy and cheap way of doing it too.

    i can just plug the "World Position" node into a "SphereMasks" A input than into B plug in a vector 3 that contains the coordinates of the origin of the spread, than hook in a scaler parameter into the radius that i can up to cause it to spread out more from the initial location.

    with the addition of some maskes i might be able to make that look ok, and maybe even some pre painted vertex colour too to give it a interesting path as it grows in.
Sign In or Register to comment.