PDA

View Full Version : Fake lighting technique - cooperate please :)



Pavlov
03-11-2010, 04:32 AM
Hi all,
i've a challenging challenge to solve ;)
First, let's show a base technique you all surely know. When working with clipmapped items like 2D people, trees, and so on, the most difficult task is making lighting look right. There are several advanced techniques , this is a pretty basic one in Photoshop:

http://www.newtek.com/forums/attachment.php?attachmentid=83024&stc=1&d=1268306492

Put a 2D character in an isolated layer and let's suppose lighting comes from top left. Select character's contour, move selection down-right, blur it a bit, invert selection and make some curve work on remaining area: this way you can get a credible lighting effect.
BTW, the base trick in all this is to have diffuse-light photos (sadly most 2D people and tree libraries are sun-lit, which is bad).
Now, let's suppose i want to reproduce this effect automatically into LW. So i have a mapped plane facing to camera, and i want to build a setup or a material which is able to reckognize sun's position and lighten proper character's side.
How would you do this ? I have some ideas but i cant get it work. Sadly i'm still too weak at nodes to solve it.

Paolo

erikals
03-11-2010, 05:48 AM
not sure, first step, mix the DP Edge and DP Blur node somehow?

Lightwolf
03-11-2010, 06:27 AM
How about creating a soft mask in PS inside of the image, then use that as a bump map?

Basically white at the edge of the object, black at the centre (or vice versa).

Cheers,
Mike

Matt
03-11-2010, 06:44 AM
This is always the issue with these cut out people, they have lighting direction baked in. Which is why they always look stuck on.

Can you not find some people that have the lighting in roughly the right direction to start with?

Pavlov
03-11-2010, 09:37 AM
Erikals - good suggestion, ill dig it a bit, but i fear i'll get at a stop very soon since i've too little experience in managing nodes.. ;(

Lightwolf - nice, but it works just if light is in the hemisphere behind camera, i'd like to get some border light even when sun has other angles.

Matt - sure, this is a theoric experiment. In pratice i tend to use diffuse light people in every situation and i do this trick manually. Already-lit people look *always* fake, because they can have non matching gamma and sun intensity, and usually they are much harder to tweak than diffuse only photos. In general i tend to avoid direct-lit photos in every case.

Anyway, for curiosity, i'd like to find if this is something nodes can cover..
Paolo

Lightwolf
03-11-2010, 09:46 AM
Lightwolf - nice, but it works just if light is in the hemisphere behind camera, i'd like to get some border light even when sun has other angles.

You might be able to combine it with translucency then.

Cheers,
Mike

Pavlov
03-11-2010, 12:31 PM
mmm yes i thought about translucency, but i got bad results. I'll test further.

bye
Paolo

ingo
03-11-2010, 01:38 PM
Simply buy more well lit people, diffuse lit people are not that good. I prefer people with light coming from one side, so i can rotate them 180 deg if needed. If nothing works i add an extra sun just for the people.

Usually i try to avoid people in the foreground, hiding them partly behind windows, cars, bushes ... helps too and looks even more realistic. If nothing works put in a nice girl in a bikini with a 3D effect, so noone would talk about terrible lit people anymore. :rolleyes:

JonW
03-11-2010, 02:38 PM
I think it’s quicker to have more people. & as said above have people partially covered by objects, even if only a tiny percentage of the figure is covered it can really help. Or have the figures where columns of detailed objects are, not with a blank wall behind them.

If the figure is in the very foreground & is walking a small amount of motion blur can help.

If the lighting on the figure is on wrong side. Just put a Negative number for the X value in the clip map image & the same for the Alpha to flip the images. After hitting automatic size the change the X value to a “-” number.

If the person is walking past a light source on one side than the other side, you could have the same figure set up with different sequence of Alpha maps as you have shown. Fade out the first figure & fade in the second figure.

Pavlov
03-11-2010, 05:24 PM
Hi, thanks for the suggestions.
I'll try to explain better: the issue i presented in first post is an example which made me wonder about a nodal setup to automate this. In this case i've more interest for the technical challenge than for production tricks.

Paolo

adk
03-11-2010, 06:40 PM
... I like these challenges/tips you throw at us Pavlov, tho I must admit I got nowhere with this one yet. Got some interesting results but nothing solid I'm afraid.

zarti
03-11-2010, 06:44 PM
did something which might work for you (hope i understood what you want) ...
(screenshot)
83047
.
.
(scene)
83048

===
basically i instanced the image and took only the alpha from it.
blurred the alpha with one filter in Image Editor
then combined them in node editor.
===

maybe you could ad a color node to tint it bit to fit better in your environment.

i used only node which you might not have, but you can find it here (http://www.db-w.com/content/view/137/175/).
download the db&w Tools 1.5.

let me know

jmmultex
03-11-2010, 07:24 PM
I'm not at photoshop now but off the top of my head...

Would it be possible to play with the gamma curve in the green channel to try and normalize the luminance, then create a feather mask along the edge that the light is coming from and apply a gradient mask to fake a blown out highlight?

Might be totally off base here - more thinking out loud than answering.

-john

adk
03-11-2010, 11:24 PM
... just some test with bumps (moving the light around) & masks (moving the mask).

The mask looks promising in my view & bump is too tricky.

If some node wiz could figure out how to move the the alpha mask appropriately based on light rotation this could be doable I reckon. With limits of course :)

Pavlov
03-12-2010, 01:40 AM
hi all,

Zarti - thanks, but this setup doesnt keeps in account sun's position, which is the keypoint of what i'm trying to do ;)

