Community
Arnold General Rendering Forum
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Custom AOVs ain't obeying camera exposure

12 REPLIES 12
SOLVED
Reply
Message 1 of 13
maxtarpini
442 Views, 12 Replies

Custom AOVs ain't obeying camera exposure

I mean I can understand that you think it''s better do it in post.. but then why standard material does it for its AOVs ? 🙂 How am I supposed to do it manually.. is the exposure parameter exposed (no pun intended) somewhere and accessble from a custom shader ?

customaov-noexposure.png


Tags (1)
Labels (1)
12 REPLIES 12
Message 2 of 13
Stephen.Blair
in reply to: maxtarpini

What kind of custom AOV?

I set up a simple scene in Maya, and I see camera exposure applied to a custom AOV
(I have a standard_surface writing to the custom AOV with an aiWriteColor)



// Stephen Blair
// Arnold Renderer Support
Message 3 of 13
maxtarpini
in reply to: Stephen.Blair

Sorry I meant from code..

AiAOVSetRGB(..) does not consider camera exposure before writing the rgb data. However a 'camera' iirc does not have a base class where we have an exposure method to implement so not sure what to do when a custom camera is present for example, I was just looking for hints or something.

Message 4 of 13
thiago.ize
in reply to: maxtarpini

I'm not entirely sure about this, but I think the camera exposure is automatically factored into the shading done through the bsdf system (look at ai_shader_bsdf.h). If your AOV comes from a LPE, I think it should have the exposure automatically applied. If it's more manual, then arnold might not know that exposure makes sense. For instance, exposure won't be applied to a normals AOV (that'd be weird, right?) but it will to a diffuse indirect AOV...

I believe the exposure is factored into the AtRay::weight field, so you could try multiplying that into your AOV if it's missing the exposure. Note that this will contain other things that weight the ray, like the camera's filter map if it has one, which may be a good or bad thing depending on what you want.

Message 5 of 13
maxtarpini
in reply to: thiago.ize

I'm writing AOVs in shader_evaluate() via AiAOVSetRGB() because AtBSDFLobeInfo() does nothing in regard to AOVs. How should I use it (because it's undocumented actually) to have it working properly ?

static const AtBSDFLobeInfo lobe_info[1] = {{AI_RAY_DIFFUSE_REFLECT, 0, AtString("diffuse")}};

Then let's say I have ie. a simple diffuse BRDF.. that works just fine with AiBSDFIntegrate() but nothing is written to the 'diffuse' AOV. And how would the diffuse_direct, diffuse_indirect and diffuse_albedo worked out ?

Message 6 of 13
alan.kingFCDLA
in reply to: maxtarpini

Hi Max. The ray type of the AtBSDFLobeInfo being AI_RAY_DIFFUSE_REFLECT should be enough for this BSDF to capture in diffuse reflection paths of LPEs. There's no need to provide anything but an empty AtString() unless you want to have a custom name to capture in the LPE.

Message 7 of 13
maxtarpini
in reply to: alan.kingFCDLA

I see thanks. It also takes care of the camera exposure as Thiago mentioned. However it looks it works only with closures and not AiBSDFIntegrate, how can I supoprt LPEs with just AiBSDFIntegrate ?


Message 8 of 13
alan.kingFCDLA
in reply to: maxtarpini

I'm glad that the lobe info works for you!


Regarding AiBSDFIntegrate(), unfortunately that sort of operation breaks the connection with LPEs. Arnold needs control over the entire integration process, and this only works with closure types.


If you need LPEs, I suggest your shader return a closure, and that you assign your BSDF to sg->out.CLOSURE() (or as part of an AtClosureList if multiple BSDFs are required).


You can read more about this, with example code, here: https://docs.arnoldrenderer.com/display/A5ARP/BSDFs

Message 9 of 13
maxtarpini
in reply to: alan.kingFCDLA

