Per Light Shader Example (SOS!)

   2574   4   1
User Avatar
Member
27 posts
Joined: Feb. 2009
Offline
Hey guys I have attached an example file which shows the issue I'm having.

This is my first shader so *please* go easy on me It's definitely not perfect.

Here's what I'm looking for: A shader that has a nice looking diffuse pass and spec pass, as well as individual per light passes for 3 lights or so. The shader needs to use a texture with transparency, much like a VEX_decal shader or a VEX_layered_surface_shader.

The problem I'm having is my diffuse and spec passes work fine, but the individual lighting passes don't seem to be taking my transparencies into account.

To see what I'm talking about:

1.) open up the attached file and render the “test_render” rop.

2.) check out the extra image planes. You'll see that C works, spec works, zdepth works, and perlight_diff_keyLight_MAIN, fillLight_MAIN, and rimLight_MAIN *appear* to work.

3.) look a little closer and compare the “C” pass with one of the individual lighting passes. You'll notice the individual lighting passes treat the spheres as if there is no transparency.

You'll find the vop network creating the image here:

/obj/exampleVOP/decal_deepraster/

And the per light illumination loop is here:

/obj/exampleVOP/decal_deepraster/illumination_loop_diffuse

(If you're curious, the output rop sources an expression I got from odforce which can be found under >edit>aliases_and_variables on the “expressions” tab. )

Any idea why I'm not getting transparencies in my individual lighting passes?

Thanks in advance!

Attachments:
perLightShaderExample.hip (790.8 KB)

User Avatar
Member
27 posts
Joined: Feb. 2009
Offline
FYI, the reason my lights are currently set to red, green, and blue is for testing purposes only.

The real render will have a beauty diffuse pass in “C”, and specular under “spec.”

Lights are colored so I can see their actual effect and compare them to the results I'm getting from my individual light layers.
User Avatar
Member
27 posts
Joined: Feb. 2009
Offline
After looking at this some more I realize my textures are rendering with transparency, but only after the rays have contacted the surface and returned a color.

The rays hit the surface and if it's 0 they return 0, if it's 1 they return 1.

What they don't do is continue through the surface to the other side when the value is 0 or anything less than 1. How do I tell the rays to continue through the transparent areas and continue to return color information from the other side?

This is something which happens naturally when you use the built in lighting model vop, but since I'm building my diffuse from scratch I am obviously missing an important step.

As I said in my initial post, I'm new to shader building so I am probably missing some fundamental understanding here.

Any help or pointers to get me on track would be greatly appreciated
User Avatar
Member
27 posts
Joined: Feb. 2009
Offline
**************
It should also be noted that the additional image planes only seem to show up when rendering directly from the rop, which can be found here:
**************

/obj/renderOutputs/test_render
User Avatar
Member
27 posts
Joined: Feb. 2009
Offline
As it turns out, per light illuminance loops can work in 9.5 if setup correctly.

My setup was missing one key component: a front facing normal attribute

I've attached the fixed version I received today from SideFX.


Attachments:
perLightShaderExample_SESI.hip (813.5 KB)

  • Quick Links