immultex - in photoshop there are many ways to achieve this result, but i'm trying to get it nodally (or within LW alone anyway)

ADK - yes bump trick seems a good method, i got good results. problem is you would need a non-linear blurring in alpha map or you get an "emboss" effetc. I'll post a test soon (i keep being curious about how tracking sun's position and offset blurred alpha within nodal itself, anyway)

Paolo

zarti
03-12-2010, 01:53 AM
hi all,

Zarti - thanks, but this setup doesnt keeps in account sun's position, which is the keypoint of what i'm trying to do ;)


sorry, it was 3am at that moment and i only spent 10 minutes with it.
now im entering in my office and will try something with the sun. =)

ingo
03-12-2010, 02:17 AM
Hi, thanks for the suggestions.
I'll try to explain better: the issue i presented in first post is an example which made me wonder about a nodal setup to automate this. In this case i've more interest for the technical challenge than for production tricks.

Paolo

Hmm, i used a "spherical" polygon for trees instead of the usual flat polygon to catch the sun more realistic, maybe you can do that too for your peoples; thats much better than bump mapping.

Maybe you can connect the nodes to a null that represents the sun. Or how about making a normal map ?

Pavlov
03-12-2010, 02:22 AM
ok,
bump trick works. Strangely enough, bump behaves correctly even when sun is *behind* object. As you see in the pics, first two are with sun within the emisphere behind camera, but in third one sun is going behind polygon and you still see the effect. I dont understand why, since gaussian blur makes a linear gradient and thus the "embossed" part of the pic should get lit only upon a certain sun's angle. Maybe the high bump's value can raise this angle up to nearly 90 from normal's angle.
Now i'll try to avoid the embossy-look trying a non-linear blur in photoshop.

Paolo

edit - ingo, non planar poly is interesting, i'll try it... even if it's still a production trick. I'm pretty much material-oriented in this thing ;)

zarti
03-12-2010, 02:35 AM
something which takes into account the sun's position, but not yet the movements on z axis. Z-thing can be 'done' somehow (i think) ...
.
83055
.
=========
you have a slider in viewport to correct the scale in which the texture moves relatively to sun's distance from the origin (0,0,0)
=========


if this is for a project you are doing, i could refine a bit the lighting part of nodes to help you more. as i said, i was fast just to see the blur and the mask, but not the result.

let me know

Pavlov
03-12-2010, 03:25 AM
Hi zarti, i get an error - it doesnt find item motion node. It's into Dpont's collection, i have it installed butwhen loading scene i get the error.
Any idea ?

paolo

zarti
03-12-2010, 03:30 AM
do you have 'installed' the Node Item Motion from dpont ?

link (http://pagesperso-orange.fr/dpont/plugins/nodes/Additionnal_Nodes_2.html)

zarti
03-12-2010, 03:39 AM
i cleaned the scene from another node, which might not affect the scene ... but just to not give you errors.
.
83056
.
this should be fine with Node Item Motion and db-w tools 1.5 only

Danner
03-12-2010, 06:51 AM
I gave this a try too. blured the silouette then used nvidia's normal map plug in photoshop to convert it to a normal map. on this image I have a red, orange and red light to test it out. On my tests it worked better than a bump map.

ingo
03-12-2010, 10:38 AM
.........edit - ingo, non planar poly is interesting, i'll try it... even if it's still a production trick. I'm pretty much material-oriented in this thing ;)

Just to give an impression what i was talking about :

erikals
03-13-2010, 03:41 AM
i'd just use HDinstance...

Pavlov
03-13-2010, 02:31 PM
Zarti - seems interesting, thanks, even if it's not fully automated but it requires your intervention everytime you move the sun. Also, i think slider should move X pos of blurred texture, but last scene has not any envelope there - maybe you turned it off ?

Danner - normal map looks surely better than bump. As side note, it seem you too start from a gaussian blurred pic, which goes linearly from Black to white. This causes an "embossy" look which is evident in my child test. I tried some gamma tricks in PS to get a non linear gradient on border to get a more round look, but it's not so easy as i expected.

Erikals - if we talk about 3d people, i can agree ;)

Paolo

Danner
03-13-2010, 03:07 PM
you could get close enough to a nonlinear gradient in PS combining layers with diferent blur amounts.

Pavlov
03-13-2010, 03:57 PM
What surprises me is that Ps has not an easy way to do this.
I'll try your way... actually i was trying reducing the border of some pixels, then applying a glow with custom border; there you can use a curve to define falloff. But the fact they put a ton of (also useless) blurring filter tools and not a custom gradient one, looks like a feature hole to me ;)

Paolo

