Jump to content

Managing z-shadows with instanced lights?


DaJuice

Recommended Posts

Hey there,

How do you work with z-depth map shadows using instanced lights? It works fine when I have a bunch physical lights in the scene, I just go:

Depth Map: Auto-Generate (mid-point Z)

Z-Depth Map: $HOME/zshadows/$OS-blahblah.picnc

Shadow Shader: zShadow -b

But I can't figure out how it's supposed to work with instanced lights. $OS doesn't work, it just creates one shadow map which seems to keep writing over itself (there are 87 instanced lights). Is there some other shortcut you're supposed to use with this setup?

Link to comment
Share on other sites

  • 1 month later...
Hey there,

How do you work with z-depth map shadows using instanced lights? It works fine when I have a bunch physical lights in the scene, I just go:

Depth Map: Auto-Generate (mid-point Z)

Z-Depth Map: $HOME/zshadows/$OS-blahblah.picnc

Shadow Shader: zShadow -b

But I can't figure out how it's supposed to work with instanced lights. $OS doesn't work, it just creates one shadow map which seems to keep writing over itself (there are 87 instanced lights). Is there some other shortcut you're supposed to use with this setup?

I believe there's a variable $IPT which stands for the point that the light is being instanced on.

Z-Depth Map: $HOME/zshadows/$OS-blah-$IPT.picnc

Link to comment
Share on other sites

Thank you guys! $IPT is what I was looking for. I also tried the textport thing, but I don't think I did it right, because it didn't seem to place any new maps into the folders.

Anyways, I have a new headache now:P I don't want to use the standard zdepth shadow shader available in the light object parameters, because it lacks the 'bias' setting, which I always change to something smaller. So instead I have to use the vex_rayshadow shop, the only problem is I can't get it to read multiple shadow maps. All I get is black renders. If I leave the Z-Depth Map field in the shop blank it defaults to 'Fast Shadows' which renders fine, but not what I need. Maybe I'm not putting the right thing in the field? I mean if my AutoGenerate output is something like $HOME/zshadows/$OS.picnc I should just be able to put that into the Z-Depth Map field of the shadow shop and it should read fine, correct? Or would the vex_rayshadow shop not know what to do with $OS and $IPT and so forth?

Link to comment
Share on other sites

Hi DaJuice,

You can assign a single shader to many lights and use the special variable in the shadow shader's map field: `chs("$OBJ/depthmap")` ; this'll pop the shadowmap name out of the light to which the shader is assigned. This saves you having to have many shadow/light shaders.

Also, with point instancing its possible to assign shaders directly into the vm_light and vm_shadow point attributes. If you watch Peter Bowmar's light instancing movie tutorial, you'll see how to do it.

Enjoy,

Jason

Link to comment
Share on other sites

Also, with point instancing its possible to assign shaders directly into the vm_light and vm_shadow point attributes.

