Jump to content

LightWrap Per Perlight


sbjones25

Recommended Posts

So i was doing some research and found an awesome tutorial on how to do light wrapping with in a shader:

http://www.andynicholas.com/thezone/index....7&curpage=0

and i was thinking that it would be more beneficial to have this feature on a per-light basis. only thing is that it's within the material shader, not light. i was wondering if anyone had any ideas on how to go about doing that based on this tutorial above. i was thinking about being able to add each light via a + sign on the material's shader, or perhaps maybe a light shader that can control this. if you wouldn't mind posting the file if you get it so i can check it out and figure out how it could be done... maybe...???

Here is the tutorial done if you're like me and don't want to have to do the tutorial to give an attempt. Sorry about the NC file.

Thanks for any help!

Link to comment
Share on other sites

Since you already got a solution from Andy, and this is just a "wouldn't it be nice if" situation as opposed to a "the project will crash and burn without it" situation, I'll just give you a (large) hint:

The way to do it in a light shader is to bend the light's direction (L, given by the standard calculation for the particular kind of light you're writing) toward the surface normal (N) at some rate that is proportional to the cosine of the angle between the two. And let the user control both this rate and the overall amount of bending.

Warning: shadow maps don't play nicely with this kind of hackery.

Cheers!

Link to comment
Share on other sites

  • 2 months later...
I tried with values like 270 degrees and value from -.99 to 5 but the output is not looking and the terminator is not going beyond 180 degrees... can anybody tell me what could be the fault?

There is a data flow issue in that hip file. You shouldn't feed the output of the light wrap illuminance loop into the diffuse of a Lighting Model VOP. I posted a tweaked version which should behave correctly.

lightwrap_tweaked.hipnc

Link to comment
Share on other sites

  • 2 years later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...