3dworks
03-13-2010, 05:00 PM
another test with bump, but 'old school' layered style. as bump reacts automatically to the used lightsources, i guess that's already half the recipe. probably it's convenient to mix that silhouette with a fake bump map derived from the color map break up the soft border. sorry for the not really great people cutout example, i should have used a diffuse light map ;)

zarti
03-13-2010, 05:01 PM
Zarti - seems interesting, thanks, even if it's not fully automated but it requires your intervention everytime you move the sun. Also, i think slider should move X pos of blurred texture, but last scene has not any envelope there - maybe you turned it off ?

...

Paolo

it is automated; you move the light on left or right and the shading follows its logic.

anyway, considering;
1] the sun in your renders will be never near the axis of the camera and 2] your 'people' are 2d, i believe you have a good control with that template scene.

in the scene i uploaded, you can use a light as the real Sun and the slider in that case would serve only as a scale-multiplier.
(Sun distance from Origin Point * Slider Control Value = X and Y movement of Lighted Texture )
so if Sun would be 1Km over the People, the scale-multiplier of 0.0001 would convert that distance to 10 cm. that's how i meant it.

if you want another solution; this might be a General control on viewport "How much the Lighted part is moved on every Surface (People)".

one question; are you generating stills or animation ?

Pavlov
03-13-2010, 05:40 PM
Hi Zarti, yes i got what you say, problem is the scene you linked misses a linking somewhere and moving sun doesnt do anything. I dont get anymore missing plugin errors, so i really dont know what's happening. Are you on LWHC ? I'm on 9.6 32 bit.
Regarding me, my main work area is archviz, both stills and animations.

paolo

EDIT - markus, yes Bup was already suggested on this thread and it works nicely. read back, there's just a minor and solveable issue in getting a non-bevel bump effect.

3dworks
03-13-2010, 05:47 PM
definitely, the layered bump solution seems the best compromise between workflow and result to me. breaking up the beveling with another bump layer is effective at least. here another example (animated GIF) - also (!) notice the shadows on the white bag...

zarti
03-13-2010, 06:14 PM
strange: i loaded and it crashed (!)
i found that the instance on Image Editor caused the crash. deleted instance. regenerated it and no more crashes.

strange also that the surface wasn't saved. so i remade it.
see it in action (the attached video) ...

83079 (XVID)

WCameron
03-13-2010, 06:40 PM
My brother told me about a program that can make normal maps from flat 2D Images. perhaps something along those lines would work as well... I'll get more information from him when he wakes up...

- Will.

Pavlov
03-13-2010, 06:57 PM
Zarti, i see - i'll try to clean the scene too, now i'm at home.
Wcameron - yes there are some around, one was mentione in this thread somewhere.

bye
Paolo

WCameron
03-13-2010, 07:01 PM
Hah, holey crap i completely missed a page of the thread. heh. oh well, never mind.

- Will.

zarti
03-14-2010, 04:59 PM
here i made a scene totally in lightwave 9.6 (and everything inside the surface Node Editor).

(Screenshot)...
.
http://www.newtek.com/forums/attachment.php?attachmentid=83092&stc=1&d=1268607450
.
.

and here is the video of it in action.
(sorry for not letting some renders to finish but my laptop is 5 years old and when i captured video rendering times were unacceptable.
without videocapturing process in background a single frame took only 2.3 seconds) (!!!)
.
83093 (XVID)
.

=====================
+no 3rd party nodes or tools are used.
+basic ColorCorrection controls + a simple Color Overlay within the same affected zone.
+control the amount on zone to be affected (oc, its orientation depends from the SUN light).
+i suggest to separately create and load blurred alphas/masks, because it is not safe to use instances created in Image Editor. maybe you can offset it out a bit.
+to use in another surface, just copy paste the surfaces and simply replace the respective images.
+in the same way like this one, a Shadowed setup could be build.
=====================

here you have; scene, surface, plane object and the image.
.
83094
.

hope this works for you or someone else.

let me know

adk
03-14-2010, 06:07 PM
... works like a treat zarti :thumbsup:
Thanks a bunch for the descriptive node names as well ... will help figuring out what's what.

zarti
03-14-2010, 06:38 PM
if this solution would be useful, maybe i should describe and organize them a bit better so everyone could use those easily or make more complex things starting from it.
maybe i should built the Shadowed setup too ....

p.s.:
i do not have any appropriate ( arch previz ) scene to test Load From Scene scenario.
if that would load and still be functional, that would mean that my setup might be useful not for learning purposes only, but used in real projects too.
theoretically it should work. can someone confirm this ?

Pavlov
03-15-2010, 05:27 AM
Zarti, your setup is awesome !
Very useful and instructive, thanks a lot.
BTW it works well with load from scene.

Paolo

3dworks
03-15-2010, 05:43 AM
zarti, very nice setup, thanks for sharing! :thumbsup:

for my workflow i will adapt it to use the layered image nodes, as it is faster to control image maps inside the front end of surface editor. this way it's easy to update an existing 2d people library by simply adding the node network (and, if not already added, the missing blurred alpha map)...

cheers

markus

Danner
03-15-2010, 07:14 AM
just don't use it for crowd simulation it's slow!