Gather Vop?

   8767   7   2
User Avatar
Member
511 posts
Joined:
Offline
Wonder if anyone can help me figure this thing out (there is 0 documentation).

I'm trying to figure out how the Gather VOP works on a very basic level, so I decided to make a simple/fast color bleeding shader that simply gathers surrounding diffuse color from an exported color parameter. I figure that combining this output with occlusion should be much faster than full irradiance.

To do this I pipe normalised N into the “dir” input, set the imported variable to the same name as my exported parameter, and create the parameters for samples, maxdist, scope etc. I create a vector constant and wire it straight thru the loop.

It seems to do what I want it to do… The problem is that it always looks as if the Gather is only using 1 sample, regardless of the value I set. It takes longer to render as I increase the samples, but there's no improvement in quality at all.
I suspect I have to more than just wire a constant from from input to output just to make the red error go away I cant see how I can apply what I know about a For Loop to it.

Im stuck.

cheers
S
User Avatar
Member
39 posts
Joined: July 2005
Offline
Hi, there. Looking at the generated vex code (right click on any node and View Vex Code) it looks like the first added value plugged in to “next” of the gather vop is used for Cf in the gather call. In your setup it is always grabbing the value from the last call. I think all you have to do is plug a second value in to the gather vop, and inside add the first and second together, and plug the sum into the second added output. That seems to generate the correct code. You'll probably also want to divide by the number of samples.

Peter.
User Avatar
Member
511 posts
Joined:
Offline
Thanks Peter,

I did look and compare to the vex documentation… but looking is different than seeing
I will try what you suggested.

Btw it's pretty amazing what you can do with this thing! completely separate shaders talking to each other and all that!
Not to mention being able to sample stuff from the current shader, i.e. for a quick fake sss, displace P along N and use negated N as the dir (thus shooting rays towards the surface), Gather an exported illum model and voila, blurry diffuse lighting

renders and hip coming later.

S
User Avatar
Member
511 posts
Joined:
Offline
Hello,
adding the 0 constant to another 0 constant inside the gather loop worked (confusing or what), it now accumulates and the result gets divided by the number of samples, great

But, it doesn't work if I want to fetch more than one variable, like ray:length (which I want to use for attenuating the intensity with distance). If I do the same (adding the 2 float constants) it either renders black or only 1 sample again.
Also, If I want to sample occluded ambient lighting It doesn't work, it seems to sample N or P instead. However if I plug the occlusion output into another “next” in the gather loop (not wiring it through or anything else), it works… but why?

Anyway here's a render 3m30s on 3 cores (gamma corrected):
the circles are emmissive.


Whats great about this is:
- It will drop right into a non-pbr pipeline
- you can pick exactly what gets sent, which shader receives it and what objects are visible to it.
- bounce can come in an AOV
- whereas the regular “irradiance” shader will run the entire shader for every sample it gathers, with this approach you can decide to only gather the Lambert and a texture, or whatever.

The hip is attached, the shader contains the remnants of the distance attenuation I was talking about. If you want to see ambient light bounce make sure the occlusion gets plugged into the gather and that it gets mixed with the lambert before the “clr” export.

Cheers

S

Attachments:
GatherTest_V2.jpg (56.0 KB)

User Avatar
Member
511 posts
Joined:
Offline
oops… uploaded wrong hip.

here's the proper one

S

Attachments:
GatherTest_V2.hip (896.5 KB)

User Avatar
Member
32 posts
Joined: July 2005
Offline
Great!

I wonder why irradiance doesn't do color bleeding by default like color indirectdiffuse( point P, normal N, float samples, … ) in PRMAN
Dennis S. Sedov
User Avatar
Member
2624 posts
Joined: Aug. 2006
Offline
Awesome stuff ! This is something thats really useful ! . I have noticed a few fixes in the journal concerning gather loops !

Houdini 10.0.381: Fix a sampling problem with gather loops that would produce line artifacts when sampling with a cone angle in micropolygon rendering.

Just doing a test render the distance arb out does not seem to return anything

r
Gone fishing
User Avatar
Member
581 posts
Joined: July 2005
Offline
All the bells and whistles of a message passing render engine.
Not being a closed solution as vray has it pros
By the way, cool render serg.
Is amazing the crazy things you can do playing with the raytracing engine using tyhe gather statement.
Un saludo
Best Regards

Pablo Giménez
  • Quick Links