Home Unreal Engine

LandscapeLayerBlend

decorix
polycounter lvl 11
Offline / Send Message
decorix polycounter lvl 11
Hi all,

When I use LandScapeLayerBlend node and plug this into my normal slot I
get this error? Does anybody know why this is happening?
Many thanks


warning X4008 floating point divisopn bu zero. error X4579

Replies

  • wes.sau
    Options
    Offline / Send Message
    In most cases that I encountered this, it was because the "Preview Weight" fields for all the layers in the "Layer Blend" node were set to zero. Try setting at least one layer's Preview Weight to 1 or any number greater than zero.
  • decorix
    Options
    Offline / Send Message
    decorix polycounter lvl 11
    Thanks so much for helping out. I was wondering do you perhaps know how to connect a Worldaligntexture?
    As I'm working on a landscape shader. I've come across artist using this technique to display the textures correctly (Rocks walls)

    I have done this so far, but I'm not sure how you would do this.
    tjky.jpg

    Also if you are using a color map for your landscape, I believe you need to desaturate your tiling textures.
    Can you do this in UDK too with desaturation node or is this something you still need to fix in PS??

    Thanks.
  • wes.sau
    Options
    Offline / Send Message
    Just make that input that you marked in green plug into the landscapelayerblend, into the layer input you want.

    For desaturation, when working with landscape materials, whenever possible I make edits to textures in photoshop, to keep the instruction count down as much as possible.

    If your intention is to make several grayscale textures to overlay like detail texturing onto a base color map, I would pack each texture into separate RGB(A) channels of a single texture to save on texture samplers, since landscape materials eat up texture samplers like nobody's business. Note that if you need to use the WorldAlignTexture function with this type of combined pack texture, you'd have to make a copy of the WorldAlignedTexture function and modify it to allow switches with bool inputs to mask out a particular channel.

    BTW for most ground textures that don't need to tile vertically, just use the Z Texture output of that WorldAlginedTexture function, because it is the cheapest (be sure to name your layers well though because in the landscape paintbox you'll see just vertical streaking icons instead of regular texture previews) the other two options are spendy and really gets costly with two or more of these nodes blending together.

    Also note that you can see the total instruction count of all layers in the material tree by making sure all the preview weights are non-zero (as stated in my first reply). Be sure to check "used with:" material properties are checked for landscape, and static lighting too if you're using lightmaps. You can also turn all preview weights to zero except for one layer, to compare instruction cost between different layer inputs.
  • decorix
    Options
    Offline / Send Message
    decorix polycounter lvl 11
    Hi Wes.sau

    Thanks again for the info. I know you can split your tiling textures using the (RGB) channels. + masking
    out the channel. Does this limit you to only have 3 textures (RGB) channels. How do you combine them if you wanted to lets say use 4 or 5 textures? Yes my intention is to use a overlay (with grayscale textures).

    -grass (R)
    -dirt (G)
    -rock (B)
    -sand ?
    -pebbels?

    Thanks
  • wes.sau
    Options
    Offline / Send Message
    Just use another packed texture in the same way for additional layers, and plug them into the additional sockets of the Layer Blend node as before. So two textures for your overlay materials, you can use six layers (R+G+B+R+G+B) if you don't use the alpha of those textures.

    The hard limit is the texture sampler limit, which is 16, but the lightmap directional component, lightmap averaged color, shadowmap, height/slopemap, and all weightmaps eat into that budget, leaving you with 11 textures or less to work with. The weightmaps store blending for four layers per texture (R+G+B+A) so using six layers painted on a single section/component of landscape means that it would be using two weightmap textures, leaving you with 10 textures left for your layer art.

    I haven't tested this but if you turn off static lighting you might be able to get 2 or 3 more textures without the lightmaps and shadowmaps.

    Note that you can have more textures reside in the landscape material than the actual texture limit, because the landscape system will condense each landscape component's material instance to use only the textures used in the specific layers which you paint on each section of landscape. You'll know when the limit is reached when that landscape component turns "checkerboard", then you need to erase one layer out, or find ways to reduce texture count.

    If you need more layers and are running into the texture limit you could pack layers into the alpha channels. Beware though that an alpha channel added to a compressed texture practically doubles the memory size of the texture, if that is a concern.

    Also remember this is just one method to texture landscapes. There's a few different methods each with different tradeoffs. For example, another technique is to pack 4 full color RGB textures into each corner (with UV padding) of a larger single texture and use UV cropping to retrieve each layer. Going a more conventional route can yield up to 5 paintable layers per surface, each layer consisting of one standard full color diffuse texture and one normal map texture, 10 textures there, plus one more weightmap for the 5th layer brings you to the 11 textures + 5 landscape system textures (mentioned above) = 16 total samplers.
  • decorix
    Options
    Offline / Send Message
    decorix polycounter lvl 11
    Hi,

    Thanks alot for the info. I was just wondering if my ComponentMask is placed correctly? or does it need to go
    somewere else? I'm using 2x (2048x2048 textures) R+G+B+R+G+B.

    Do you also need to use the componentmask for your detail normals maps?

    q3m9.jpg
  • wes.sau
    Options
    Offline / Send Message
    The component mask is just to cull out just one channel of the texture or color, essentially taking out a scalar component from a vector3, so for normal maps you don't want to do that because you need all 3 channels to make a normal vector.

    With just a small view of the material network, I'm not sure what else you're trying to do there so I'm guessing out of context... It seems you're attempting to grab the grass detail from a texture channel, then colorize it. But how you have it networked, you appear to be coloring three detail layers (the result of the RGB to R lerp node) but then undo it by using the desaturation, and further undo it by only grabbing the Red channel from the final desaturated color.

    If I assume that both the texture samplers shown are the same texture file and you are lerping by distance to scale up the grass detail layer in the distance, then you don't even need a component mask in this case. Just input the R channel from the top texture sampler into the Lerp A input instead of the full RGB, then you'll just be working on the R layer channel (grass). Then you don't need the desaturation node either because it will already be a single grayscale channel. Then put your multiply node into the layer blend node. This should give you the desired result for that layer: a grayscale channel converted into color detail.

    Once you understand that, you can try something more advanced: If you plan on lerping all your other detail layers by the same value, it would be optimal in that case to change the Lerp A and B inputs to be full RGB (so you setup the lerp for all the detail layers at once) and then here you use multiple component mask nodes branching from that single Lerp node to grab each R, G, B layer and then multiply each of those results by your grass color, pebble color, etc then plug these branches into the corresponding layer blend node. This keeps the instruction count down by avoiding the need to having a LERP node for every channel.
  • bentonmadisn
    Options
    Offline / Send Message
    decorix wrote: »
    Hi all,

    When I use LandScapeLayerBlend node and plug this into my normal slot I
    get this error? Does anybody know why this is happening?
    Many thanks
    warning X4008 floating point divisopn bu zero. error X4579

    As per your depiction just do one thing check whether the Preview Weight fields for all the layers in the "Layer Blend" node were set to zero and for this just make sure that the settings for at least one layer preview weight is set to 1.
    I hope this works.
  • decorix
    Options
    Offline / Send Message
    decorix polycounter lvl 11
    Thanks so much for all your help. Yes, I'm using two texture samples with a lerp for distance.
    I did run into another problem as I have SwitchParamter for my detailed normal map. I'm not
    sure if this would work, but I'm not getting any errors, but my Instance material is giving me a checker
    patern. So when I switch on (detailnormal) It ruins my landscape material. Its based on RyanSmith Master material. Do you perhaps have any idea how to get this working?

    4asy.jpg



    wes.sau wrote: »
    The component mask is just to cull out just one channel of the texture or color, essentially taking out a scalar component from a vector3, so for normal maps you don't want to do that because you need all 3 channels to make a normal vector.

    With just a small view of the material network, I'm not sure what else you're trying to do there so I'm guessing out of context... It seems you're attempting to grab the grass detail from a texture channel, then colorize it. But how you have it networked, you appear to be coloring three detail layers (the result of the RGB to R lerp node) but then undo it by using the desaturation, and further undo it by only grabbing the Red channel from the final desaturated color.

    If I assume that both the texture samplers shown are the same texture file and you are lerping by distance to scale up the grass detail layer in the distance, then you don't even need a component mask in this case. Just input the R channel from the top texture sampler into the Lerp A input instead of the full RGB, then you'll just be working on the R layer channel (grass). Then you don't need the desaturation node either because it will already be a single grayscale channel. Then put your multiply node into the layer blend node. This should give you the desired result for that layer: a grayscale channel converted into color detail.

    Once you understand that, you can try something more advanced: If you plan on lerping all your other detail layers by the same value, it would be optimal in that case to change the Lerp A and B inputs to be full RGB (so you setup the lerp for all the detail layers at once) and then here you use multiple component mask nodes branching from that single Lerp node to grab each R, G, B layer and then multiply each of those results by your grass color, pebble color, etc then plug these branches into the corresponding layer blend node. This keeps the instruction count down by avoiding the need to having a LERP node for every channel.
Sign In or Register to comment.