mmp / pbrt-v4

Source code to pbrt, the ray tracer described in the forthcoming 4th edition of the "Physically Based Rendering: From Theory to Implementation" book.
https://pbrt.org
Apache License 2.0
2.8k stars 429 forks source link

Hide Emitters in Render #348

Closed jparr721 closed 1 year ago

jparr721 commented 1 year ago

I have a simple scene based on the "hair" example, and I am looking to use the rendered geometry for compositing into other settings. I have scoured the documentation, but I have yet to find out how to turn off the visible emitters for the environment map within my scene file.

In general, I am looking to set the pixels in the background env map with an infinite light source to no data, as mitsuba does. In mitsuba, this is accomplished via the "hide_emitters" flag in their integrators. Does such a setting exist in pbrt?

For context, here is the basic scene I am working with:

Integrator "volpath"
    "integer maxdepth" [ 32 ]
Transform [ -0.999887 0.00390257 0.0145262 -0 -0 0.965755 -0.259457 -0 0.0150413 0.259428 0.965645 -0 0.146624 -9.36998 28.765 1  ]
Sampler "halton"
    "integer pixelsamples" [ 5 ]

Film "gbuffer"
    "float iso" [ 400 ]
    "string filename" [ "hair-actual-bsdf.exr" ]
    "integer yresolution" [ 1024 ]
    "integer xresolution" [ 1024 ]
    "float maxcomponentvalue" 50
Camera "perspective"
    "float fov" [ 32 ]
    "float focaldistance" 21
#    "float lensradius" .2
#Camera "spherical" "string mapping" "equirectangular"

WorldBegin

AttributeBegin
    Rotate -120 1 0 0
    Rotate 120 0 0 1
    LightSource "infinite"
        "string filename" "textures/sunflowers_equiarea_blurred.exr"
AttributeEnd

AttributeBegin
CoordSysTransform "camera"
Material "diffuse" "rgb reflectance" [.1 .1 .1]
Translate 0 2 25
Shape "sphere"  "float radius" 3
AttributeEnd

I have been reading through several sections in the book relating to films but have not yet had any luck finding a working solution to this issue. I have also tried to create a transparent scene in blender and use assimp to convert the scenes, but the transparency setting does not persist when translating between the two formats.

Thanks in advance to anyone who reads this.

pbrt4bounty commented 1 year ago

Hi.. I'm also miss this feature and I am trying to implement the 'transparent background' concept, present in other render engines. The problem is that don't I have many free time to do it. The main idea is that when the ray does not intersect with any object in the scene, the code returns a pixel of the background color, if it is defined, or a transparent pixel, if the user specifies it.

jparr721 commented 1 year ago

Figured that was the case. I'll be spending some time trying to get this working, I'll push a link to my local fork if the implementation is useful.

jparr721 commented 1 year ago

Just finished implementing this. It's not easy to get a dropped background, but you can just blast the infinite light contribution for rays without an intersection to whatever color you want. If someone stumbles on this and gets the mitsuba-like functionality, let me know.

pbrt4bounty commented 1 year ago

Good point.. Really I need time to implementing more things... For now I have some improvements for the GUI mode imagen ..and a few incompleted features for my Blender plugin.