Home Technical Talk

Decal technique from Star Citizen

13567

Replies

  • frmdbl
    Offline / Send Message
    frmdbl polycounter
    The triplanar mapping definitely helps in that the decals texture matches the underlying texture, which would be hard to achieve with traditional UVs.


    Another idea would be to use lightmap UVs for tilable maps and additional for the decals, where the unaffected areas would be moved to the part where there's no decal in the texture.

    This wouldn't be very elegant in terms of workflow though.
  • Obscura
    Offline / Send Message
    Obscura grand marshal polycounter
    frmdbl wrote: »
    Another idea would be to use lightmap UVs for tilable maps and additional for the decals, where the unaffected areas would be moved to the part where there's no decal in the texture.

    This wouldn't be very elegant in terms of workflow though.

    I'm not really understanding this. Could you try to explain it in an another way please? Or in a more detailed way.
  • frmdbl
    Offline / Send Message
    frmdbl polycounter
    It's just a stupid idea really, from a workflow point of view.

    The first one are you decals UVs, and the second is the Lightmap UVs that are also the basis for the tilable textures.

    The blending would be done within the materials.
    Example1.jpeg?raw=1
    Example2.jpeg?raw=1
  • Obscura
    Offline / Send Message
    Obscura grand marshal polycounter
    Ah okay I understand now. So in this case the decals has been cut into the mesh right? So they are not floating close to the main surface. This can work though, and it would require a lot less complex material. Also then they not must have to use tileables, they can use own unique textures too.
  • Obscura
    Offline / Send Message
    Obscura grand marshal polycounter
    Anyways, this would be something more like Tor's modular approach, and less like a "decal" thing. Still the result can look the same as if it would be a decal.
  • frmdbl
    Offline / Send Message
    frmdbl polycounter
    Yes, theoretically you wouldn't even need to cut the mesh if you place the decals where there is already enough geometry and it works.


    It's not very clean though as I said, but I'm not sure about using triplanar in practice and on many materials.

    I'd rather have geometry on top of existing one and blend the channels that I choose, as I'm sure you would.
  • Obscura
    Offline / Send Message
    Obscura grand marshal polycounter
    I would if it would be possible in UE4, but it isn't :(

    Anyways, with the workflow you are describing, it would require a very simple material which I'm sure its acceptable in material complexity. I'll make an example material for this. Maybe today...
  • Obscura
    Offline / Send Message
    Obscura grand marshal polycounter
    Okay so I've set up an example...
    This is the test mesh:
    DA2Uxi4.jpg
    This is the first uv channel of the mesh, for texturing:
    vvgtb0j.jpg
    This is the second uv channel for the decals. The parts which shouldn't have the decal textures, are moved to empty parts of the decal texture:
    i23V9gR.jpg
    This is a material setup for blending a base normalmap with the decal normalmap:
    CGvdrvi.jpg
    Or here is an equivalent with 1 expression for blending. This one is 1 expression, but its a material function, and it contains more expressions, so its a bit more complex inside, but doesn't look much better than the simple blend. It looks almost the same...
    puzrcnb.jpg
    And here is the result. Note that I just grabbed a random base normalmap from google...
    axp7yWI.jpg
    With base color:
    uwTqEDz.jpg
  • frmdbl
    Offline / Send Message
    frmdbl polycounter
    Yeah, it's not dissimilar to the technique used in those 'one texture environments', might have it's uses.

    Looks quite good imo, other than the normal map.
  • Count Vader
    Offline / Send Message
    Count Vader polycounter lvl 12
    Hmm, this is very interesting. So this method would work with other texture channels than just normals, right?
  • Obscura
    Offline / Send Message
    Obscura grand marshal polycounter
    Yeah. One thing that doesn't visible on the material setup image is that I've set the texture coordinate of the decal normalmap to use the second uv index (channel). I can show an image from the material with color change too on the decals in a few minutes. :D
  • Count Vader
    Offline / Send Message
    Count Vader polycounter lvl 12
    Cool, so this has a far simple material setup (which is great for me lol) But I guess less flexibility in terms of decal placement/movement and also harder to approach things like, say, rivets, where in the sub-object method you'd need to make just one plane and copy it all over your surface, whereas with this each one would need to be individually cut out of the surface and then mapped over that location in your decal atlas, correct?
  • Obscura
    Offline / Send Message
    Obscura grand marshal polycounter
    Yes, correct. The downside is that you have to cut in the "decals". Its harder to place them on the mesh.

    Here is the example for color blend, but you can use texture too. From here, its a simple lerp. And it would be that for the roughness channel too.
    FznRx1y.jpg
    x76Erkr.jpg
  • bac9-flcl
    Offline / Send Message
    bac9-flcl polycounter lvl 10
    Hell yeah! Thanks to help from Dolkar, smoothness blending is now smooth! Using two passes, separate blending modes for first pass alpha, and an additive blending mode to draw smoothness in the second pass solved all issues!

    REg49r2.gif
    4BVuDvu.gif

    I'll post the shader soon.
  • frmdbl
    Offline / Send Message
    frmdbl polycounter
    Great job, I'd appreciate you posting the shader very much.
  • Count Vader
    Offline / Send Message
    Count Vader polycounter lvl 12
    Obscura : Ok so just trying this now. Basically the tri-planar thing has to be taking place both within the Parent material and the Decal material, correct? In the 'base' material you posted, it looked like it also had that setup, rather than being simple texture/constant inputs, meaning that both the 'base' mat. and the decal. mat have to use the same method of projection and the same tiling value in order for this to work?

    And then, in the decal material, the channel that is NOT using the projection is the one that gets propagated down to the parent surface? Just trying to make sure I also understand the principle as I'm copying the material

    Also, normal map 'mixing' IS possible with its method? Confused as to how one would mix a UV-unwrapped texture (ie my Plane with the decal on it) with a tiling tex. (ie my Underlying Material)

    :)
  • Obscura
    Offline / Send Message
    Obscura grand marshal polycounter
    Yes and yes. Mixing would go in the same way, except the uv coordinates. The first input of the addition would be the triplanar normals, and the second is the decal normals.
  • Obscura
    Offline / Send Message
    Obscura grand marshal polycounter
    But anyways, if you could way a few day, I'm planning to make a version which would support layered materials, and it would make things a bit more easier because then the input for the underlaying surface would be a material, and not some textures.
  • Count Vader
    Offline / Send Message
    Count Vader polycounter lvl 12
    Obscura wrote: »
    But anyways, if you could way a few day, I'm planning to make a version which would support layered materials, and it would make things a bit more easier because then the input for the underlaying surface would be a material, and not some textures.

    Sure, that sounds awesome!
  • Obscura
    Offline / Send Message
    Obscura grand marshal polycounter
    Also I've got in contact with Epic with this topic, so I think they will lit us up about the future/other possibilities soon. :)
  • JedTheKrampus
    Offline / Send Message
    JedTheKrampus polycounter lvl 8
    Make sure to use the first UV channel for the normal map with the biggest details as that's what the tangent space is generated from.
  • Count Vader
    Offline / Send Message
    Count Vader polycounter lvl 12
    Obscura wrote: »
    Also I've got in contact with Epic with this topic, so I think they will lit us up about the future/other possibilities soon. :)

    Lol if this causes them to implement a pre-set of some kind for doing this in the future that'd be amazing.
  • Obscura
    Offline / Send Message
    Obscura grand marshal polycounter
    I think there's a chance for this. I've looked around on the unreal engine forums and there were other people wanting to do this so they know about people would use it if it would be possible. Also technically its easily possible, so maybe :)
  • Count Vader
    Offline / Send Message
    Count Vader polycounter lvl 12
    Yeah and it's already obviously been/is being used pretty widely in production contexts (ie star citizen/Alien Isolation/im sure theres other games i dont know about)
  • bac9-flcl
    Offline / Send Message
    bac9-flcl polycounter lvl 10
    Tried out a bit more complicated decal geometry this time. Pretty easy to work with, I'm loving this.

    rrwY6hZ.png

    I think there are some interesting tricks that can be done with seams - for example, designing deliberate, complex intersections, ends, turns and other bits of detail which you can then bake out into the common atlas and use to break up the seam strips. Gotta try that next.
  • Obscura
    Offline / Send Message
    Obscura grand marshal polycounter
    Great results!
  • Count Vader
    Offline / Send Message
    Count Vader polycounter lvl 12
    Looks awesome!

    Also, Obscura have you messed around with the layered thing yet at all ?
  • tynew
    Offline / Send Message
    tynew polycounter lvl 9
    Wow, those results are flawless! Great work.
  • RN
    Offline / Send Message
    RN sublime tool
    Wouldn't it be faster (for rendering) to cut in the decals into the base mesh and use a second UV set for compositing the decals with the base mesh?

    Then the second UV coordinates for the decal cuts in the mesh can be adjusted to "capture" the desired decal piece from the atlas.

    I think there might be less overdraw this way.
  • bac9-flcl
    Offline / Send Message
    bac9-flcl polycounter lvl 10
    Kryzon wrote: »
    Wouldn't it be faster (for rendering) to cut in the decals into the base mesh and use a second UV set for compositing the decals with the base mesh?

    Then the second UV coordinates for the decal cuts in the mesh can be adjusted to "capture" the desired decal piece from the atlas.

    I think there might be less overdraw this way.
    I don't think it's possible to support multi-material underlying surface if you go that route. You completely decouple decals from the underlying surface, can update them independently and so on.

    V99Zlwt.jpg

    It can certainly work for small props warranting just one tiled material, though.

    I'm also not sure how big of a deal overdraw is with these. That's not a traditional forward-based transparent shader, it's fully deferred and has no true transparency etc. The example I show above is very extreme too, real-world applications (like SC ships) barely have even 5% of the underlying surface covered by decal faces. Narrow seams, rivets and vents should not really hit anywhere as bad as stuff like full-screen particles.
  • bac9-flcl
    Offline / Send Message
    bac9-flcl polycounter lvl 10
    Tried out a way to break up seams, since you can be using lots and lots of seams when going with that hardsurface style. Works great (don't mind some weird edges between surface materials, I was too lazy to detail them properly there):

    f527p2i.png

    Pretty simple idea. Works best if your 3d software has instancing and good snapping and rotation tools, since with that placing reusable decal pieces becomes an absolute breeze.

    P.S: Another idea: as packed map layout I'm using already includes height for parallax in one of the channels, I can probably reuse it for height-based blending change, ignoring the underlying surface albedo/spec/gloss past certain depth. That will allow me to hide the edges between materials and remove the need to author them carefully and precisely. Basically, I'll have one mask (usual alpha) for blending normals, and another mask (derived from height) to blend albedo/spec/smoothness. I already do it here to some extend with dirt mapping based on AO, but using height will give me more precise control.
  • bac9-flcl
    Offline / Send Message
    bac9-flcl polycounter lvl 10
    And here is the final result. I think I have that workflow with modular seams pretty much nailed. Made some improvements to decal shader and the process itself:

    DMclF9M.jpg

    This illustrates only the approach to the seams, but I already posted examples of isolated details, which are a lot easier to use.
  • Millenia
    Offline / Send Message
    Millenia polycount sponsor
    Looks great! What's the tricount like for the above object, just out of curiosity.
  • bac9-flcl
    Offline / Send Message
    bac9-flcl polycounter lvl 10
    Millenia wrote: »
    Looks great! What's the tricount like for the above object, just out of curiosity.
    660 polys on the decal mesh, 1600 polys on chamfered surface (same vertex count as with hard-edged unchamfered version as it's just using face weighted normals with one smoothing group). Most of the surface polycount is down to nicely shaped seams between material IDs, - the less you need those (e.g. if you don't need seam decals taking turns and strafing all over the place), the more laughable your polycount will get.

    Most of the polycount would always come from seam decals I guess - absolute majority of standalone detail like rivets, depressions, hatches, bolts, vents and so on can just be mapped to tiny quads.

    I guess I can even push the decal polycount further to reduce overdraw. There will be no performance impact from e.g. 200 more faces, but some circular segments, like those big round pieces on previous models, can benefit from more precise outlines. People create vegetation models cut up to follow the textures as closely as possible all the time, so why not.
  • HowardDay
    Offline / Send Message
    HowardDay polycounter lvl 10
    Any chance we could get a look at the Unity shader? I'm extremely gung-ho to give this a shot! Especially after discovering that the Quad Chamfer script automatically does face-weighted normals!
    Thanks, and I love the work you've put into this!
  • mrgesy
    Offline / Send Message
    mrgesy polycounter lvl 7
    Interesting technique. I've been practicing it and I have a question. I see everyone is showing examples of decal quads on flat areas. But what if I want to map a bolt to a spherical body? Would you add more geo to the decal quad and conform it to the sphere? 

    I'm doing something like this in UE4 and my decal quads have different lighting from the main mesh because of slightly different world normals. 

  • 0xffff
    Offline / Send Message
    0xffff polycounter lvl 3
    The trouble with this is that your decals end up being tons of triangles, and because they are such small triangles too they become subpixel reeeal fast. And simply lodding them isn't an option either. They can be quite tricky from performance point of view, particularly with large view distances.
  • Obscura
    Offline / Send Message
    Obscura grand marshal polycounter
    mrgesy said:
    Interesting technique. I've been practicing it and I have a question. I see everyone is showing examples of decal quads on flat areas. But what if I want to map a bolt to a spherical body? Would you add more geo to the decal quad and conform it to the sphere? 

    I'm doing something like this in UE4 and my decal quads have different lighting from the main mesh because of slightly different world normals. 

    You can play around with the vertex normals of the decals, to match them to the main mesh.
  • mrgesy
    Offline / Send Message
    mrgesy polycounter lvl 7
    Obscura said:
    mrgesy said:
    Interesting technique. I've been practicing it and I have a question. I see everyone is showing examples of decal quads on flat areas. But what if I want to map a bolt to a spherical body? Would you add more geo to the decal quad and conform it to the sphere? 

    I'm doing something like this in UE4 and my decal quads have different lighting from the main mesh because of slightly different world normals. 

    You can play around with the vertex normals of the decals, to match them to the main mesh.
    I've been doing that but with a single quad on a spherical/cylindrical area is difficult to match the vertices for correct lighting.
  • Obscura
    Offline / Send Message
    Obscura grand marshal polycounter
    Ah maybe you should use some divisions and then its easier, but hard to tell without an example image.
  • Obscura
    Offline / Send Message
    Obscura grand marshal polycounter
    Here is something that just popped up and may help you guys.
    http://polycount.com/discussion/164020/3dsmax-detaching-keeping-normals#latest

    So it turns out that edit normals can be actually much more useful than its expected.
  • mrgesy
    Offline / Send Message
    mrgesy polycounter lvl 7
    Thanks! That could be very helpful to prevent normals from breaking everytime a change has to be made. I've been studying the Gladiator ship's paneling and noticed some complex things that weren't covered here. See this pic: 


    For interconnected paneling and such, how do you approach this? It seems all the interconnected paneling are one decal mesh. Mapping all those lines to one strip of paneling in the decal sheet doesn't work. 

    Maybe they laid out the paneling polygons, planar UVed on Z-axis and later textured it on the atlas? 

    Here's another paneling decal. It's all one contiguous mesh.

  • Obscura
    Offline / Send Message
    Obscura grand marshal polycounter
    What I usually do is to build a this kind of topology and then I just map it to the panel line on the decal atlas.

    Or you can do this...Then you have the panel line itself and the connection point separately in the atlas


    The first method works better in my opinion because it allows you to create any intersection shape.
  • mrgesy
    Offline / Send Message
    mrgesy polycounter lvl 7
    Thanks for that demonstration! So I guess it's also important to have various kind of intersection designs in the decal map in order to create complex paneling?
    Like this paneling from the ship. Look how many intersections are there and somehow they all manage to form clean, smooth paneling on the Gladiator ship. I still can't understand how one would unwrap this to the decal map without having seams/ intersections.


  • Obscura
    Offline / Send Message
    Obscura grand marshal polycounter
    This is how I do. Yeah you get "hard edge" where they meet but you know usually these panel lines are very small compared to the player/player view so actually its not really noticeable in game..
  • mrgesy
    Offline / Send Message
    mrgesy polycounter lvl 7
    Yeah makes sense! Thanks very much for the help and information in this thread. I'll be practicing this technique and hopefully will attempt a ship. Cheers!
  • Obscura
    Offline / Send Message
    Obscura grand marshal polycounter
    http://www.scriptspot.com/3ds-max/scripts/vertex-normals-stitcher
    From the "detach thread" again, but this is an even better solution to match the normal directions along splits.
  • Obscura
    Offline / Send Message
    Obscura grand marshal polycounter
    Hey guys! After a long time without any update on this, finally I had some free time, to write a little about the technique that I use nowadays to achieve the "Star Citizen style decals". At the last november, I was trying to get in contact with Epic Games, about how to simplify the process/workflow for Unreal. Valeriy Sorokin from there made me a breakdown about one possibility, and actually it works fine, and allows to use very simple material, while it still make possible to use unique textures... Its done in the following way:
    1. Make your main mesh, make your decal mesh, and your decal texture.
    2. Unwrap your decal meshes according to your decal map layout. Put the main mesh uvs to a place, where there is no decal detail. So the UVmap would look something like this:

    The tiny cross is the uv of my main mesh.
    3. Make a second UVmap for your main mesh, this will be used for every of the other textures (ie. tiling or unique base color map, roughness, etc).
    4. Take your decal mesh, and project their uvs to the main mesh's UVs (projection modifier in 3dsmax, transform attributes in Maya). The result UVmap will look like this:


    The result of the whole thing looks like this in the max viewport, when I apply some textures, and assign them proper UV channels:


    Now its ready to be exported... In Unreal, all you need to do, is to assign the proper coordinate indexes...


    Result:


    Enjoy!

  • bac9-flcl
    Offline / Send Message
    bac9-flcl polycounter lvl 10
    I'm not sure I follow what's happening with the projection step. You show a screenshot of a layout where a circular quad strip island (seam) and corner quad islands (rivets) are projected onto the unwrap of a cube, but that makes no sense since using that UV with the decal texture you are showing above will not yield anything useful. And vice versa, there is nothing useful for the tiled surface in those decal islands on the second unwrap, and the unwrap of the cube shown in the first, texture-approriate decal layout, has no use for the cube if you want proper proportions and texel density. Can you show the final layout of every single UV channel? 

    If you're simply producing a single mesh with two UV sets that are then used to apply two textures, then I'm not sure I understand the purpose of projection step.
  • Obscura
    Offline / Send Message
    Obscura grand marshal polycounter
    The purpose of the UV projection, is to match the decal mesh UV's position to their real position on the main mesh, so basically you don't need any shader trick anymore, to match the decal's background to the underlaying surface. Yes, It produces one mesh with 2 UV maps, and those 2 UV maps that I am showing are the 2 final UV maps.

    Also, yeah, the cube UVs are scaled down on the first UV map but that doesn't matter at all, since that channel is used only for the normals, and the cube main mesh itself doesn't have any normal detail, so its not any bad if it has worse texel density.

    **For some reason, my new posts needs to be checked out by the moderators, and won't appear until that, so here is a link to a demonstration video:
    https://youtu.be/8nBA90lWQeI



13567
Sign In or Register to comment.