uci-rendering / psdr-cuda

Path-space differentiable renderer
BSD 3-Clause "New" or "Revised" License
155 stars 11 forks source link

Multiple Sensors in One Scene #21

Closed uguuuuuu closed 2 years ago

uguuuuuu commented 2 years ago

I'm trying to optimize the geometry of a mesh using multiple views but found I couldn't have multiple sensors in a single scene. Is there a way to have multiple sensors in one scene or to bypass this issue?

uguuuuuu commented 2 years ago

I think I found the problem. You can't have two sensors both with a film and sampler node in a scene description file. To have two sensors in a scene, I simply removed the film and sampler node of the second sensor.

andyyankai commented 2 years ago

Here is an example

<scene version="0.5.0">
<integrator type="direct"/>
    <sensor type="perspective">
        <transform name="to_world">
        <matrix value="0.19305870430090213,0.0827332240247782,0.9776929734513401,-61.79288352514542,-0.024517110739632173,-0.9957208954905216,0.08909999755633999,-6.6111892583286735,0.9808808530981948,-0.041171736980907245,-0.1902042063134718,26.459517322802483,0.0,0.0,0.0,1.0"/>
        </transform>
        <float name="fov" value="38"/>
        <sampler type="independent">
            <integer name="sample_count" value="4" />
        </sampler>
        <film type="hdrfilm">
            <integer name="width" value="1008" />
            <integer name="height" value="756" />
        </film>
    </sensor>
    <sensor type="perspective">
        <transform name="to_world">
        <matrix value="0.019981182233969465,0.09404503606546535,0.9953674113351201,-63.53025482679393,0.02621908959588324,-0.9952730667969165,0.09350979547324277,-6.726119970128379,0.9994565081569683,0.024229191074605822,-0.02235250774687936,14.863337478276943,0.0,0.0,0.0,1.0"/>
        </transform>
        <float name="fov" value="38"/>
    </sensor>
    <sensor type="perspective">
        <transform name="to_world">
        <matrix value="-0.1869723201237998,0.07063585826833904,0.9798223956586308,-62.76157447753031,0.07253557326859389,-0.9936962283881263,0.08547746075904661,-7.6690219299860605,0.9796835928595133,0.08705389832691585,0.18067007684718417,3.0370910709381405,0.0,0.0,0.0,1.0"/>
        </transform>
        <float name="fov" value="38"/>
    </sensor>
    <bsdf type="microfacet" id="obj_bsdf">
         your bsdf
    </bsdf>
    <shape type="obj">
         your shape
    <ref id="obj_bsdf"/>
</shape>
</scene>