Vectron


Vectron (Vector-Polygon) is an OctaneRender® Procedural über primitive, providing infinite, procedurally generated scenes, volumes, and geometry, without using Meshes or Volumes. Vectron objects have zero-memory footprint, offering increased efficiencies when compared to Meshes or Volumes generated on CPUs. This enables Vectron to provide procedurally-generated, triangle-free geometry scenes on the GPU without using VRAM. Vectron works with OctaneRender’s built-in OSL (Open Shading Language) support and OSL texture shaders.

Vectron - 图1

Support for Vectron in the c4doctane plugin is limited, and described in the following sections. For access to the full Vectron feature set, use Octane Standalone.

CREATING A VECTRON OBJECT

Many presets are available in the Vectron object, which is available from Live Viewer > Objects > Vectron. Vectron objects are generated from OSL scripts. You can see and edit a given script in the edit field of the script group, or you can choose to load an external script (in that case, the code for the Vectron object will not be visible). Having access directly to the script allows for modifications as needed.

Select the Vectron object in the Cinema 4D Object Manager, and then choose the Code Group tab in the Attribute manager:

Vectron - 图2

The actual drawing of the Vectron equation will only occur in Live Viewer or when rendering, as there are no polygons in a Vectron object to draw in the Cinema 4D viewport. Instead, a bounding box is drawn (the size of which you control from the Object parameters group in the Code tab), as well as a (typically small) sphere in the center of the bounds. Any portion of a Vectron object that is defined to be outside of the bounds will be clipped and not drawn.

Typically, most Vectron scripts generate very quickly, so the Live Viewer is perfect to work with Vectron scripts, as feedback is effectively instantaneous. There may be cases where a particular script does not immediately show a result in the Live Viewer. In these cases, try adjusting the values in the Script Parameters group. You may find that the sliders in the Script Parameters group are rather finicky, as the bounds are too large. In that case, limit the range of a slider by editing the value of float slidermax in the script to 10 and then adjust as needed.

A note about scripts loaded directly from Octane Standalone:
Units of scripts written for Standalone are in meters. You may need to significantly adjust any scale values by 100 when pasting into the c4doctane version of Vectron. Functions such as booleans are not available in the plugin and will not appear in Vectron scripts loaded into the c4doctane plugin. Best to use the scripts from the presets menu if you can, as those scripts have been converted for use in the c4dOctane plugin.

A new Vectron object has an OSL script with the following lines of code:

Vectron - 图3

This script creates a simple sphere. A little extra coding, as in the image below, and you get the result that follows:

Vectron - 图4

You can download the example of the Vectron node in Figure 5 to see it in action here: VectronSphere.orbx
You can also download a collection of Vectron examples here: Fun_With_Vectron (4).orbx

Note:
OctaneRender® includes some basic operators under Geometry > Vectron, which can subtract and merge Vectron items.

APPLICATIONS OF THE VECTRON PRIMITIVE AND SDF SURFACES

OctaneRender® can render defined SDF surfaces using OSL shaders without the need to convert them to a Mesh first. You can change the surfaces with input variables without having to wait for any processing, and you can also create networks of set operations such as unions, subtractions, intersection, and their smooth variants - none of which need to be meshed before rendering, and all compiled using OSL.
_

Figure 6: Example of OSL shaders with input variables to manipulate the shape of Vectron objects
Vectron - 图5

Above is an example of a sphere subtracted from a Menger cube. This subtraction occurs at the formula level and is therefore possible in the c4doctane plugin. Object to object booleans are available only in Octane Standalone.

Vectron - 图6

Samples from shadertoy.com being fed into the OSL vectron geometry node. This example was copied from the Octane Standalone script and pasted into the Vectron Object in Cinema 4D.

VECTRON SCRIPTS

There are several preset scripts included with the Vectron object:

  • fractal1.txt
  • glsl_type.h
  • mandelbulb.txt
  • mandelbulb2.osl
  • mandelbub_clay_test
  • menger_sponge_boolean_extract.txt
  • metaball1.txt
  • primitives.txt
  • QuaternionJulia.osl
  • sdf_to_vectron_surface_displacement.txt
  • sphere.osl
  • sphereWithtexture.txt — This script uses a noise texture input. Be sure to add a projection node and set the projection to UVW to XYZ
  • sponge.txt
  • temporal_mandelbuld.txt — In order to see the result of this script, adjust the bounds values located in the Object Parameters group. Large values will be necessary.
  • Vectron Procedural Waves (slow).txt — Generates a plane with a wave texture.
  • vectron_fur_fast.txt
  • vectron_fur_with_motion_blur.txt