Looks like $IPT variable becomes unknown at SOP, SHOP levels :(

opdef:/Shop/v_rayshadow shadowtype zdepth map $TEMP/$IPT.picnc ....blahblahblah

not works :(

Link to comment
Share on other sites

True; you have to put $IPT in the light you're instancing and state the path again in your SOP where you define your shader assignment and just take care that you're generating the right pathname and in same order at $IPT.

You can do it all pretty easily. It was a cinch to set up a lightdome tool using this stuff. Unfortunately you have to learn some of these limitations on the way. Ultimately the setup is pretty easy.

Cheers,

J

Link to comment
Share on other sites

just out of curiosity cause i haven't tried it yet, but what would happen if you were to make the light you are using to instance an area light? would that maybe achieve a softness/effect to be liked...?

edit:

actually, i just tried it out and you get some nice results with just fastshadow.. increased render times depending on your samples, but still pretty nice...

2nd edit:

after playing around with it more later on, you will want to stick with z-depth maps just purely for render times and visual correctness.. while i liked the area light samples i was doing at first, it was too slow and they just created 'interesting' looks rather than good ones (you begin to see the shape of the area light when it's instanced over and over)..

Link to comment
Share on other sites

Jason, a light dome is exactly what I'm trying to setup. I don't know where I'm getting tripped up but `chs("$OBJ/depthmap")` had no effect, it's still defaulting to fast shadows. Also I'm confused, what did you mean you have to state the $IPT path again in SOPs shader assignment? I only see options for selecting surface/displace/light/shadow shaders, but nowhere to put a path to the maps. Did you mean entering the path in a string via an AttribCreate SOP or something like that?

Link to comment
Share on other sites

  • 1 year later...

so this is a pretty big bump, but i just checked out andrewVK's dome light over at the exchange and i'm little confused to be honest...

i'm still attempting the same as what dajuice was originally after.. i'm trying to set up a dome light with softshadows (preferably z-depth).. i even tried to stay away from z-depth for a moment, but even the vex_blurshadow shader doesn't do it once i instance the light to some geometry.. finding andrew's dome setup made me jump for joy until i realized how hard of a time i was trying to reverse engineer it. :rolleyes:

if anyone would be kind enough to help me out with that, i'd really appreciate it.. andrews stuff looks great and really interesting.. i could just use a few pointers on what exactly is going on in there.. that or just any other methods to produce soft shadows with light instancing or just z-depth and instancing..

thanks everyone,

dave

Link to comment
Share on other sites

im following this with interest.  i also use the domelight from the exchange and hadnt quite figured it out  :)

17884[/snapback]

Here comes the simplified example,

hope you'll find it easier to understand.

I'm not really fluent in English

thus I hope somebody else will post the explanation.

BasicExample.zip

Link to comment
Share on other sites

awesome andrew.. that helped a ton.. that simpler example helped me grasp everything that was going on at an essential level.. after that, your dome light made a lot more sense..

a couple questions:

1. Why do we need to create the vm_light and vm_shadow attributes along with the opdef command and backticks if we want to use expressions.. Why can't a shader sop be put down, instance attributes box checked off, and then go put those expressions directly in to the shader itself? My understanding is because those expressions are using local variables only used in the SOP context and therefor can't be put in the shader parameters directly. But I wanted to clarify this because it would be a lot nicer to just be able to do that rather than modifying the opdef string every single time you want to change something.. (Which is why i can see the dome light example being nice as it just referenced a bunch of custom parameters in an otl, therefor eliminating the need to change that string all the time.)

2. Why does the light itself have to generate the z-depth maps since the light shader (v_rayshadow) seems to be already doing it. I still am a little confused there as to why it's doing it twice: Once in the light shadow shader, and another time in the shading tab of the light itself.

I think those are about it. Once again, thanks a bunch andrew.. I wish I could stick around this weekend and play with this some more, but i'm going out of town..

But yea, that extra basic file explained a ton.. very grateful for that..

dave

Link to comment
Share on other sites

>> My understanding is because those expressions are using

>> local variables only used in the SOP context and therefor

>> can't be put in the shader parameters directly.

>> But I wanted to clarify this....

This is absolutely true!!! You are right. :)

>> Why does the light itself have to generate the z-depth maps

>> since the light shader (v_rayshadow) seems to be already doing it.

True for RT shadows...this shader makes RT shadows during render process. :tumbleweed:

But in the case with z-depth shadows it only uses EXISTING maps.

This maps should be pregenerated.

Changing "Depth Map" parameter to "Auto-Generate" You force mantra to

render shadow maps first. :batman:

Link to comment
Share on other sites

This is absolutely true!!! You are right. :)

excellent.. :)

But in the case with z-depth shadows it only uses EXISTING maps.

This maps should be pregenerated.

ahh ok.. i think i get it now.. the light itself is generating the depth maps based on $IPT and the shadow shader is referencing and using those created depth maps to render the shadow based on $PT.. that makes sense...

thanks a bunch.. learned a lot from all this.. :D

Link to comment
Share on other sites

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...