Home Unreal Engine

Shadow questions.

polycounter lvl 13
Offline / Send Message
16bit polycounter lvl 13
I'm having a problem with my custom shader. Self shadowing shouldn't show on something that is cel-shaded, and yet I have no clue how to disable it and allow it to cast shadows on other things.

M2wrong.png

What I'm getting.

m2correct.png

What I'm needing.

Another question would be how can I affect the cel shading material from shadows

shadowquestion.png

See that just doesn't look right, I would like it if I could get the material to shade the shadow in the cel shader itself instead of just putting it on the gun and overwritting the cel shading.

Replies

  • Oniram
    Options
    Offline / Send Message
    Oniram polycounter lvl 17
    it would help to see the material.
  • 16bit
    Options
    Offline / Send Message
    16bit polycounter lvl 13
  • Oniram
    Options
    Offline / Send Message
    Oniram polycounter lvl 17
    oh wow thats very minimal for a cell shader.

    try out something like this

    http://www.moddb.com/games/unreal-tournament-3/tutorials/tf2-shading-in-ut3
  • 16bit
    Options
    Offline / Send Message
    16bit polycounter lvl 13
    The shader is actually very large, I just cut out all the unimportant stuff like reflections, and specularity so it could fit in one image.

    I have seen polyphobia's tf2 shader, but I don't like having to use a gradient ramp. And I don't really want to use TF2's style.

    In anycase, I need help on disabling self-shadowing and shadows affecting the cel shader.
  • Vailias
    Options
    Offline / Send Message
    Vailias polycounter lvl 18
    This seems to be a problem across UDK.
    Self shadowing doesn't seem to have a simple toggle in the mesh, light, or shader.
  • 16bit
    Options
    Offline / Send Message
    16bit polycounter lvl 13
    So can I fix that in code? I don't know, go into the shadow code and just turn off the self shadowing part? I'm not a coder so just throwing some stuff out there.
  • Vailias
    Options
    Offline / Send Message
    Vailias polycounter lvl 18
    If you have a UDK source licence, sure.

    A quick grep through the UDK script source doesn't come up with options to turn self shadows off, just the known options for no shadows at all or self shadow only.. etc.
  • 16bit
    Options
    Offline / Send Message
    16bit polycounter lvl 13
    Well I have a work around for one of the problems.

    shadowrigged.png

    I have 2 meshes. The one you see has shadows turned off. The other is a hidden mesh that is a very low poly approximation of the former.

    This wouldn't work in actual gameplay though, but it got me thinking. Can I have a mesh only render at an intersection? Like a mesh only renders part that is intersecting with other geometry. I could have my programming create faux shadows.

    Or how about having a separate shadow model that stretches and flattens itself on other objects depending on the light vector?

    You see I'm just throwing stuff out cause I really wish epic would allow us to turn off self-shadows.

    shadowtransition.png

    I mean the model just changes art style just because it's under a shadow.
  • Vailias
    Options
    Offline / Send Message
    Vailias polycounter lvl 18
    Funny, I thought of what you just did as I came back to this post.

    You could code a shadow model/plane to stretch with the angle of a light vector.. would be limited to one light per shadow shape though, and would work best on flat ground.

    Since you're doing somethign cell shaded, you likely don't need a lot of the crazy lightmass and highly realistic rendering stuff built into udk, so my suggestion would be to turn off shadows and set up projectors instead. Basically do it the old fashioned way from UT2k4 and whatnot. And apparently projectors are now called light functions.
    I haven't experimented with this in UE3, but it may work.. you'd effectively need to do manual shadowing for your static objects.
  • 16bit
    Options
    Offline / Send Message
    16bit polycounter lvl 13
    Well the game has a dynamic day and night system. Which means I have a dominant directional light that turns 360 degrees every 24 minutes.

    I don't know how that would work well with light functions.

    So I have a couple of ideas. My first being a shadow model. Depending on the angle of the light vector it moves and scales the model on the ground, object, player, what have you. That doesn't sound so hard. But how do I tell it to flatten once it hits something? And how would this work on a skeletal mesh? A static object would be easy, it doesn't move. But a character that can run and jump? Would I need to rig the shadow mesh?

    My other question was about HLSL and custom nodes in the material editor. Would recreating my shader in HLSL fix my problem of shadows turning it back into phong lighting problem?

    And my last possible solution for the self-shadowing. Even though I can't go in and edit the code to turn it off, I notice that it disappears after a certain distance. Can't I find that part of the code and just.. turn it to 0 or something or have it so small that you couldn't practically get close enough for it to render it.
  • Vailias
    Options
    Offline / Send Message
    Vailias polycounter lvl 18
    The shadowing routines aren't exposed to the object shader portion of the engine. At least not the part accessible through the shader editor.

    I'm not sure there's a script or high level solution to what you're looking to do.

    IF you absolutely need the day/night cycle then no it probably wont work well. The shadow mesh I was thinking of would be a flat plane. It wouldn't project on objects well. For moving characters it wouldn't work very well at all, and I'd suggest something like a simple fuzzy dot shadow, definitely not realistic, though it depends on the particular aesthetic you're going for as to what kind of detail you need.
  • 16bit
    Options
    Offline / Send Message
    16bit polycounter lvl 13
    shadowfix.png

    Well it's getting there. Fiddling with Modulated Shadow Color and Cascaded Shadow Maps.

    Problems left to solves are.

    Self Shadowing still rears its ugly head at the half way mark making the weird scratchy shadows. Right now I have the Shadow Cascades at maximum, which I realize is somewhat absurd. Leaving it at default looks fine anyway. That problem will likely only be solved the day Epic lets us just turn the feature off.

    And 2, the shadow needs to interact with the material. Right now the specular dots are showing in the shadow and it shouldn't.

    What would be really great is if I could get the cel shader to work outside of a material. Use Epic's lighting information to alter the game. Maybe in some kind of pre process?

    In any case this is.. acceptable. There's really nothing more I can do.
Sign In or Register to comment.