Sure that would not be a problem until I have to support SSS. How am I supposed to work with a generic BSDF API and SSS ? I mean there's only that interface to build up closures and I don't see any obvious way (and frankly not even one single reason) where an eval/sample mechanism would support me doing that. Can you help me here, Alan ?

Message 10 of 13
alan.kingFCDLA
in reply to: maxtarpini

Unfortunately custom BSSRDFs are not currently supported through the closure API. You can however combine the result of your custom BSDF and one of arnold built-in SSS closures by combining them in an AtClosureList. Something like this:


shader_eval
{
   AtClosureList closures;

   closures.add(AiOrenNayarBSDF(sg, AI_RGB_WHITE, sg->N));

   closures.add(AiClosureRandomWalkV2BSSRDF(sg, AI_RGB_WHITE, AI_V3_ONE, AI_RGB_WHITE));

   sg->out.CLOSURE() = closures;
}
Message 11 of 13
maxtarpini
in reply to: alan.kingFCDLA

Ehy Alan,
on the beta forum I have Adrien saying that an 'emission closure' with a proper label could be used in this case.. where I'd plug the color result of the SSS custom integration into the closure and then label the closure. Would this be a viable solution to bypass the lack of an SSS closure (while looking to have LPEs support) ? In the while however I could not make it properly work. There isn't any 'green' in the 'sss' but only in the 'emissive' and beauty AOVs.

AtClosureBase* emissive = AiClosureEmission(sg, AI_RGB_GREEN);
AiClosureSetLabel(emissive, AtString("sss"));
AtClosureList closures;
closures.add(emissive);
sg->out.CLOSURE() = closures;

Can you please add something about this workflow as I don't see it documented ?

Appreciated, thanks.

Message 12 of 13
alan.kingFCDLA
in reply to: maxtarpini

Yes, I see. With a bit of work you can integrate however you want inside of an emission event, I agree. Note however that this custom label isn't a LPE in itself, just a filterable event label that can form part of other paths, so you're going to have to capture them in custom LPEs and possibly modify existing ones to work custom emission events into your comp.

 

So say that the custom label of your emission-type closure is "fire". Once labeled, you can modify existing LPEs or create new LPEs via the "light_path_expressions" render option that take the custom "fire" label into account when filtering path emission events:

 

"emission_fire C<O.'fire'>" # emission events 'O' with label 'fire' that are directly visible on camera

 

If we wanted to exclude 'fire' from the default emission LPE, which is "emission C[LO]", we could modify the built-in expression to do so:

 

"emission C[L<O[^'fire']>]" # emission events from lights L or objects O which do _not_ have label 'fire'

 

More information about LPEs is available here: https://docs.arnoldrenderer.com/display/A5ARP/Light+Path+Expression+AOVs

Message 13 of 13
maxtarpini
in reply to: alan.kingFCDLA

Great pretty neat stuff.
Just a couple of things.

 

If I wrap an AtBSDF in a closure, the AiClosureSetLabel ain't gonna work. I have to set the custom label with an AtBSDFLobeInfo. That's a bit nasty to make it work without documentation because if one discovers AiClosureSetLabel he's not gonna think about the AtBSDFLobeInfo and if he does he probably expects the usual mechanism of get/set that will overwrites the property set initially ie. from a constructor. Curious then where I could use AiClosureSetLabel other than on an emission closure. 

 

Super nice that the ray type from AtBSDFLobeInfo is automatically used so one can easily write ie. C<RS'flakes'>L .

 

Injecting a color result like from custom integrated SSS into an emission closure and then set the label with AiClosureSetLabel works great if one then picks it up with <O.'testsss'> as you have shown, 2x thanks for this. However it is problematic with lights as I still miss light groups and light mixer support.

 

Sry but having you here I've to bother you also on this one .. I was just trying the mechanism with a bsdf and an interior closure so before spending time with custom stuff I just tried with the build in transmission bsdf but on a first try I'm not able to make it work : 

https://forums.autodesk.com/t5/arnold-forum/can-you-help-setting-up-an-interior-closure-for-refracti...

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report