Page History
...
Section | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
...
This type qualifier can be used only on global variables to mark them as render channels. Render channels would be automatically created and attached in the V-Ray VFB. There are several supported channel types: bool, int, float, vec2, vec3. Writing to the render channel is done by assigning a value to the channel variable. Should there be more than a single write event to a channel variable the last written value is considered only. Set a default channel value by using an initializer.
...
Use this type qualifier to mark vec3 or vec4 types types respectively as RGB or RGBA colors so that a color swatch is generated in the 3ds Max UI to tweak this parameters.
...
The vr_DiffuseBRDFSettings structure holds parameters of a diffuse BRDF. It configures the diffuse BRDF to be attached via the vr_brdf_diffuse built-in function. See Built-in functions for more information.
Code Block |
---|
struct vr_DiffuseBRDFSettings { vec3 color; // The diffuse color for the BRDF. Default value is vec3(1.0, 1.0, 1.0). vec3 normal; // The normal for which to calculate the BRDF. Default value is vec3(1.0, 1.0, 1.0). float roughness; // Diffuse deviation in the [0.0, 1.0] range. Default value is 0.0. vec3 transparency; // The transparency of the BRDF. Default value is vec3(0.0, 0.0, 0.0). }; |
...
Code Block |
---|
struct vr_OcclusionOptions { float radius; // This parameters determines the amount of area (in units) where the ambient occlusion is calculated. Default value is 10.0. float distribution; // This parameter will forceforces the sampling rays to gather closer to the surface normal. For evenly distributed samples use 0.0. For maximum surface normal concentrated sampling use 1.0. Allowed value range is [0.0, 1.0]. Default value is 0.0. float falloff; // This parameter controls the speed of the transition between occluded and unoccluded areas. Default value is 0.0. int subdivs; // This parameter holds the number of samples that V-Ray takes to calculate the occlusion effect. Lower values render faster but produce a more noisy result. Default value is 8. }; |
...
Traces the next ray depending on the traceOptions parameter following the light path. Use this function to trace different rays originating from the current surface hit point and get their color result. This function has two modes. If the traceOptions.ray member is set to a non null vector it will be is traced. Else V-Ray calculates the ray to be traced depending on traceOptions.normal. In both cases traceOptions.rayType and traceOptions.rayGroup must be set.
...
sampler – sampler to which the texture is attached.
return value – vec3 holding the width of the attached texure texture to the sampler in its x component or 0.0 if there is no texture attached. All other components will be 0.0.
...
sampler – sampler to which the texture is attached.
return value – vec3 holding the width and height of the attached texure texture to the sampler in its x and y components or 0.0 if there is no texture attached. The z component will be 0.0.
...
Although GLSL shaders can use explicit light loops, that approach has limitations (illumination from area lights is not quite correct, it's slow etc.). This is why V-Ray allows you to use several predefined BRDF calls with useful shading components (diffuse, glossy reflection, refraction etc.). The BRDF calls are not executed immediately; instead they are collected during the shader execution into a combined BRDF, which is evaluated after the shader execution completes. In that sense, the GLSL shader is used only to set up and generate the various BRDF calls. BRDF calls are somewhat similar to closures in the Open Shading Language except that they don't return a result that can be manipulated.
...
Use this function to assign a diffuse BRDF to the shader that will be automatically used for light evaluation (both direct and indirect). The new BRDF will be is layered above other previously attached BRDFs but all result will be is summed equally. No light loops or vr_irradiance calls calls are required. A write to gl_FragColor is necessary only to determine the alpha component of the result. The rgb components of of gl_FragColor will be is ignored.
brdfSettings – holds the diffuse BRDF settings. See Built-in types for more information.
...
Use this function to assign a Phong BRDF to the shader that will be automatically used for light evaluation (both direct and indirect). The new BRDF will be is layered above other previously attached BRDFs but all result will be is summed equally. No light loops or vr_irradiance calls are required. A write to gl_FragColor is necessary only to determine the alpha component of the result. The rgb components of gl_FragColor will be is ignored.
brdfSettings – holds the Phong BRDF settings. All anisotropy members are ignored. See Built-in types for for more information.
Code Block |
---|
void vr_brdf_blinn(vr_GlossyBRDFSettings brdfSettings); |
Use this function to assign a Blinn BRDF to the shader that will be automatically used for light evaluation (both direct and indirect). The new BRDF will be is layered above other previously attached BRDFs but all result will be is summed equally. No light loops or vr_irradiance calls are required. A write to gl_FragColor is is necessary only to determine the alpha component of the result. The rgb components of gl_FragColor will be ignoredis ignored.
brdfSettings – holds the Blinn BRDF settings. See Built-in types for more information.
...
Use this function to assign a Ward BRDF to the shader that will be automatically used for light evaluation (both direct and indirect). The new BRDF will be is layered above other previously attached BRDFs but all result will be is summed equally. No light loops or or vr_irradiance calls are required. A write to to gl_FragColor is is necessary only to determine the alpha component of the result. The rgb components of of gl_FragColor will be ignoredis ignored.
brdfSettings – holds the Ward BRDF settings. See Built-in types for more information.
...
Use this function to assign a Glass BRDF to the shader that will be automatically used for light evaluation (both direct and indirect). The new BRDF will be is layered above other previously attached BRDFs but all result will be is summed equally. No light loops or vr_irradiance calls calls are required. A write to gl_FragColor is necessary only to determine the alpha component of the result. The rgb components of of gl_FragColor will be ignored is ignored.
brdfSettings – holds the Glass BRDF settings. See Built-in types for more information.
...
Use this function to assign a Mirror BRDF to the shader that will be automatically used for light evaluation (both direct and indirect). The new BRDF will be is layered above other previously attached BRDFs but all result will be is summed equally. No light loops or or vr_irradiance calls calls are required. A write to gl_FragColor is is necessary only to determine the alpha component of the result. The rgb components of gl_FragColor will be ignored is ignored.
brdfSettings – holds the Mirror BRDF settings. See Built-in types for more information.
...
Use this function to assign a Light BRDF to the shader that will be automatically used for light evaluation (both direct and indirect). The new BRDF will be is layered above other previously attached BRDFs but all result will be is summed equally. No light loops or vr_irradiance calls calls are required. A write to gl_FragColor is is necessary only to determine the alpha component of the result. The rgb components of gl_FragColor will be is ignored.
brdfSettings – holds the Light BRDF settings. See Built-in types for more information.
...
Reading values from float gl_FogFragCoord is not supported. It always returns returns 0.0 .
vec4 gl_Color returns white for front facing primitives and black otherwise.
...
Feature | GPU Support | ||||||
---|---|---|---|---|---|---|---|
Built-in variables | |||||||
gl_NormalMatrix | Always identity matrix. | ||||||
gl_ModelViewMatrixTranspose | Always identity matrix. | ||||||
gl_TextureMatrix | Always identity matrix. | ||||||
gl_TextureMatrixInverse | Always identity matrix. | ||||||
gl_TextureMatrixInverseTranspose | Always identity matrix. | ||||||
gl_TextureMatrixTranspose | Always identity matrix. | ||||||
gl_ModelViewMatrixInverseTranspose | Always identity matrix. | ||||||
gl_FogFragCoord | Always is a zero.
| ||||||
gl_TexCoord[] | All gl_TexCoord[] elements are identical, i.e. multiple UVW channels are not supported. 1 | ||||||
Built-in functions | |||||||
dFdx(); dFdy() | Always return zero. | ||||||
fwidth() | Always returns zero. | ||||||
V-Ray extensions to GLSL | |||||||
vr_Velocity | Always is a zero. | ||||||
vr_NumSuperSamples | Always is 1. | ||||||
vr_SuperSampleIndex | Always is 1. | ||||||
vr_TextureDu[] | Not supported. | ||||||
vr_TextureDv[] | Not supported. | ||||||
vr_VertexData[] | Not supported. | ||||||
vr_FrameData | Only the following are supported: vr_FrameData.focalLength | ||||||
vr_trace() | Not supported. | ||||||
vr_evalLight() | Not supported. If attempted to call it will assign the following constants to the output light iterator: light.dot_nl = -1.0 | ||||||
vr_intersect() |
| ||||||
BRDF | Only the following BRDF calls are supported 2: vr_brdf_diffuse() | ||||||
Keywords | The following keywords are ignored: __channel __persistent |
...