Blending textures and vertex colouration...

Discussion in 'Track Modding' started by Simon Peace, Aug 1, 2012.

  1. Simon Peace

    Simon Peace Registered

    Joined:
    Nov 10, 2011
    Messages:
    121
    Likes Received:
    0
    in feels3 thread about terrain texturing he talks about the following...

    "Last step is for final touches. I usually add some colours (mainly dark grays) to the single vertexes.

    You can add some darker areas in places where you want.
    Remember to change channel to vertex colour in object properties before you will start changing vertex colours."

    and in the track tech document there is reference to texture blending... and making sure you do it after you finish your mesh.

    I've never done any of that before and would appreciate someone explaining the process/techniques to help me and others.

    Ta
    Simon
     
  2. Radar

    Radar Registered

    Joined:
    Oct 20, 2010
    Messages:
    687
    Likes Received:
    60
    This would be nice combined with Feels thread rather than switching between two or missing this one at a later date..
     
  3. ethone

    ethone Registered

    Joined:
    Nov 30, 2011
    Messages:
    1,153
    Likes Received:
    37
    What feels3 wrote about making patches or edges or areas darker works on the "Vertex Color" channel. Essentially you can assign a color to a vertex that will paint on top of the texture at that specific vertex. If you assign color values in the monochrome range that boils down to darkening areas, like feels3 suggested. I used it on Fuji for the orange end sections of the guardrails, which would be a non-monochrome example. There is only one guardrail texture used and yet the track has both the standard grey-ish guadrails and the clearly different orange sections.

    Texture blending works on the same principle but on a different channel, namely "Vertex Alpha". Instead of painting color on top of the texture, you'll be painting the secondary texture over the primary one. With its strength depending on the vertex alpha value.

    Vertex alpha should be done when you're finished with the mesh (or redone when you're finished with the mesh) as there is a bug that messes up the vertex numbering when adding a new vertex to a mesh, hence distorting your terrain blending. I haven't seen that issue with vertex color but to be on the safe side you should keep that until you're certain you're adding no more vertices as well.
    There is no immediate need to do both on the same mesh but of course it might happen so the safer rule of thumb would be to do both in the last stage of preparing your mesh.
     
  4. Fabio Pittol

    Fabio Pittol Registered

    Joined:
    Oct 4, 2010
    Messages:
    274
    Likes Received:
    71
    This video shows how the technique works. It uses the slate material editor instead of the classic one, but you can still catch the whole idea.

     
  5. mianiak

    mianiak Registered

    Joined:
    Oct 5, 2010
    Messages:
    691
    Likes Received:
    46
    You can bake vert colours into a mesh, I use this technique a lot because it gives more of a natural flow and saves a lot of time.

    I made a quick video to demonstrate it, http://youtu.be/UlvMc49ni6s
     
    1 person likes this.
  6. ethone

    ethone Registered

    Joined:
    Nov 30, 2011
    Messages:
    1,153
    Likes Received:
    37
    Nice technique mianiak, thanks for sharing!
     
  7. Simon Peace

    Simon Peace Registered

    Joined:
    Nov 10, 2011
    Messages:
    121
    Likes Received:
    0
    i'm still a bit new to texturing... and wonder if someone could shed some light on which shaders to use from the gmotor set for this kind of blending between two textures...

    Can someone also enlighten me on the process for putting a gravel trap in the middle of some grass (for example)... would you have some poly's that are strictly one texture (ie. gravel) and then the surrounding polys blended to the grass? then grass only texture?
     
  8. Fabio Pittol

    Fabio Pittol Registered

    Joined:
    Oct 4, 2010
    Messages:
    274
    Likes Received:
    71
    Based on the Joesville section released by ISI it's Blended Grass Infields shader.

    The other question seems like you should use decals. But it's something I don't know how to use either. So maybe the track-gurus could help us! :p
     
  9. mianiak

    mianiak Registered

    Joined:
    Oct 5, 2010
    Messages:
    691
    Likes Received:
    46
    Decals are easy, just raise the decal mesh about 1mm over the main mesh and give it the decal tag. You need to use an alpha material and make sure the sides of the texture fade out to nothing (so it will blend).
    You 'can' use it anywhere really, but it's mainly used for track edge blending and road markings.


    What the decal tag does is it makes sure that that mesh is always drawn ontop of the main mesh, in the old days doing this would cause flickering and you had to raise it up quite a fair way to prevent it.
     
  10. Fabio Pittol

    Fabio Pittol Registered

    Joined:
    Oct 4, 2010
    Messages:
    274
    Likes Received:
    71
    But my decal mesh needs to follow my terrain elevations perfectly? Or it will be "projected" on the surface?
     
  11. Luc Van Camp

    Luc Van Camp Track Team Staff Member

    Joined:
    Oct 4, 2010
    Messages:
    1,030
    Likes Received:
    15
    It needs to be quite perfect, yes.
     
  12. ethone

    ethone Registered

    Joined:
    Nov 30, 2011
    Messages:
    1,153
    Likes Received:
    37
    Copy your terrain mesh, lift up 1 or 2mm, delete or cut away parts you don't need. ;)
     
  13. K Szczech

    K Szczech Registered

    Joined:
    Oct 5, 2010
    Messages:
    1,720
    Likes Received:
    45
    I'd rather say: copy your terrain mesh, don't lift it at all, delete or cut away parts you don't need.
    As long as polygons are exactly in the same place, you'll get perfect results.

    Of course if you use two different geometries (for example a thin line over bigger quad) you will need to lift one slightly above the other to avoid flickering, but as long as two overlapping triangles have identical vertex coordinates, GPU pretty much guarantees they will overlap ideally (assuming game engine doesn't mess with transformations in vertex shaders :) ).

    This wasn't true for rF1 since it used different Z-buffer function setting - out of two identical triangles, only one would make it to the screen. In rF2 both will.
     
    Last edited by a moderator: Aug 9, 2012
  14. Fabio Pittol

    Fabio Pittol Registered

    Joined:
    Oct 4, 2010
    Messages:
    274
    Likes Received:
    71
    Great! Thanks!!

    Other question, RealRoad works on decals over the race surface even if those decals doesn't use the RR shader? i.e. painted lines.
     
  15. ethone

    ethone Registered

    Joined:
    Nov 30, 2011
    Messages:
    1,153
    Likes Received:
    37
    Nnnnnnkinda. I'm presuming you're thinking of stuff like white lines? If you use some transparency on the decal (not just for the edges but the main bits also being partly translucent), it just paints over the main road texture. Since the decal is partly translucent, it of course won't hide the RR effects and they will still "shine" through.
     
  16. vicent-sollana

    vicent-sollana Registered

    Joined:
    Jan 21, 2012
    Messages:
    416
    Likes Received:
    17
    Hi guys,

    The information in this thread has helped me a lot,

    View attachment 5796

    Now my question is, how to assign multi / sub and keep the blend properties?
     
  17. mianiak

    mianiak Registered

    Joined:
    Oct 5, 2010
    Messages:
    691
    Likes Received:
    46
    Do you mean how to assign a gmat and keep the blending because when you set up a gmat you cant see the transparent part? If so, its still there, just export it and it will work in the game, just wont show transparencies in max.
     
  18. vicent-sollana

    vicent-sollana Registered

    Joined:
    Jan 21, 2012
    Messages:
    416
    Likes Received:
    17

    My problem is that when I'm using the 3DMax materials (material default) you can see the texture blend fine, but when I apply them the multi/sub to export them to RFactor it loses the blend. I'm confused and I don't know if I'm doing it right. I'm following the video postet by Fabio step by step, all the problem come at the moment of aplying the Gmaterial. I do not know if I explained well
    Do you know about any video tutorial specific about RFactor materials to blend?
     
  19. mianiak

    mianiak Registered

    Joined:
    Oct 5, 2010
    Messages:
    691
    Likes Received:
    46
    Yep, that's normal and a well known thing, just make sure, that src alpha and inv src alpha is set on the material and it will all work. As I said in my earlier post, you won't see any blending in max with gmotor materials, but they will export right and work in game.
     
  20. vicent-sollana

    vicent-sollana Registered

    Joined:
    Jan 21, 2012
    Messages:
    416
    Likes Received:
    17
    Thanks for the help mianiak, I'm gonna call it a day my head is going to explode and i got nothing, tomorrow will be another day,:)
     

Share This Page