01_user_documentation:05_object:02_light:12_shaders
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| 01_user_documentation:05_object:02_light:12_shaders [2025/12/10 11:58] – ↷ Links adapted because of a move operation gaetan | 01_user_documentation:05_object:02_light:12_shaders [2026/09/22 12:21] (current) – Tim | ||
|---|---|---|---|
| Line 5: | Line 5: | ||
| It specifies the optical properties such as **absorption**, | It specifies the optical properties such as **absorption**, | ||
| - | |||
| ==== Common Shader Types ==== | ==== Common Shader Types ==== | ||
| - | For implementation and parameter setting see the tutorial [[02_new_tutorials:20_light:light-modeling-light-shader]]. | + | For implementation and parameter setting see the tutorial [[02_user_tutorials:20_light:01_first_steps: |
| - | + | ||
| - | === Lambert Shader === | + | |
| - | Lambertian reflection (Lambert, 1760) is a widely used model for diffuse reflection. It assumes an ideal diffusely reflecting surface, where the apparent brightness remains constant regardless of the observer’s viewing angle. Consequently, | + | |
| - | + | ||
| - | === Phong Shader === | + | |
| - | A Phong shader represents a Phong-like reflector. Its bidirectional reflection/ | + | |
| - | + | ||
| - | At a given point x, let c< | + | |
| - | + | ||
| - | c< | + | |
| - | + | ||
| - | Let c< | + | |
| - | + | ||
| - | Now if // | + | |
| - | + | ||
| - | * k< | + | |
| - | + | ||
| - | * k< | + | |
| - | + | ||
| - | * k< | + | |
| - | + | ||
| - | Otherwise, set | + | |
| - | + | ||
| - | * k< | + | |
| - | + | ||
| - | * k< | + | |
| - | + | ||
| - | * k< | + | |
| - | + | ||
| - | The bidirectional reflection distribution function is | + | |
| - | + | ||
| - | BRDF(x, ω< | + | |
| - | + | ||
| - | where β is the angle between ω< | + | |
| - | + | ||
| - | BTDF(x, ω< | + | |
| - | + | ||
| - | where η stands for the index of refraction, T for the direction of transmission according to Fresnel' | + | |
| - | + | ||
| - | The Phong shader supports: | + | |
| - | + | ||
| - | - `setDiffuse()` — sets the diffuse (reflected) component | + | |
| - | - `setTransparency()` — sets how much light is transmitted | + | |
| - | - `setSpecular()` — sets the mirror-like reflection for highlights | + | |
| - | - `setShininess()` — controls the size and sharpness of specular highlights | + | |
| - | - `setAmbient()` — ambient light scattering in the scene | + | |
| - | - `setEmissive()` — defines self-emission of light | + | |
| - | - `setInterpolatedTransparency()` — toggles interpolation of transmitted light | + | |
| - | + | ||
| - | + | ||
| - | Below is an illustration of the effect of specular and shininess: | + | |
| - | + | ||
| - | {{ : | + | |
| - | + | ||
| - | Note: In modern Phong shader implementations, | + | |
| - | + | ||
| - | === Switch Shader === | + | |
| - | + | ||
| - | This abstract base class defines a shader which switches between a set of actual shaders based on the shading environment and ray direction. This can be used, e.g., to use different shaders for front and back side (// | + | |
| - | + | ||
| - | + | ||
| - | == Algorithm Switch Shader == | + | |
| - | The // | + | |
| - | + | ||
| - | * //public AlgorithmSwitchShader (Shader guiShader, Shader raytracerShader, | + | |
| - | * //public AlgorithmSwitchShader (Shader guiShader, Shader radiationShader)// | + | |
| - | + | ||
| - | Personal note: I nearly never use the // | + | |
| - | + | ||
| - | == Side Switch Shader == | + | |
| - | The // | + | |
| - | + | ||
| - | + | ||
| - | ===== References ===== | + | |
| - | + | ||
| - | * Lambert JH, Photometria, | + | |
| - | * Phong BT, Illumination of Computer-Generated Images, Department of Computer Science, University of Utah, UTEC-CSc-73-129, | + | |
| ====== ====== | ====== ====== | ||
| {{namespace> | {{namespace> | ||
01_user_documentation/05_object/02_light/12_shaders.1765367909.txt.gz · Last modified: (external edit)
