I'm trying to create a material that will let me plug something into the emissive slot so I can have a single light in a scene and have simulated bounce light on the back of the model. I've been able to achieve a similar effect by using a hacked together inverted lambert in the custom lighting slot, but I want to be able to plug it into the emissive slot so the backlight is visible even when shadows are turned on.
Here's an image of what what things look like currently with the inverted lambert shading on a really quick and dirty lumpy test model:
And the ultimate goal is to achieve something similar to the shading in the Dota 2 comic:
Thoughts, ideas, whatever? I've been noodling around with this all day and I haven't been able to come up with a solution that works. I'm by no means a shader guru, so any help would be appreciated.
Replies
-Then maybe since you're building your lighting already with N dot L(i guess), you could lerp between 0.0, your fresnel(rim light), with the lighting. Basically masking out the rim light that's in the direct light, so only stuff in the dark(behind) shows the rim light
Maybe someone else will come up with an idea. I'll post a node view here shortly!
** edit ** meh, just inverting the normals will work fine I guess
BUT, just use the inverted lambert that you had, and plug it into the emissive, while keeping your diffuse map and normals etc plugged in too.
http://www.polycount.com/forum/showthread.php?t=101592
Basically put, anything which has the 'light vector' node and plugged into the Emissive is borked in the latest versions of UDK and doesn't work, not sure which version doesn't have this issue, but you can safely assume, all the way to Dec-2011, Emissive and Light Vec doesn't work together since I had the issue in that version too, which sucks big time.
Also, JordanW mentioned UDK has the Light Vector natively in Tangent Space, might wanna change to World Space? I don't know, since I didn't try that.
Would be grand if anyone came up with a solution to this, maybe the distance node could be used to Cull the Light Vectors Direction towards a length solution?
EDIT: Just tried and nope, still not working.
Pity, since as you said, it would be an awesome way to create and ambient and backsurface scatter in a simple way without messing around with the shadows for an artist.
I wonder if Epic is fixing everything, since they still haven't released the June version of UDK>
It's camera vector based.
really whacky, but I wonder though, if you could just fly the camera where you want the light, then get the camera's position(somehow) and then type that into a constant3Vector then do a N dot L :poly142:
Drew++:
While it looks nice, isn't that basically just Fresnel?
Something like this for feeding from kismet?
http://www.polycount.com/forum/showthread.php?t=97548&highlight=player+position
Light vector never worked in Emissive. "Emissive" is a property that is independent from light direction.
You cannot really put this in CustomLighting because that gets masked by the shadow if you're using normal shadows and not modulated.
You could put it in CustomLightingDiffuse, that's what gets multiplied by your indirect lighting. You coulnd't feed it your light vector though.
Your best bet is to probably have it come from a side (or both!) in screen space. You can transform your normal from tangent to screen space then dot it with some vector. to get a "light" direction.
Damnit Jordan! Stop teasing me with stuff I'll never be able to implement
Take a look at my above post - it's tried and tested, and uses a light vector fed into emissive.
In that situation you're not getting light vector, you're getting some garbage vector of 0,0,1.
It's using vector transform, I'm guessing tangent to world.
Changing the color from 'Blue' from the Normals in that case, to any other color, won't work, unless you go for a more 'Rim Lighting' effect kind of deal, in which case the artist will need to manually change the orientation so it corresponds to that of the light.
Invert the Normal has a chance of canceling the effect.
Factor in lack of 'distance' and radius, and you have a recipe of Blends/Animation being tied to your Kismet, being tied to your Material, which in turn is looped back to the animations/level just you can get some back-scatter effect.
If you say what I think you're saying, I tried that, but no avail.
UDK already has a pseudo-depth calculation from the Custom-Lighting when a Lambert term isn't used for Clamping.
The issue is, you cannot run away the 'shadows' or override them to get a desired effect, without getting rid of the shadows out right. Try using an Inverted Specular or Lambert term on an Opaque Material and on a Soft-Masked one. You will see the issue.
Emissive is the key here, to fake the filling up of light without destroying the shadows on a mesh, or inverted specular effect for somewhat internally bounced light behind an object.
Exactly. The problem is getting self-shadowing and faked bounce light at the same time, and it seems the only way to achieve this is with the emissive channel or secondary lighting. The problem with using more than one light is that the shading transitions don't work so hot in multiple-light situations. They're not terrible, but they're not what I want.
I'm admittedly bad at math and I'm by no means experienced with creating shaders, so this may be a dumb question:
Is there any way to grab the distance/orientation/whatever from the light and feed that into the emissive? Perhaps with some sort of null or invisible geometry or locator or something that could be bound to the location of a light by way of scripting or parenting or some other magic?
Mat:
I tried animating the light to see if I could get the light to move as Im grabbing its location from kismet and no go. Must have screwed up something Also ignore the colors haha.
Brice's shader does that very well. You basically just paint that lightsource as a gradient in the axis representing forward/backwards normal direction.
http://www.mentalwarp.com/~brice/brdf.php
I can set up an example of it with a simple mesh in Maya if you want to see it.
In the meantime, I would honestly suggest finding someway to occlude your model with an AO texture and just a simple lambert/half-lambert term without shadows.
Put in a traditional matcap/sphere mapping on your model, and call it a day.
Very cheap, I know, but hey, if TF2 and Dota are able to getaway without shadows and only a HL terms, why can we, eh?
I know UDK allows you select if a light is able to cast shadows or not, but I'm not sure if UDK allows you to do the opposite with that effect (EI: Hookup a light to follow your models around, and only cast light to a select mesh per light and no shadows).
It does work, but admittedly I'm not using vanilla UDK.