Skip to content

Commit

Permalink
Update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Nov 17, 2024
1 parent ed04e24 commit eed2722
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 3 deletions.
Binary file modified _images/resources.data_formats_output.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified _static/images/resources.data_formats_output.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 12 additions & 1 deletion _static/python/examples.output_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,14 @@
rgb_mask = comp.get_mask(obj_pass_idx, 'Image') # create an RGB mask (i.e. only render monkey)
bounding_box_visual = comp.get_bounding_box_visual()
keypoints_visual = comp.get_keypoints_visual() # Create a visual of keypoints
axes_visual = comp.get_axes_visual() # Create a visual of axes

# AOV support - custom pass through a material shader
# For simplicity, we will assign all AOVs to all objects - but that doesn't have to be done.
all_objects = objects + [floor]

cam_normals_aov = bsyn.aov.NormalsAOV(ref_frame='CAMERA', polarity=[-1, 1, -1])
binary_mask_aov = bsyn.aov.ValueAOV(value=1)
instancing_aov = bsyn.aov.InstanceRGBAOV()
class_aov = bsyn.aov.ClassRGBAOV()
UVAOV = bsyn.aov.UVAOV() # UV Coordinates
Expand All @@ -52,6 +54,10 @@
for obj in all_objects:
obj.assign_aov(aov)

for obj in all_objects:
if 'Cube' in obj.name:
obj.assign_aov(binary_mask_aov)

# Now we assign our render passes to the compositor, telling it what files to output
output_folder = 'data_formats'

Expand All @@ -60,9 +66,11 @@
comp.define_output(rgb_mask, output_folder, name='rgb_masked') # render RGB layer masked by monkey
comp.define_output(bounding_box_visual, output_folder, name='bounding_box_visual')
comp.define_output(keypoints_visual, output_folder, name='keypoints')
comp.define_output(axes_visual, output_folder, name='axes')

# All of the following will not have any colour correction
comp.define_output(depth_vis, output_folder) # render visual of depth layer
comp.define_output(binary_mask_aov, output_folder, name='binary_mask')
comp.define_output(instancing_aov, output_folder, name='instancing')
comp.define_output(class_aov, output_folder, name='semantic')
comp.define_output(cam_normals_aov, output_folder, name='normals')
Expand All @@ -77,4 +85,7 @@
# and all bounding boxes
bounding_boxes = bsyn.annotations.bounding_boxes(objects, camera)

comp.render(camera=camera, annotations=keypoints + bounding_boxes) # render all the different passes - see output folder for results
# and all axes
axes = bsyn.annotations.get_axes(objects)

