tutorials:light-modeling-light-shader
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
tutorials:light-modeling-light-shader [2025/01/13 23:17] – extended MH | tutorials:light-modeling-light-shader [2025/01/22 15:13] (current) – [Lambert Shader] MH | ||
---|---|---|---|
Line 20: | Line 20: | ||
Lambertian reflection (Lambert 1760) is a widely used reflection model for diffuse reflection. The Lambert reflection model assumes an ideal diffusely reflecting surface, where the apparent brightness to an observer is the same regardless of the observer' | Lambertian reflection (Lambert 1760) is a widely used reflection model for diffuse reflection. The Lambert reflection model assumes an ideal diffusely reflecting surface, where the apparent brightness to an observer is the same regardless of the observer' | ||
+ | In GroIPM, a shader that simulates a Lambertian reflections can be implemented in two ways. The most straight forward way is to use a // | ||
+ | |||
+ | <code java> | ||
+ | protected void init() [ | ||
+ | Axiom ==> Box(0.1, 1, 1).(setShader(new RGBAShader(0, | ||
+ | ] | ||
+ | </ | ||
+ | |||
+ | There are a set for standard coulours (red, green, blue, black, white, etc.) defined that can be used instead. For instance the same green shader from above can be generated using the following code. | ||
+ | |||
+ | <code java> | ||
+ | protected void init() [ | ||
+ | Axiom ==> Box(0.1, 1, 1).(setShader(GREEN)); | ||
+ | ] | ||
+ | </ | ||
+ | |||
+ | The second way would be to use a //Phong// shader and use only the diffuse (reflectance) part of it whereas the not required aspects are turned off. The following will create an equivalent Lambertian reflection using a //Phong// shader object. | ||
+ | |||
+ | <code java> | ||
+ | protected void init() [ | ||
+ | Axiom ==> Box(0.1, 1, 1).(setShader(new Phong().( | ||
+ | setDiffuse(new RGBColor(0, | ||
+ | setTransparency(new Graytone(0)), | ||
+ | setSpecular(new Graytone(0)), | ||
+ | setShininess(new Graytone(0)) // no shininess | ||
+ | ))); | ||
+ | ] | ||
+ | </ | ||
==== Phong Shader ==== | ==== Phong Shader ==== |
tutorials/light-modeling-light-shader.1736806659.txt.gz · Last modified: 2025/01/13 23:17 by MH