Jump to content

Lots and lots and lots of lights (how to render)


Recommended Posts

I have a setup where I need a lot of lights (over 1000) projecting thin shafts of light through thin smoke. I have a bunch of other objects that need to occlude some of the lights and cast shadows, etc. Unfortunately, I can't just instance some volumetric cones to my source points.

So... instanced lights are crazy crazy slow, like unrenderable.

Setting up points and using a geometry light with them, I don't think will give me the focused beams of light I need...

Anyone have a good idea here?

Link to comment
Share on other sites

I actually don't think that instancing helps at all in that case (for lights) as mantra still has to loop over all the lights when integrating the direct lighting contribution. Unfortunately the feature to just select a single light at random is not yet implemented.

Your best chance (depending on the setup) is to use "Active Radius" with a ramp falloff as aggressively as you can. This is the only way to get a sane amount of lights for a specific shading point.

Are you using spotlights? They should be optimized in a way that everything that's outside of the cone angle is not considering the light. It's at least true for the ASAD light shader which I believe is used for the spotlight.

    if (docone)
        __illuminateangle = radians(min(coneangle*0.5+conedelta, 180));

Could you provide an example hip file so we could play around with the specific setup you have?

Cheers,

Dennis

Edited by dennis.albus
Added the spotlight information.
Link to comment
Share on other sites

5 hours ago, petz said:

what about vm_pbrmultilight?

The toggle is there, but it's unfortunately not implemented.

You can check the pbrlighting code to verify.

///	Reserved
///  - int multilight @n
///	Reserved

Multilight is just reserved for now so it is not used otherwise. OR it might have been used in previous versions and not anymore (I think the first versions of PBR did select one light at random).

If you take a look at pbr_direct_light you can further see that mantra loops over all the lights:

/// This method iterates over the lights, calling the illuminate() shader (as
/// defined by the vm_illumshader property).
    int nlights = len(lights);

    for (int i = 0; i < nlights; i++)
    {
	int	lid = lights[i];

	if (!haslight(inMat, inP, lid, "direct", level == 0))
	    continue;

	// Evaluate into write-only temporaries
	vector	tmp_light;
	vector	tmp_noshadow_comp[];
	float	tmp_samples;
	vector	tmp_comp[];

	light	lt = getlight(lid);
	lt->illuminate(

 

There's also a visual way to verify. You have to create a scene with two lights and set all samples to 1 and disable variance AA. If you now inspect the direct_samples AOV it will report 2 samples no matter if vm_pbrmultilight is turned on or off.

Cheers,

Dennis

Edited by dennis.albus
Fixing typo.
Link to comment
Share on other sites

Sample file attached. This is a very basic version of what I am trying to do. The dome will have many panels in it that will open, close, rotate and move during the shot. Behind each of these panels should be a focused spotlight, creating long beams of light. There's a hero object sitting at the center of the dome that should be receiving the lighting from behind the panels. I stripped out all the lights... Just left template points to help explain.

ManyLightsProblem.hip

Edited by bandini
Link to comment
Share on other sites

5 hours ago, dennis.albus said:

The toggle is there, but it's unfortunately not implemented.

 

that´s too bad! i´m pretty sure it worked in houdini 12 or 13 (don´t remember anymore).

 

petz

Link to comment
Share on other sites

On 5/4/2016 at 2:52 PM, bandini said:

Sample file attached. This is a very basic version of what I am trying to do. The dome will have many panels in it that will open, close, rotate and move during the shot. Behind each of these panels should be a focused spotlight, creating long beams of light. There's a hero object sitting at the center of the dome that should be receiving the lighting from behind the panels. I stripped out all the lights... Just left template points to help explain.

ManyLightsProblem.hip

I am having a similar problem and the the way I find more feasible is to use geometry light so I've copied a geometry light like shape or better a sphere where I want the lights and I use it for the geometry light. The good thing is that you can actually render the thing, the kind of bad thing is that you are going to need more samples depending of what you are doing, it worked for me at least.

I hope that helps.

ManyLightsProblem_geo_light.hipnc

Link to comment
Share on other sites

I meant to get back to you with my results, but was too busy at work. Sorry.

We also had a similar situation with thousands of lights. We also ended up using a geometry light for that. However we did not have to have spotlights with a cone angle. How did you make that work with the geometry light? Did you physically block the light?

Link to comment
Share on other sites

On 5/9/2016 at 1:32 AM, dennis.albus said:

I meant to get back to you with my results, but was too busy at work. Sorry.

We also had a similar situation with thousands of lights. We also ended up using a geometry light for that. However we did not have to have spotlights with a cone angle. How did you make that work with the geometry light? Did you physically block the light?

I didn't get cones working with the geo light, just the general light-casting. Faking it with volumes copied to the points as a quick proof of concept, which I photoshopped and manipulated to push through some look-dev frames. Client has not bought off on the idea yet, so I have had to move on to other things.

Link to comment
Share on other sites

@Atom: I encountered that problem too :( I don't know what could I improve in the shader at the moment.

Limit volume bounces, though. Nine is way, way too much. You'll get similar effects with 4, even with 3.
GI seems to be of help, but only slightly. What's needed is 10x improvement in speed, not 50%.

I'm almost sure that the cause of noise is this: hundreds of samples are sent but - for narrow angles, like 0.99-0.995 - only a few of them contribute to the actual light. To fix this, one should discard samples early, right after calculating the dot product( nN, nI ).
 

Edited by OskarSwierad
Link to comment
Share on other sites

Was having a think about this (jeez its 3am, I gotta get to bed!), wondered if you could cheat this by carving the density based on light positions. Ie, if you have a bunch of points that represent where lights will be, calculate a cone from each point into the volume, set density to 0 if a voxel isn't within any light cone, otherwise make density be based on distance to light, cone width etc...

This is super rough (its a translation of this point-in-cone code I found ), but it seems to work, and renders relatively quickly. Only realised while typing this that a less labour intensive version would be to take the next step that folks did earlier, to parent a small cone of fog to each light, but then vdb merge them all into a single volume. Oh well. Still, an interesting thing to play with.

The vbd resolution is super coarse to keep the gif capture quick, I lowered the res from 0.05 to 0.02 for mantra test renders.

vol_cones.hipnc

fake_vol_cones.gif

 

  • Like 1
Link to comment
Share on other sites

Yes, VDB volumes instanced to points is where I ended up. The issue with the setup is accounting for occlusions and shadow casting. I think some kind of raytracing would have to be implemented in the volume lookups.

Link to comment
Share on other sites

If you look at the file you will see I created a NULL with an integer value for sample count. I paste a relative reference into the lights, the shader fog sample and the mantra node so I could test brute force sample increase in all paces. There is a little pickup in quality but render times increase quite a bit. Not viable for humans to witness, only robots.

Edited by Atom
  • Like 1
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...