comp.render(camera=camera, annotations=keypoints + bounding_boxes + axes) # render all the different passes - see output folder for results
13 changes: 12 additions & 1 deletion python/output_data.html
Original file line number Diff line number Diff line change
Expand Up @@ -147,12 +147,14 @@ <h1>Output data<a class="headerlink" href="#output-data" title="Link to this hea
<span class="n">rgb_mask</span> <span class="o">=</span> <span class="n">comp</span><span class="o">.</span><span class="n">get_mask</span><span class="p">(</span><span class="n">obj_pass_idx</span><span class="p">,</span> <span class="s1">&#39;Image&#39;</span><span class="p">)</span> <span class="c1"># create an RGB mask (i.e. only render monkey)</span>
<span class="n">bounding_box_visual</span> <span class="o">=</span> <span class="n">comp</span><span class="o">.</span><span class="n">get_bounding_box_visual</span><span class="p">()</span>
<span class="n">keypoints_visual</span> <span class="o">=</span> <span class="n">comp</span><span class="o">.</span><span class="n">get_keypoints_visual</span><span class="p">()</span> <span class="c1"># Create a visual of keypoints</span>
<span class="n">axes_visual</span> <span class="o">=</span> <span class="n">comp</span><span class="o">.</span><span class="n">get_axes_visual</span><span class="p">()</span> <span class="c1"># Create a visual of axes</span>

<span class="c1"># AOV support - custom pass through a material shader</span>
<span class="c1"># For simplicity, we will assign all AOVs to all objects - but that doesn&#39;t have to be done.</span>
<span class="n">all_objects</span> <span class="o">=</span> <span class="n">objects</span> <span class="o">+</span> <span class="p">[</span><span class="n">floor</span><span class="p">]</span>

<span class="n">cam_normals_aov</span> <span class="o">=</span> <span class="n">bsyn</span><span class="o">.</span><span class="n">aov</span><span class="o">.</span><span class="n">NormalsAOV</span><span class="p">(</span><span class="n">ref_frame</span><span class="o">=</span><span class="s1">&#39;CAMERA&#39;</span><span class="p">,</span> <span class="n">polarity</span><span class="o">=</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">])</span>
<span class="n">binary_mask_aov</span> <span class="o">=</span> <span class="n">bsyn</span><span class="o">.</span><span class="n">aov</span><span class="o">.</span><span class="n">ValueAOV</span><span class="p">(</span><span class="n">value</span><span class="o">=</span><span class="mi">1</span><span class="p">)</span>
<span class="n">instancing_aov</span> <span class="o">=</span> <span class="n">bsyn</span><span class="o">.</span><span class="n">aov</span><span class="o">.</span><span class="n">InstanceRGBAOV</span><span class="p">()</span>
<span class="n">class_aov</span> <span class="o">=</span> <span class="n">bsyn</span><span class="o">.</span><span class="n">aov</span><span class="o">.</span><span class="n">ClassRGBAOV</span><span class="p">()</span>
<span class="n">UVAOV</span> <span class="o">=</span> <span class="n">bsyn</span><span class="o">.</span><span class="n">aov</span><span class="o">.</span><span class="n">UVAOV</span><span class="p">()</span> <span class="c1"># UV Coordinates</span>
Expand All @@ -162,6 +164,10 @@ <h1>Output data<a class="headerlink" href="#output-data" title="Link to this hea
<span class="k">for</span> <span class="n">obj</span> <span class="ow">in</span> <span class="n">all_objects</span><span class="p">:</span>
<span class="n">obj</span><span class="o">.</span><span class="n">assign_aov</span><span class="p">(</span><span class="n">aov</span><span class="p">)</span>

<span class="k">for</span> <span class="n">obj</span> <span class="ow">in</span> <span class="n">all_objects</span><span class="p">:</span>
<span class="k">if</span> <span class="s1">&#39;Cube&#39;</span> <span class="ow">in</span> <span class="n">obj</span><span class="o">.</span><span class="n">name</span><span class="p">:</span>
<span class="n">obj</span><span class="o">.</span><span class="n">assign_aov</span><span class="p">(</span><span class="n">binary_mask_aov</span><span class="p">)</span>

<span class="c1"># Now we assign our render passes to the compositor, telling it what files to output</span>
<span class="n">output_folder</span> <span class="o">=</span> <span class="s1">&#39;data_formats&#39;</span>

Expand All @@ -170,9 +176,11 @@ <h1>Output data<a class="headerlink" href="#output-data" title="Link to this hea
<span class="n">comp</span><span class="o">.</span><span class="n">define_output</span><span class="p">(</span><span class="n">rgb_mask</span><span class="p">,</span> <span class="n">output_folder</span><span class="p">,</span> <span class="n">name</span><span class="o">=</span><span class="s1">&#39;rgb_masked&#39;</span><span class="p">)</span> <span class="c1"># render RGB layer masked by monkey</span>
<span class="n">comp</span><span class="o">.</span><span class="n">define_output</span><span class="p">(</span><span class="n">bounding_box_visual</span><span class="p">,</span> <span class="n">output_folder</span><span class="p">,</span> <span class="n">name</span><span class="o">=</span><span class="s1">&#39;bounding_box_visual&#39;</span><span class="p">)</span>
<span class="n">comp</span><span class="o">.</span><span class="n">define_output</span><span class="p">(</span><span class="n">keypoints_visual</span><span class="p">,</span> <span class="n">output_folder</span><span class="p">,</span> <span class="n">name</span><span class="o">=</span><span class="s1">&#39;keypoints&#39;</span><span class="p">)</span>
<span class="n">comp</span><span class="o">.</span><span class="n">define_output</span><span class="p">(</span><span class="n">axes_visual</span><span class="p">,</span> <span class="n">output_folder</span><span class="p">,</span> <span class="n">name</span><span class="o">=</span><span class="s1">&#39;axes&#39;</span><span class="p">)</span>

<span class="c1"># All of the following will not have any colour correction</span>
<span class="n">comp</span><span class="o">.</span><span class="n">define_output</span><span class="p">(</span><span class="n">depth_vis</span><span class="p">,</span> <span class="n">output_folder</span><span class="p">)</span> <span class="c1"># render visual of depth layer</span>
<span class="n">comp</span><span class="o">.</span><span class="n">define_output</span><span class="p">(</span><span class="n">binary_mask_aov</span><span class="p">,</span> <span class="n">output_folder</span><span class="p">,</span> <span class="n">name</span><span class="o">=</span><span class="s1">&#39;binary_mask&#39;</span><span class="p">)</span>
<span class="n">comp</span><span class="o">.</span><span class="n">define_output</span><span class="p">(</span><span class="n">instancing_aov</span><span class="p">,</span> <span class="n">output_folder</span><span class="p">,</span> <span class="n">name</span><span class="o">=</span><span class="s1">&#39;instancing&#39;</span><span class="p">)</span>
<span class="n">comp</span><span class="o">.</span><span class="n">define_output</span><span class="p">(</span><span class="n">class_aov</span><span class="p">,</span> <span class="n">output_folder</span><span class="p">,</span> <span class="n">name</span><span class="o">=</span><span class="s1">&#39;semantic&#39;</span><span class="p">)</span>
<span class="n">comp</span><span class="o">.</span><span class="n">define_output</span><span class="p">(</span><span class="n">cam_normals_aov</span><span class="p">,</span> <span class="n">output_folder</span><span class="p">,</span> <span class="n">name</span><span class="o">=</span><span class="s1">&#39;normals&#39;</span><span class="p">)</span>
Expand All @@ -187,7 +195,10 @@ <h1>Output data<a class="headerlink" href="#output-data" title="Link to this hea
<span class="c1"># and all bounding boxes</span>
<span class="n">bounding_boxes</span> <span class="o">=</span> <span class="n">bsyn</span><span class="o">.</span><span class="n">annotations</span><span class="o">.</span><span class="n">bounding_boxes</span><span class="p">(</span><span class="n">objects</span><span class="p">,</span> <span class="n">camera</span><span class="p">)</span>

<span class="n">comp</span><span class="o">.</span><span class="n">render</span><span class="p">(</span><span class="n">camera</span><span class="o">=</span><span class="n">camera</span><span class="p">,</span> <span class="n">annotations</span><span class="o">=</span><span class="n">keypoints</span> <span class="o">+</span> <span class="n">bounding_boxes</span><span class="p">)</span> <span class="c1"># render all the different passes - see output folder for results</span>
<span class="c1"># and all axes</span>
<span class="n">axes</span> <span class="o">=</span> <span class="n">bsyn</span><span class="o">.</span><span class="n">annotations</span><span class="o">.</span><span class="n">get_axes</span><span class="p">(</span><span class="n">objects</span><span class="p">)</span>

<span class="n">comp</span><span class="o">.</span><span class="n">render</span><span class="p">(</span><span class="n">camera</span><span class="o">=</span><span class="n">camera</span><span class="p">,</span> <span class="n">annotations</span><span class="o">=</span><span class="n">keypoints</span> <span class="o">+</span> <span class="n">bounding_boxes</span> <span class="o">+</span> <span class="n">axes</span><span class="p">)</span> <span class="c1"># render all the different passes - see output folder for results</span>
</pre></div>
</div>
</section>
Expand Down
2 changes: 1 addition & 1 deletion searchindex.js

Large diffs are not rendered by default.

0 comments on commit eed2722

Please sign in to comment.