Square Enix © Goodbye Kansas

Table of Contents

This page provides information on the Ptex Baking Options dialog in the V-Ray Common tab.

 

Overview


Ptex baking calculates and saves out material and lighting information to texture files that can be loaded back in without the need to set up UV mapping for the objects in the scene. The result of the baking process can be saved as a .ptx or .vrmesh file. Saving to a .vrmesh file (V-Ray proxy) generates point clouds to store the geometry and writes the shading information to a vertex color channel that can be read using the V-Ray Vertex Color texture. The following options are available when the texture baking engine is set to Ptex Baking.


 

UI Path: ||Render Settings window|| > Common tab > Baking Engine Settings rollout > Ptex baking options button (when using the Ptex baking engine)

 

 

 


Basic Parameters


File name – The name of the file to store the result of the baking. A full path can be entered to override the settings relative to the project's workspace. Note that .ptx is the default format. Saving to .vrmesh files requires manually typing in the file extension. Note: It will be modified by V-Ray by appending the name of the geometry and the render element. Choosing the .vrmesh output format also saves all selected objects and all render elements in a single mesh, while choosing the .ptx output format saves one texture per object.

Resolution – Determines the resolution of each sub-texture. If baking out to a .vrmesh file, this defines the density of the point cloud.

World space resolution – When enabled, the resolution of each sub-texture is calculated individually based on the size of the corresponding face in world space. (For example, if Length = 0.1 then a quad face with dimensions 10.x10 will be assigned a texture with resolution 128x128 when baking to Ptex, because Ptex texture sizes must be powers of 2. However it will have a resolution of 100x100 when baking to .vrmesh point clouds. A quad face with dimensions 10x5 will be assigned a texture resolution ot 128x64 for Ptex baking and 100x50 for .vrmesh baking, etc.) For triangles, the length of the longest side is used.

Length – Defines the diameter of the pixel (ptex baking) or the point (vrmesh baking) and each triangle/quad is divided by a number of points so that the diameter is as close to that as possible.

Samples per pixel – The value of each pixel of each sub-texture is calculated as the average value of several samples inside the pixel which are distributed in a regular grid. This determines the number of these samples, which has a large impact on the speed of baking. Note: There is no adaptive or progressive sampling performed when ptex baking, meaning you need to define how many samples you want per point.

Surface offset – An offset along the geometric surface normal at which to perform shading in order to avoid surface artifacts.

Visibility test rays – The number of rays to shoot per sample to determine if it is visible. These additional test rays are cast for each sample, not sub-sample - the test is done only once per texel/point. Visible samples are those samples that are sufficiently far away enough from the surrounding geometry, so that light can reach them. The test is performed by shooting rays in a hemisphere around the sample oriented towards the normal. If at least one of them travels at least the distance defined by the Visibility test max depth parameter before it hits anything else or it hits a light, then the sample is assumed to be visible. If the sample is not visible, V-Ray skips the shading altogether. This can speed up baking for geometry with many intersecting parts and a complicated shader graph. When baking to .vrmesh point clouds specifically, the invisible points are not stored in the mesh at all, so you can enable this option on purpose but it might slow down the baking. Setting this parameter to 0 disables the feature. The default is 32 (enable).

Visibility test max depth – The max depth factor for visibility rays. This number is multiplied by the sample size.

Outside resolution mult – The multiplier that decreases the resolution of faces which lie outside the viewing frustum. The final resolution (which has been calculated as explained above) of each face that lies outside the frustum is multiplied by this number.

Force quadrangular textures – If the geometry that is used for baking consist solely of triangles then the baked .ptex texture will contain triangular textures. If this option is On then even purely triangular meshes will produce .ptex files with quadrangular sub-textures. This also has an impact on baking to .vrmesh point clouds since the geometry sampling algorithm is the same as for Ptex and you'll get a different distribution of points by enabling this option for triangular meshes. In general, triangular sampling results in samples of the same size across each face (but can vary between different faces), in a honeycomb pattern, while rectangular sampling results in a more of a grid-like patter, but with slight variation in individual size.

Generate mipmaps – When enabled, the baked file will contain mipmaps.

Multichannel Ptex file – When enabled, all render elements will be baked into a single ptex file. Otherwise, every render element will be baked to a different ptex file. Note: RGB Color and Alpha will always be saved in the same ptex file. Note: RGB Color and Alpha will always be saved to the same Ptex file. Point clouds stored in .vrmesh are always multi-channel.

Camera independent shading – Shades surface as if hit by a ray parallel to normal instead of coming from camera.

Border mode – How to handle mesh border when filtering.

Data format – Type of data stored in texture file.

 

 

 

Projection Baking


Projection Baking – Each sample is calculated by tracing a ray starting at the sample point and with direction along the normal at that point. The value of the sample depends on the intersection of this ray with the surroundings of the object.

Mode – Specifies the direction of the traced ray.

Outside Geometry – The ray will be traced along the normal vector.
Inside Geometry – The ray will be traced in the opposite direction of the normal vector.
Outside first, then inside – The ray will first be traced along the normal vector. If no intersection occurs, then a second ray will be traced in the opposite direction of the normal vector.
Inside first, then outside – Same as "Outside first, then inside" but in reversed order.
Closest – Two rays are traced in both directions and the intersection that occurs closest to the surface is chosen.

Normal – As explained above, the rays are traced either along the normal or in the opposite direction. This can be either the Smooth normal or the Geometry normal.

Ray Offset – The origin of the ray lies on the geometry. For some applications it is useful to be able to move this origin along the direction of the ray. This parameter is used for this purpose.

Max Depth – Each ray is traced until an intersection occurs. If the distance between the surface and the intersection is greater than the value of this parameter then the intersection is discarded and the baking proceeds as no intersection has occurred. If the value of the parameter is equal to 0.0 then it is ignored and all intersections are considered.

 

 

Meta Data


The ptex file can contain information about the corresponding geometry. There are three standard meta data keys that some applications need in order to work properly. This section contains a list of these three types of meta data. Note that V-Ray does not need any of them to render ptex textures.


Include faces degrees – Number of vertices in each polygonal face.

Include faces vertices – Vertex indices of each polygonal face.

Include vertex positions – Geometric positions of the vertices.